SA-MP Forums Archive
Setting a timer to 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Setting a timer to TogglePlayerControllable? (/showthread.php?tid=115285)



Setting a timer to TogglePlayerControllable? - kmzr - 23.12.2009

Hello all, was wondering if you could help me out with adding a timer to TogglePlayerControllable?
I want my player to be frozen for say 5 seconds in OnPlayerSpawn
I tried coding it by myself but had abit of trouble. I'm still getting to grips with pawn.
Any help is appreciated.



Re: Setting a timer to TogglePlayerControllable? - Striker_Moe - 23.12.2009

Well,

Код:
forward spawn(playerid);
OnPlayerSpawn:

Код:
SetTimerEx("spawn",5000,false,"i",playerid);
Then:

pawn Код:
public spawn(playerid)
{
 //Toggle player controllable here to 1
}



Re: Setting a timer to TogglePlayerControllable? - [03]Garsino - 23.12.2009


pawn Код:
TogglePlayerControllable(playerid, 0); // Inside OnPlayerSpawn
    SetTimerEx("PlayerUnfrozen", 5000, false, "i", playerid); // Inside OnPlayerSpawn
pawn Код:
forward PlayerUnfrozen(playerid);
public PlayerUnfrozen(playerid)
{
  TogglePlayerControllable(playerid, 1);
  return 1;
}



Re: Setting a timer to TogglePlayerControllable? - kmzr - 23.12.2009

Quote:
Originally Posted by Mo3
Well,

Код:
forward spawn(playerid);
OnPlayerSpawn:

Код:
SetTimerEx("spawn",5000,false,"i",playerid);
Then:

pawn Код:
public spawn(playerid)
{
 //Toggle player controllable here to 1
}
This doesn't seem to work, i spawn, i'm not frozen, then 5seconds in, it freezes me and i stay frozen o_o


Re: Setting a timer to TogglePlayerControllable? - [03]Garsino - 23.12.2009

Quote:
Originally Posted by kmzr
Quote:
Originally Posted by Mo3
Well,

Код:
forward spawn(playerid);
OnPlayerSpawn:

Код:
SetTimerEx("spawn",5000,false,"i",playerid);
Then:

pawn Код:
public spawn(playerid)
{
 //Toggle player controllable here to 1
}
This doesn't seem to work, i spawn, i'm not frozen, then 5seconds in, it freezes me and i stay frozen o_o
Try my code.


Re: Setting a timer to TogglePlayerControllable? - kmzr - 23.12.2009

Tried it, it had no effect


Re: Setting a timer to TogglePlayerControllable? - kmzr - 23.12.2009

Anyone?


Re: Setting a timer to TogglePlayerControllable? - member - 23.12.2009

Quote:
Originally Posted by [03
Garsino ]

pawn Код:
TogglePlayerControllable(playerid, 0); // Inside OnPlayerSpawn
    SetTimerEx("PlayerUnfrozen", 5000, false, "i", playerid); // Inside OnPlayerSpawn
pawn Код:
forward PlayerUnfrozen(playerid);
public PlayerUnfrozen(playerid)
{
  TogglePlayerControllable(playerid, 1);
  return 1;
}
That should be correct.


Re: Setting a timer to TogglePlayerControllable? - Jeffry - 23.12.2009

Okay, try this:

Put this under "
Код:
public OnPlayerSpawn
"
pawn Код:
SetTimerEx("spawn",5000,0,"d",playerid);
     TogglePlayerControllable(playerid,false);
and this at the bottom of your stript.

pawn Код:
forward spawn(playerid);
public spawn(playerid)
{
    TogglePlayerControllable(playerid,true);
}
This should work. And i think the code on the post before too. He just was faster...



-Jeffry


Re: Setting a timer to TogglePlayerControllable? - [03]Garsino - 25.12.2009

Quote:
Originally Posted by kmzr
Tried it, it had no effect
Did you put it where I said? ..