Stuck Command
#1

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
Reply
#2

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.
Reply
#3

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?
Reply
#4

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

pawn Код:
return 1;
}
Reply
#5

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;

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)