Hello! I want to make an auto spectating system
#1

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));
		 }
	    }
	}
    }
}
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)