diff --git a/plugins/l4d2_guesswho.smx b/plugins/l4d2_guesswho.smx index 47744bc..36f4b77 100644 Binary files a/plugins/l4d2_guesswho.smx and b/plugins/l4d2_guesswho.smx differ diff --git a/plugins/l4d2_hideandseek.smx b/plugins/l4d2_hideandseek.smx index 060f964..37d714a 100644 Binary files a/plugins/l4d2_hideandseek.smx and b/plugins/l4d2_hideandseek.smx differ diff --git a/scripting/include/guesswho/gwgame.inc b/scripting/include/guesswho/gwgame.inc index 9c9ea07..cd6bdca 100644 --- a/scripting/include/guesswho/gwgame.inc +++ b/scripting/include/guesswho/gwgame.inc @@ -258,17 +258,28 @@ methodmap GuessWhoGame { } } - public bool IsPendingPlayers() { - for(int i = 1; i <= MaxClients; i++) { - if(IsClientConnected(i) && !IsClientInGame(i)) { - return true; + // Ignores seeker + property int AlivePlayers { + public get() { + int amount = 0; + for(int i = 1; i <= MaxClients; i++) { + if(i != currentSeeker && IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i) && !IsFakeClient(i)) { + amount++; + } } + return amount; } - return false; } - } +stock bool ArePlayersJoining() { + for(int i = 1; i <= MaxClients; i++) { + if(IsClientConnected(i) && !IsClientInGame(i)) { + return true; + } + } + return false; +} stock void GetHorizontalPositionFromClient(int client, float units, float finalPosition[3]) { float pos[3], ang[3]; @@ -353,17 +364,6 @@ bool Filter_IgnoreAll(int entity, int mask) { return false; } -// Ignores seeker -int GetPlayersLeftAlive() { - int amount = 0; - for(int i = 1; i <= MaxClients; i++) { - if(i != currentSeeker && IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i) && !IsFakeClient(i)) { - amount++; - } - } - return amount; -} - void SetPlayerBlind(int target, int amount) { int targets[1]; diff --git a/scripting/l4d2_guesswho.sp b/scripting/l4d2_guesswho.sp index a2485bf..89d8881 100644 --- a/scripting/l4d2_guesswho.sp +++ b/scripting/l4d2_guesswho.sp @@ -240,7 +240,7 @@ void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) { } } - if(GetPlayersLeftAlive() == 0) { + if(Game.AlivePlayers == 0) { if(Game.State == State_Active) { PrintToChatAll("Everyone has died. %N wins!", currentSeeker); Game.End(State_SeekerWon); @@ -342,7 +342,7 @@ public void OnClientDisconnect(int client) { Game.End(State_HidersWin); } else if(!IsFakeClient(client) && Game.State == State_Active) { PrintToChatAll("A hider has left (%N)", client); - if(GetPlayersLeftAlive() == 0 && Game.State == State_Active) { + if(Game.AlivePlayers == 0 && Game.State == State_Active) { PrintToChatAll("Game Over. %N wins!", currentSeeker); Game.End(State_SeekerWon); }