Can someone tell me how to freeze player at spawn ?
#1

All is in the title, thank you.
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
Reply
#3

Quote:
Originally Posted by PotH3Ad
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    TogglePlayerControllable(playerid, 1);
    return 1;
}
That will unfreeze them...

Use TogglePlayerControllable(playerid, 0);
Reply
#4

But how i do if i want to freeze them for 3 seconds ?

Thanks,
Dark734
Reply
#5

Use a timer.

pawn Код:
forward UnfreezePlayer(playerid); // top of script
pawn Код:
public UnfreezePlayer(playerid) // Anywhere in the script as long it isn't in a callback.
{
     if(IsPlayerConnected(playerid))
     {
          TogglePlayerControllable(playerid,1);
     }
     return 1;
}
pawn Код:
public OnPlayerSpawn(playerid) // Your OnPlayerSpawn Code
{
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("UnfreezePlayer", 3000, false, "d", playerid);
    return 1;
}
And that's that.
Reply
#6

Not working,
What do you mean by 'as long it's not a call back' ?
Reply
#7

SetTimerEx("UnfreezePlayer", 3000, true, "i", playerid);

try that
Reply
#8

Quote:
Originally Posted by Dark734
Посмотреть сообщение
Not working,
What do you mean by 'as long it's not a call back' ?
Just put it at the bottom of the script...
He means, don't put it INSIDE any of the call backs (OnplayerSpawn, OnPlayerDeath, OnPlayerEnterVehicle etc)
Reply
#9

thats to much just

TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);
Reply
#10

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
thats to much just

TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);
I think he's using this to prevent people from spawnkilling or something, in which case, he needs a timer to make sure a player doesn't do anything for a bit on spawn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)