SA-MP Forums Archive
Spectating Issue - 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: Spectating Issue (/showthread.php?tid=224783)



Spectating Issue - deather - 12.02.2011

I made the player to spectate nothing for 5 secondsTogglePlayerSpectating(playerid, 1);
After 5 seconds I tried TogglePlayerSpectating(playerid, 0); But the player is still in spectate mode. Is it a bug?

Here's the code:
Код:
TogglePlayerSpectating(playerid, 1);
SetTimerEx("PlayerOff", 5000, 0, "d", playerid);
After 5 seconds....
Код:
public PlayerOff(playerid)
{
SetPlayerPos(playerid, 1481.2018, 1778.8016, 14.7248);
SetPlayerFacingAngle(playerid, 264.7461);
SetPlayerCameraLookAt(playerid, 1481.2018, 1778.8016, 14.7248);
SetPlayerCameraPos(playerid, 1481.2018 + (10 * floatsin(-272.846618, degrees)), 1778.8016 + (10 * floatcos(-272.846618, degrees)), 14.7248);
TogglePlayerSpectating(playerid, 0);
return 1;
}



Re: Spectating Issue - Mean - 12.02.2011

I don't understand, why are you setting the pos, before you put spectating to 0, spectating to 0 will spawn the player. Also you should use PlayerSpectatePlayer( playerid, targetid )
So:
pawn Код:
TogglePlayerSpectating( playerid, 1 ); PlayerSpectatePlayer( playerid, targetid );
And just:
pawn Код:
public PlayerOff( playerid ) return TogglePlayerSpectating( playerid, 0 );