10.02.2012, 06:46
Hello,I made a random spectating system which those players who've been killed can spectate any players who aren't killed yet.
But there's one problem, when I've been killed by Player 1, I've to click multiple times(KEY_FIRE) to spectate other players who were still alive. Well I know it's because of this random() thingy but how can I make a system like I just have to click only once, and then I'll be able to spectate another player who're still alive, and so on..
This's my script:
Anyone have any idea on how to do that?
Big thanks.
But there's one problem, when I've been killed by Player 1, I've to click multiple times(KEY_FIRE) to spectate other players who were still alive. Well I know it's because of this random() thingy but how can I make a system like I just have to click only once, and then I'll be able to spectate another player who're still alive, and so on..
This's my script:
pawn Код:
if (PRESSED(KEY_FIRE))
{
if(PlayerInfo[playerid][Latezor] == 1 && PlayerInfo[playerid][Killedzor] == 1)
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i)) PCount++;
}
new Spectatethisguy = random(PCount);
if(PlayerInfo[Spectatethisguy][Latezor] == 0 && PlayerInfo[Spectatethisguy][Killedzor] == 0)
{
PlayerSpectatePlayer(playerid, Spectatethisguy);
}
}
}
Big thanks.