TogglePlayerControllable - 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)
+--- Thread: TogglePlayerControllable (
/showthread.php?tid=596855)
TogglePlayerControllable -
Sheperc - 23.12.2015
Ok guys did TogglePlayerControllable refused to work for me? Under OnPlayerSpawn, I placed TogglePlayerControllable(playerid, 0); and nothing happens. On second thougt, I made a timer that would make the person controllable after some seconds (TogglePlayerControllable(playerid, 1)

, and it works. I mean I can see that when I spawn after them seconds I look like I was synchronized or something. Why freezing won't work. Again, it's placed under OnPlayerSpawn.
Re: TogglePlayerControllable -
TwinkiDaBoss - 23.12.2015
Add this and post the results of what happends
PHP код:
new
FrozenTest[MAX_PLAYERS];
forward UnfreezePlayer(playerid);
public OnPlayerSpawn(playerid) {
TogglePlayerControllable(playerid,0);
FrozenTest[playerid] = 0;
printf("FrozenTest: %i",FrozenTest[playerid]);
SetTimerEx("UnfreezePlayer",5000,false,"i",playerid);
return true;
}
public UnfreezePlayer(playerid) {
TogglePlayerControllable(playerid,1);
FrozenTest[playerid] = 1;
printf("FrozenTest: %i",FrozenTest[playerid]);
return true;
}