Advertisement
FlacoBey

Untitled

Feb 2nd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.85 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. static killcount[MAXPLAYERS+1];
  5.  
  6. static Handle:hCount = INVALID_HANDLE;
  7.  
  8. static bool:NoDoubleEventFire;
  9.  
  10. public OnPluginStart()
  11. {
  12.     HookEvent("infected_death", hGiveAwp);
  13.     HookEvent("round_start", RoundStartEvent);
  14.    
  15.     hCount = CreateConVar("l4d2_specialammo_killcountsetting", "5", "How much Infected a Player has to shoot to win special ammo. (default 120) ", FCVAR_NONE);
  16.    
  17.     AutoExecConfig(true, "l4d2_specialammo"); // an autoexec! ooooh shiny
  18. }
  19.  
  20. public Action:RoundStartEvent(Handle:event, const String:name[], bool:dontBroadcast)
  21. {
  22.     for (new i = 1; i <= MaxClients; i++)
  23.     {
  24.         killcount[i] = 0;
  25.     }
  26. }
  27.  
  28. public OnClientDisconnect(client)
  29. {
  30.     killcount[client] = 0;
  31. }
  32.  
  33. public OnClientPostAdminCheck(client)
  34. {
  35.     killcount[client] = 0;
  36. }
  37.  
  38. public Action:hGiveAwp(Handle:event, String:ename[], bool:dontBroadcast)
  39. {
  40.     if (NoDoubleEventFire) return Plugin_Continue;
  41.    
  42.     new client = GetClientOfUserId(GetEventInt(event, "attacker"));
  43.     new bool:minigun = GetEventBool(event, "minigun");
  44.     new bool:blast = GetEventBool(event, "blast");
  45.    
  46.     if (client)
  47.     {
  48.         if (!minigun && !blast)
  49.             killcount[client] += 1;
  50.         else
  51.         {
  52.             NoDoubleEventFire = false;
  53.             return Plugin_Continue;
  54.         }
  55.        
  56.         if ((killcount[client] > GetConVarInt(hCount)))
  57.         {
  58.             if(IsClientInGame(client) && GetClientTeam(client) == 2)
  59.             {
  60.                 CheatCommand(client, "give", "sniper_awp");
  61.             }
  62.         }
  63.     }
  64.    
  65.     NoDoubleEventFire = false;
  66.     return Plugin_Continue;
  67. }
  68.  
  69. stock CheatCommand(client, String:command[], String:arguments[]="")
  70. {
  71.     new userflags = GetUserFlagBits(client);
  72.     SetUserFlagBits(client, ADMFLAG_ROOT);
  73.     new flags = GetCommandFlags(command);
  74.     SetCommandFlags(command, flags & ~FCVAR_CHEAT);
  75.     FakeClientCommand(client, "%s %s", command, arguments);
  76.     SetCommandFlags(command, flags);
  77.     SetUserFlagBits(client, userflags);
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement