SHARE
TWEET

Untitled

a guest Aug 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <cstrike>
  4.  
  5. #pragma newdecls required
  6.  
  7. public Plugin myinfo =
  8. {
  9.     name = "BOT kicker",
  10.     author = "",
  11.     description = "",
  12.     version = "0.0.1a",
  13.     url = ""
  14. };
  15.  
  16. public void OnPluginStart()
  17. {
  18.     HookEvent("player_team", Event_PlayerTeam, EventHookMode_Pre);
  19. }
  20.  
  21. public Action Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast)
  22. {
  23.     event.SetBool("silent", true);
  24.  
  25.     if( RealPlayersCount() > 1 )
  26.     {
  27.         return Plugin_Changed;
  28.     }
  29.  
  30.     int team = event.GetInt("team");
  31.  
  32.     if( team == CS_TEAM_T && team == CS_TEAM_CT )
  33.     {
  34.         return Plugin_Changed;
  35.     }
  36.  
  37.     int client = GetClientOfUserId (event.GetInt("userid"));
  38.  
  39.     for( int i = 1; i <= MaxClients; i++ )
  40.     {
  41.         if( i == client )
  42.         {
  43.             continue;
  44.         }
  45.  
  46.         ForcePlayerSuicide(i);
  47.     }
  48.    
  49.     return Plugin_Changed;
  50. }
  51.  
  52. int RealPlayersCount()
  53. {
  54.     int count = 0, team = CS_TEAM_NONE;
  55.  
  56.     for( int i = 1; i <= MaxClients; i++ )
  57.     {
  58.         if( IsFakeClient(i) )
  59.         {
  60.             continue;
  61.         }
  62.  
  63.         team = GetClientTeam(i);
  64.  
  65.         if( team == CS_TEAM_T || team == CS_TEAM_CT )
  66.         {
  67.             count++;
  68.         }
  69.     }
  70.  
  71.     return count;
  72. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top