Hello! I want to make an auto spectating system - 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: Hello! I want to make an auto spectating system (
/showthread.php?tid=653806)
Hello! I want to make an auto spectating system -
DeathCore - 13.05.2018
Hi, I'm scripting a sumo server and I wanted to know How I script an auto spectating active players system, it will auto spectate when you fell/die (get eliminated from the game).
What functions I need to use to make it to work?
I tried this one but it seems not working :\
Код:
foreach(Player,target)
{
if(target != playerid)
{
if(IsPlayerConnected(target))
{
if(playerActive[random(target)])
{
if(!Alerted4[playerid])
{
Alerted4[playerid]=1;
PlayerSpectateVehicle(playerid, GetPlayerVehicleID(target));
}
}
}
}
}
Re: Hello! I want to make an auto spectating system -
RoboN1X - 13.05.2018
Use
TogglePlayerSpectating on playerid first, then break after:
Usually i check if the player is in the vehicle first, otherwise the player would spectate wrongly.
Код:
new vehicleid = GetPlayerVehicleID(target);
if (vehicleid)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, vehicleid);
break;
}
If the current target is not in vehicle, it will look for next player.