20.03.2010, 11:18
Ok so I have this code that runs 2 seconds after a player dies:
I have 2 issues with that.
1) If the player is the only one on his team, he spectates his body flying upwards at an insanely high speed for some reason.
2) The player can just press the spacebar to stop spectating and respawn, which I don't want.
How can I fix this?
pawn Код:
public SetPlayerSpectating(playerid)
{
TogglePlayerSpectating(playerid,1);
new randomplayer = random(MAX_PLAYERS);
if(IsPlayerConnected(randomplayer))
{
if(IsPlayerDead[randomplayer] == 0)
{
if(Team[randomplayer] == Team[playerid])
{
PlayerSpectatePlayer(playerid,randomplayer,1);
new name[MAX_PLAYER_NAME];
GetPlayerName(randomplayer,name,sizeof(name));
new string[64];
format(string,sizeof(string),"Spectating: %s",name);
GameTextForPlayer(playerid,string,5000,5);
return 1;
}
else SetPlayerSpectating(playerid);
}
else SetPlayerSpectating(playerid);
}
else SetPlayerSpectating(playerid);
return 1;
}
1) If the player is the only one on his team, he spectates his body flying upwards at an insanely high speed for some reason.
2) The player can just press the spacebar to stop spectating and respawn, which I don't want.
How can I fix this?