Teleports wrong player on timer? +rep - 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: Teleports wrong player on timer? +rep (
/showthread.php?tid=500648)
Teleports wrong player on timer? +rep -
KingyKings - 14.03.2014
Okay so i want to make switching cameras like it shows one place then cuts to another.
Here is the basic script.
Top of the script
Код:
forward cam1(playerid);
Part of OnPlayerKeyStateChange. This is where the timer is activated.
Код:
if( ( newkeys & KEY_YES ) && !( oldkeys & KEY_YES ) )
{
SetTimer("cam1", 2000, false);
TogglePlayerControllable(playerid, 1);
PlayerPlaySound(playerid, 5201, 0,0,0);
return 1;
}
And finally the timer.
Код:
public cam1(playerid)
{
SetPlayerPos(playerid, 5542.68701, 792.31042, 10.47427);
SetPlayerCameraLookAt(playerid, 5545.2988,793.5884,9.8471);
SetPlayerCameraPos(playerid, 5565.4932,793.5170,8.4675);
TogglePlayerControllable(playerid, 0);
return 1;
}
Now it seems everything is working, it compiles completely fine. But it teleports the wrong player on the timer. I want it to set the camera to the location 2 seconds after the player presses Y.
Can anybody tell me where i am going wrong? +rep
Re: Teleports wrong player on timer? +rep -
Matess - 14.03.2014
pawn Код:
SetTimerEx("cam1", 2000, false, "i",playerid);
Re: Teleports wrong player on timer? +rep -
KingyKings - 14.03.2014
Haha! Thankyou !