21.01.2012, 08:08
If I understand your problem right, try these things:
Fixed your bug of spectating invalid player id, and I guess the falling thing should work. If it doesn't, after closing bracket of if(killerid != INVALID_PLAYER_ID) add else { code of count-- and textdrawstring.
EDIT: Also, if you want to spectate random player when player died himself, use a loop and then spectateplayer
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new tmp[256];
new tmp2[256];
if(gTeam[playerid] == TEAM_RED) { RedCount--;
format(tmp, sizeof(tmp), "~r~%d", RedCount);
TextDrawSetString(Text:Textdraw13, tmp);
}
if(gTeam[playerid] == TEAM_GREEN) { GreenCount--;
format(tmp2, sizeof(tmp2), "~g~%d", GreenCount);
TextDrawSetString(Text:Textdraw14, tmp2);
}
if(killerid != INVALID_PLAYER_ID) {
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
PlayerInfo[playerid][Latezor] = 1;
}
return 1;
}
EDIT: Also, if you want to spectate random player when player died himself, use a loop and then spectateplayer