!pause/!unpause (Map Command)

Yuki
Decennium
Joined
Aug 10, 2008
Messages
858
Reaction score
516
Hey everyone, I got this idea from DMS (the idea only). I decided to make a command that stuns everyone on the map and makes them unable to move. This will not affect Game Masters.

Code:
} else if (splitted[0].equals("!pause") || splitted[0].equals("!unpause")) {
	for (MapleCharacter chr : c.getPlayer().getMap().getCharacters()) {
		if (splitted[0].equals("!pause")) {
			if (chr.isGM()) {
			} else {
				MobSkill ms = new MobSkill(123, 1);
				ms.setDuration((long) Double.POSITIVE_INFINITY);
				chr.giveDebuff(MapleDisease.STUN, ms);
			}
		} else {
                	if (chr.isGM()) {
                        } else
                        	chr.removeDisease(MapleDisease.STUN);
                }
		mc.dropMessage("Done.");
	}

Side Note: Tested, works.
 
Last edited:
Works. but how do i make it stun GMS?

I made it so it stuns everyone on the map that isn't a GM. That would also include the GM using the command. I could do it so it could do everyone except the user, but I'm lazy right now.

i think u need to add something @ the return;:mellow:

The purpose of the return is to make sure that the function breaks if the server goofs up and makes a mistake with the command (which is highly unlikely).
 
Last edited:
I made it so it stuns everyone on the map that isn't a GM. That would also include the GM using the command. I could do it so it could do everyone except the user, but I'm lazy right now.



The purpose of the return is to make sure that the function breaks if the server goofs up and makes a mistake with the command (which is highly unlikely).
how do i fixed this, i got this error while compiling
PHP:
init:
deps-clean:
Deleting directory C:\Users\User\Desktop\maoke\ThePack\ThePack\src\build
Deleting directory C:\Users\User\Desktop\maoke\ThePack\ThePack\src\dist
clean:
init:
deps-jar:
Created dir: C:\Users\User\Desktop\maoke\ThePack\ThePack\src\build\classes
Compiling 362 source files to C:\Users\User\Desktop\maoke\ThePack\ThePack\src\build\classes
C:\Users\User\Desktop\maoke\ThePack\ThePack\src\net\sf\odinms\client\messages\GMCommand.java:81: missing return value
                                        return;
                                        ^
1 error
BUILD FAILED (total time: 7 seconds)
 
how do i fixed this, i got this error while compiling
PHP:
init:
deps-clean:
Deleting directory C:\Users\User\Desktop\maoke\ThePack\ThePack\src\build
Deleting directory C:\Users\User\Desktop\maoke\ThePack\ThePack\src\dist
clean:
init:
deps-jar:
Created dir: C:\Users\User\Desktop\maoke\ThePack\ThePack\src\build\classes
Compiling 362 source files to C:\Users\User\Desktop\maoke\ThePack\ThePack\src\build\classes
C:\Users\User\Desktop\maoke\ThePack\ThePack\src\net\sf\odinms\client\messages\GMCommand.java:81: missing return value
                                        return;
                                        ^
1 error
BUILD FAILED (total time: 7 seconds)

Just remove the return value if it won't compile. All it's doing is preventing you from seeing "Done." when you execute the command.

Nice scripted! Well done! Perfect! Magnify!

Thanks (Hard to tell if that's sarcasm or not...)
 
can i put return true; or return false;? i also dun know what will happen:cool:

return; is just used to end the function. The final line "Done." will spit out if you remove the return, that's all. You can't return true/false in a void. >_>
 
Just remove the return value if it won't compile. All it's doing is preventing you from seeing "Done." when you execute the command.



Thanks (Hard to tell if that's sarcasm or not...)

It was sarcasm:

PHP:
} else if (splitted[0].equals("!pause") || splitted[0].equals("!unpause")) {
	if(splitted[0].equals("!pause"))
	    for (MapleCharacter chr : c.getPlayer().getMap().getCharacters())
		    if (!chr.isGM()) {
				MobSkill ms = new MobSkill(123, 1);
				ms.setDuration((long) Double.POSITIVE_INFINITY);
				chr.giveDebuff(MapleDisease.STUN, ms);
			}
	else
	    for (MapleCharacter chr : c.getPlayer().getMap().getCharacters())
            if (!chr.isGM())
                chr.removeDisease(MapleDisease.STUN);
    mc.dropMessage("Done.");
}

BTW, your script is wrong.

If you put "unpause" you will get, error bla bla bla...
 
return; is just used to end the function. The final line "Done." will spit out if you remove the return, that's all. You can't return true/false in a void. >_>

LMAO, Return is not used to show that it's the end of the function; You don't even need return in a void function, what book are you using or are you just talking out of your ass?
 
LMAO, Return is not used to show that it's the end of the function; You don't even need return in a void function, what book are you using or are you just talking out of your ass?

I'm talking out of my ass of course, I was a little tired since it was almost midnight and I didn't help to double check. The likely hood of that error is slim to none, so it doesn't really matter.

Here let me revise it (X-tasis's clean-up is good too).

And yes, that's why my IDE allowed it... >_>
 
Back