SA-MP Forums Archive
Stuck Command - 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: Stuck Command (/showthread.php?tid=173037)



Stuck Command - Hal - 01.09.2010

Im making a /stuck command that sets the TogglePlayerControllable to true (1) . But, i do not want it to be used against the /freeze command. here is my code, but the errors below show on compile.

Код:
C:\...\gamemodes\TimesRP.pwn(12715) : warning 211: possibly unintended assignment
C:\...\gamemodes\TimesRP.pwn(12715) : error 036: empty statement
C:\...\gamemodes\TimesRP.pwn(12718) : error 029: invalid expression, assumed zero
C:\...\gamemodes\TimesRP.pwn(12719) : warning 217: loose indentation
C:\...\gamemodes\TimesRP.pwn(12723) : warning 217: loose indentation
C:\...\gamemodes\TimesRP.pwn(12725) : warning 209: function "cmd_stuck" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
pawn Код:
command(stuck,playerid, params[]) // Hal Olpae  LINE 12710
    #pragma unused params
{
    if(IsPlayerConnected(playerid))
    {
        {                                                             // LINE 12715
            if ( Player[playerid][Frozen] = 1);
            return 1;
            }
        else
            {                                                           // LINE 12720
                TogglePlayerControllable(playerid, true);
                SendClientMessage( playerid, RED, "You Are Unstuck" );
            }
        // return 1; I dont think i need this?
    }                                                                         //LINE12725
}                                                                               //LINE 12726
I want it so if [Frozen] = 1 it doesnt execute the command. But, if not let it continue.

Should i add a

pawn Код:
if ( Player[playerid][Frozen] = 0); // a second time to make sure they are not frozen?
or would not having it, work the same?

Thanks Lots


Re: Stuck Command - [HiC]TheKiller - 01.09.2010

Line 12715 should not have a bracket there. Line 12716 should be
pawn Код:
if(Player[playerid][Frozen] == 1) return 1;
Line 12725 shouldn't have a bracket.


Re: Stuck Command - Hal - 01.09.2010

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
Line 12715 should not have a bracket there. Line 12716 should be
pawn Код:
if(Player[playerid][Frozen] == 1) return 1;
Line 12725 shouldn't have a bracket.
Thanks, but now i guess due to zcmd, i get this warning

Код:
warning 209: function "cmd_stuck" should return a value
am i missing a return somewhere?


Re: Stuck Command - [HiC]TheKiller - 01.09.2010

You need the return 1 near the end. The last 2 lines should be

pawn Код:
return 1;
}



Re: Stuck Command - Hal - 01.09.2010

The return was there, i just misplaced a bracket after it :P

here is the command thats all working now, if anyone needs it
pawn Код:
command(stuck,playerid, params[]) // Hal Olpae
    #pragma unused params
{
    if(IsPlayerConnected(playerid))
    {
                if(Player[playerid][Frozen] == 1) return 1;
                else
                {
                TogglePlayerControllable(playerid, true);
                SendClientMessage( playerid, RED, "You Are Unstuck" );
                }
    }
    return 1;

}