diff options
| author | navewindre <nw@moneybot.cc> | 2023-11-15 03:41:41 +0100 |
|---|---|---|
| committer | navewindre <nw@moneybot.cc> | 2023-11-15 03:41:41 +0100 |
| commit | 191d2772a056545b3aee70448385d703d57f07af (patch) | |
| tree | 5f7b6513a213a0aea3347f69017854c83c7a32d7 | |
| parent | 9fb9855a2c12da5d49a91baa0c87043361a0a345 (diff) | |
speedometer improvements
| -rw-r--r-- | sourcemod/scripting/sm_speedometer.sp | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/sourcemod/scripting/sm_speedometer.sp b/sourcemod/scripting/sm_speedometer.sp index d0269f1..625395b 100644 --- a/sourcemod/scripting/sm_speedometer.sp +++ b/sourcemod/scripting/sm_speedometer.sp @@ -72,6 +72,8 @@ public OnPluginStart() HookEvent("player_death", Event_OnPlayerDeath); HookEvent("round_start", Event_OnRoundStart); HookEvent("round_end", Event_OnRoundEnd); + HookEvent("bomb_planted", Event_OnBombPlanted); + HookEvent("bomb_defused", Event_OnBombDefused); g_hCookie = RegClientCookie("Cookie_Speedometer", "The client's setting for speedometer.", CookieAccess_Protected); SetCookieMenuItem(Menu_Status, 0, "Speedometer"); @@ -199,23 +201,52 @@ public Action:Event_OnRoundStart(Handle:event, const String:name[], bool:dontBro return Plugin_Continue; } +public Action:Event_OnBombPlanted(Handle:event, const String:name[], bool:dontBroadcast) { + for(new i = 1; i <= MaxClients; i++) + { + if( g_bShowDisplay[i] && g_iDisplayMethod == 1 && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) ) { + PrintHintText( i, "Bomb has been planted" ); + } + } +} + +public Action:Event_OnBombDefused(Handle:event, const String:name[], bool:dontBroadcast) { + for(new i = 1; i <= MaxClients; i++) + { + if( g_bShowDisplay[i] && g_iDisplayMethod == 1 && IsClientInGame(i) && IsPlayerAlive(i) && !IsFakeClient(i) ) { + PrintHintText( i, "Bomb has been defused" ); + } + } +} + public Action:Event_OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast) { if(g_bEnabled) { g_bEnding = true; + new reason = GetEventInt(event, "reason"); + new winner = GetEventInt(event, "winner"); - if(g_bUseTimer) - { - for(new i = 1; i <= MaxClients; i++) - { - if(IsClientInGame(i)) - { - if(g_hTimer_Display[i] != INVALID_HANDLE && CloseHandle(g_hTimer_Display[i])) - g_hTimer_Display[i] = INVALID_HANDLE; - } - } - } + for(new i = 1; i <= MaxClients; i++) + { + if(IsClientInGame(i)) + { + if(g_bUseTimer) + { + if(g_hTimer_Display[i] != INVALID_HANDLE && CloseHandle(g_hTimer_Display[i])) + g_hTimer_Display[i] = INVALID_HANDLE; + } + + if( g_bShowDisplay[i] && g_iDisplayMethod == 1 && IsPlayerAlive(i) && !IsFakeClient(i) ) { + if( winner == 1 ) + PrintHintText( i, "Round Draw" ); + else if( winner == 2 ) + PrintHintText( i, "Terrorists Win" ); + else if( winner == 3 ) + PrintHintText( i, "Counter-Terrorists Win" ); + } + } + } if(g_bShowFastest) { @@ -228,7 +259,6 @@ public Action:Event_OnRoundEnd(Handle:event, const String:name[], bool:dontBroad PrintToChatAll("%t%t", "Prefix_Chat", "Phrase_Highest_Velocity", sName, g_fFastestVelocity); } } - return Plugin_Continue; } @@ -526,7 +556,7 @@ public Action_OnSettingsChange(Handle:cvar, const String:oldvalue[], const Strin if(g_hTimer_Display[i] != INVALID_HANDLE && CloseHandle(g_hTimer_Display[i])) g_hTimer_Display[i] = INVALID_HANDLE; - g_bAlive[i] = IsPlayerAlive(i) ? true : false; + g_bAlive[i] = (IsClientInGame(i) && IsPlayerAlive(i)) ? true : false; if(!g_bEnding && g_bUseTimer && IsClientInGame(i)) { if(g_fTimerRate && !IsFakeClient(i)) |
