[SOLVED] TogglePlayerControllable, Everyone!
#1

How would you make a command for freeze everyone. I have tried:

pawn Код:
if(strcmp(cmd, "/ssf", true) == 0)
    {
        if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
        {
        GameTextForAll("All Players Frozen",10000,3);
TogglePlayerControllable(-1,0);
        return 1;
        }
    }
Reply
#2

pawn Код:
if(strcmp(cmd, "/ssf", true) == 0)
    {
        if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
        {
            for(new i=0; i<MAX_PLAYERS; i++)
                TogglePlayerControllable(i,0);
            return GameTextForAll("All Players Frozen",10000,3);
        }
    }
Reply
#3

I have a small question that is a bit related to this problem - What will it do if I use -1 as playerid? Thanks for answer
Reply
#4

I have tried -1 but it doesnt seem to work
Reply
#5

Use that code posted by lrZ and then use i as the player id, A loop works by cycling through numbers, Each time it cycles though the nuber increases by 1
Reply
#6

Please mind indentation, even for such a small piece.
pawn Код:
if(strcmp(cmd, "/ssf", true) == 0)
{
  if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  {
    for(new i=0; i<MAX_PLAYERS; i++)
    TogglePlayerControllable(i,0);
    return GameTextForAll("All Players Frozen",10000,3);
  }
}
Reply
#7

Quote:
Originally Posted by AlecRae
I have tried -1 but it doesnt seem to work
nobody on your server is playerid -1 therefor nothing will happen because you are freezing a non existant player.
Reply
#8

Stop replying in this thread, Cant you read the title ffs
Reply
#9

Quote:
Originally Posted by Rk_
Please mind indentation, even for such a small piece.
pawn Код:
if(strcmp(cmd, "/ssf", true) == 0)
{
  if (AccountInfo[playerid][AdminLevel] >= 5 || IsPlayerAdmin(playerid))
  {
    for(new i=0; i<MAX_PLAYERS; i++)
    TogglePlayerControllable(i,0);
    return GameTextForAll("All Players Frozen",10000,3);
  }
}
I actually did...
The only thing I didn't care about, was the tab before all lines

for(new i=0; i<MAX_PLAYERS; i++)
TogglePlayerControllable(i,0);

is how I express/indent functions inside statements without braces
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)