14.05.2010, 15:32
as the title says, I want that when a player dies, he spectates a random player.
That's what I have:
and
Well my problem is that I don't know how to implent the stock into the
thing
That's what I have:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[128];
format(string, sizeof(string), "This mission does not allow respawn, wait till the round is over!");
TextDrawSetString(Textdraw3, string);
TextDrawShowForAll(Text:Textdraw3);
SetTimer("KillTextdrawAll", 4000, false);
TogglePlayerSpectating(playerid, +1);
PlayerSpectatePlayer(playerid, killerid);
return 1;
}
Код:
stock GetRandomPlayer()
{
new yplayer[MAX_PLAYERS+1];
for (new y = 0; y != MAX_PLAYERS; y ++) {
if (IsPlayerConnected(y)) {
yplayer[0] ++;
yplayer[yplayer[0]] = y;
}
}
return yplayer[random(yplayer[0])+1];
}
Код:
TogglePlayerSpectating(playerid, +1); PlayerSpectatePlayer(playerid, killerid);

