0 Members and 1 Guest are viewing this topic.
var AlivePlayers,AfterJoinTeam,AfterKill,Old: byte;procedure AppOnIdle(Ticks: integer);var i: byte;begin if AfterJoinTeam <> 0 then begin if GetPlayerStat(AfterJoinTeam,'Alive') = true then AlivePlayers := AlivePlayers + 1; AfterJoinTeam := 0; end; if AfterKill <> 0 then begin for i := 1 to NumPlayers do if Target[i] = AfterKill then begin Command('/setteam ' + InttoStr(i));Command('/say ' + InttoStr(i) + ' respawned due to his killer, ' + InttoStr(AfterKill) + ', dieing.'); end; AfterKill := 0; end; if Old <> AlivePlayers then begin Command('/say AlivePlayers = ' + InttoStr(AlivePlayers) + ' / ' + InttoStr(NumPlayers)); Old := AlivePlayers; end;end;procedure OnJoinTeam(ID, Team: byte);begin AfterJoinTeam := ID;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);begin if GetPlayerStat(ID,'Alive') = true then AlivePlayers := AlivePlayers - 1;end;procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);var i: byte;begin AlivePlayers := AlivePlayers - 1; AfterKill := Victim;end;procedure OnPlayerRespawn(ID: byte);begin AlivePlayers := AlivePlayers + 1;end;
GetPlayerStat has an alive option...
function AlivePlayers: byte;var i: byte;begin result:=0; for i:=1 to 32 do If (GetPlayerStat(i,'Alive')=true) and (GetPlayerStat(i,'Active')=true) then result:=result + 1;end;