SA-MP Forums Archive
Can someone tell me how to freeze player at spawn ? - 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: Can someone tell me how to freeze player at spawn ? (/showthread.php?tid=164094)



Can someone tell me how to freeze player at spawn ? - Dark734 - 30.07.2010

All is in the title, thank you.


Re: Can someone tell me how to freeze player at spawn ? - PotH3Ad - 30.07.2010

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



Re: Can someone tell me how to freeze player at spawn ? - Whizion - 30.07.2010

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

Use TogglePlayerControllable(playerid, 0);


Re: Can someone tell me how to freeze player at spawn ? - Dark734 - 30.07.2010

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

Thanks,
Dark734


Re: Can someone tell me how to freeze player at spawn ? - Whizion - 30.07.2010

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.


Re: Can someone tell me how to freeze player at spawn ? - Dark734 - 30.07.2010

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


Re: Can someone tell me how to freeze player at spawn ? - Kar - 30.07.2010

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

try that


Re: Can someone tell me how to freeze player at spawn ? - John_F - 30.07.2010

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)


Re: Can someone tell me how to freeze player at spawn ? - willsuckformoney - 30.07.2010

thats to much just

TogglePlayerControllable(playerid, 0);
TogglePlayerControllable(playerid, 1);


Re: Can someone tell me how to freeze player at spawn ? - John_F - 30.07.2010

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.