Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- #include <sdktools>
- #include <sdktools_functions>
- new CTs
- new Ts
- new equal
- public Plugin myinfo =
- {
- name = "TeamRushAnnouncer",
- author = "ichi",
- description = "Announces Team to Rush",
- version = "1.0",
- url = "http://www.sourcemod.net/"
- }
- public void OnPluginStart()
- {
- HookEvent("round_start" , RoundStart , EventHookMode_PostNoCopy)
- HookEvent("player_death" , Event_PlayerDeath , EventHookMode_PostNoCopy )
- HookEvent("player_disconnect" , Event_PlayerDisconnect , EventHookMode_PostNoCopy )
- RegConsoleCmd("sm_rush", Command_SmRush, " Tell which Team should Rush")
- }
- public RoundStart(Handle:event, const String:name[], bool:dontBroadcast )
- {
- UpdatePlayerCounts()
- Ts = 0
- CTs = 0
- equal = 0
- CreateTimer(1.0 , UpdatePlayerCountsTimer)
- }
- public Event_PlayerDeath (Handle:event, const String:name[], bool:dontBroadcast)
- {
- UpdatePlayerCounts()
- }
- public Event_PlayerDisconnect (Handle:event, const String:name[], bool:dontBroadcast)
- {
- UpdatePlayerCounts()
- }
- public Action:RoundStartTimer(Handle:timer)
- {
- UpdatePlayerCounts()
- CreateTimer(0.1 , UpdatePlayerCountsTimer)
- }
- public Action:UpdatePlayerCountsTimer(Handle:timer)
- {
- CreateTimer(0.1 , UpdatePlayerCountsTimer)
- UpdatePlayerCounts()
- }
- public Action:Command_SmRush(client, args)
- {
- CreateTimer(0.1, Rush)
- }
- public Action:Rush(Handle:timer)
- {
- if (Ts != CTs)
- {
- if (Ts < CTs)
- {
- PrintToChatAll("Counter-Terrorist Rush")
- }
- else if (Ts > CTs)
- {
- {
- PrintToChatAll("Terrorist Rush")
- }
- }
- }
- else if (Ts == CTs)
- {
- if (equal == 1)
- {
- PrintToChatAll("Terrorist Rush")
- }
- else if (equal == 2)
- {
- PrintToChatAll("Counter-Terrorist Rush")
- }
- else if (euqal == 0)
- {
- PrintToChatAll("Equal Teams ")
- }
- }
- }
- UpdatePlayerCounts()
- {
- Ts = 0
- CTs = 0
- for(new i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && IsPlayerAlive(i))
- {
- if (GetClientTeam(i) == 2)
- {
- Ts++
- }
- else if (GetClientTeam(i) == 3)
- {
- CTs++
- }
- }
- }
- {
- if (Ts != CTs)
- {
- if (Ts < CTs)
- {
- equal = 2
- }
- else if (Ts > CTs)
- {
- equal = 1
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement