Raised This Month: $14 Target: $400

[HowTo] Alternative method for game_start/game_end for CS:S

Post New Thread Reply   
Thread Tools Display Modes
Author Message
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 05-13-2007 , 20:19   [HowTo] Alternative method for game_start/game_end for CS:S
Reply With Quote #1

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.

#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.
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 00:31.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode