Quote:
Originally Posted by LenHard
PHP Code:
#include <sourcemod>
#pragma semicolon 1 #pragma newdecls required
public void OnPluginStart() { HookEvent("player_team", Event_PlayerTeam, EventHookMode_Post); }
public void Event_PlayerTeam(Event hEvent, char[] sEventName, bool bDontBroadcast) { int iTeam1 = 0, iTeam2 = 0; for (int i = 0; i <= MaxClients; ++i) { if (IsClientInGame(i)) { switch (GetClientTeam(i)) { case 2: ++iTeam1; // Terrorist or Red Team case 3: ++iTeam2; // Counter-Terrorist or Blue Team } } } if (iTeam1 == 5 && iTeam2 == 5) { // Knife Code... } }
I'm assuming this is what you want? It could be done multiple ways, this is one of them.
|
Rather than using all that code above to get the client count in each team, why not just do the following with
GetTeamClientCount()?
PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("player_team", Event_PlayerTeam, EventHookMode_Post);
}
public void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast)
{
int iTeam1 = 2;
int iTeam2 = 3;
if (GetTeamClientCount(iTeam1) >= 10 && GetTeamClientCount(iTeam2) >= 10)
{
// Lemme shank ya! :O
}
}
Also, I think this should be moved to the Scripting board.
__________________