Since game_start and game_end doesn't fire off in CS:S. I had to make alternative method to catch when game start and game_ended. So if wanted to know if there was a player on each team. To give bonuses only when for objectives only when there are players on each team.
Code:
#include <sourcemod>
#define TEAM_T 2
#define TEAM_CT 3
new CTcount;
new Tcount;
new bool:GameCommenced;
public OnPluginStart()
{
HookEvent("round_end", _RoundEnd);
HookEvent("player_team", _PlayerTeam);
}
public _RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
/* Game Commenced reason */
if(GetEventInt(event, "reason") == 16)
{
GameCommenced = true;
}
}
public _PlayerTeam(Handle:event, const String:name[], bool:dontBroadcast)
{
switch(GetEventInt(event, "oldteam"))
{
case TEAM_T:
{
Tcount--;
}
case TEAM_CT:
{
CTcount--;
}
}
/* Player disconnected and didn't join a new team */
if(!GetEventBool(event, "disconnect"))
{
switch(GetEventInt(event, "team"))
{
case TEAM_T:
{
Tcount++;
}
case TEAM_CT:
{
CTcount++;
}
}
}
/* If one of the counts goes to 0 that means game is not commenced any more */
if(!CTcount || !Tcount)
{
GameCommenced = false;
}
}
Now with this all you can use bool:GameCommenced.
__________________