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



Spectating Players - Kyle - 19.11.2010

I have a spectate script which I made, Where it saves the admins co ordinates before it spectates them.

After the /specoff I want it to put them into the co ordinates placed.

But spec off seems to call onplayerspawn.

Anyone Help?


Re: Spectating Players - PowerPC603 - 19.11.2010

You could add a boolean which you check whenever you use /specoff.

In your OnPlayerSpawn, check if the bool is set.
If it's set, only reset it.
If it's not set, run the other code.

This won't block OnPlayerSpawn to happen after /specoff, but it blocks the OnPlayerSpawn-code to run.

Код:
new bool:SpecOffCheck;

...

// in your OnPlayerCommandText (under the command /specoff)
SpecOffCheck = true;

...

// in your OnPlayerSpawn:
public OnPlayerSpawn(playerid)
{
if (SpecOffCheck == true)
{
SpecOffCheck = false;
}
else
{
//Your other OnPlayerSpawn code here
}
}