SA-MP Forums Archive
:D - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: :D (/showthread.php?tid=208829)



:D - Libra_PL - 09.01.2011

Hello, I just need help with one command:

Код:
if(strcmp(cmd, "/jump", true) == 0) {
	    if(jump[playerid] != 0) return jump[playerid] = 1, SendClientMessage(playerid, yellow, "High Jump has been turned on!");
	    else
	    if(jump[playerid] != 1) return jump[playerid] = 0, SendClientMessage(playerid, yellow, "High Jump has been turned off!");
    return 1;
	}
All the time when I type /jump, it says it have been turned off. Anyone can help me with that? ;P


Re: :D - GiS - 09.01.2011

Where did you define jump?


Re: :D - Libra_PL - 09.01.2011

At the top of script,

Код:
new jump[MAX_PLAYER_NAME];



Re: :D - __ - 09.01.2011

Try this:

pawn Код:
if(strcmp(cmd, "/jump", true) == 0) {
        switch(jump[playerid]) {
            case 0: {
                SendClientMessage(playerid, yellow, "High Jump has been turned on!");
                jump[playerid] = 1;
            }
            case 1: {
                SendClientMessage(playerid, yellow, "High Jump has been turned off!");
                jump[playerid] = 0;
            }
        }
        return 1;
    }