FlacoBey

Untitled

Feb 27th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. int gCount[2048+1] = 0;
  5.  
  6. public OnPluginStart()
  7. {
  8.     HookEvent("player_use", Event_PlayerUse);
  9. }
  10.  
  11. public OnMapStart()
  12. {
  13.     for(int i = 1; i <= 2048; ++i)
  14.     {
  15.         gCount[i] = 0
  16.     }
  17. }
  18.  
  19. public Event_PlayerUse(Handle:event, const String:name[], bool:dontBroadcast)
  20. {
  21.     int i = GetClientOfUserId(GetEventInt(event, "userid"));
  22.    
  23.     int entity_id = GetEventInt(event, "targetid");
  24.    
  25.     decl String:ent_name[64];
  26.    
  27.     if (IsValidEdict(entity_id))
  28.     {
  29.         GetEdictClassname(entity_id, ent_name, sizeof(ent_name)); //get the entities name
  30.         if (StrEqual(ent_name, "weapon_ammo_spawn", false))
  31.         {
  32.             if(gCount[entity_id] >= 4)
  33.             {
  34.                 gCount[entity_id] = 0;
  35.                 AcceptEntityInput(entity_id, "kill");
  36.                 PrintHintTextToAll("%N использовал последние патроны.", i);
  37.             }
  38.             gCount[entity_id]++;
  39.         }
  40.     }
  41.     return;
  42. }
  43.  
  44. stock bool:IsClientInGameHuman(client)
  45. {
  46.     if (client > 0) return IsClientInGame(client) && !IsFakeClient(client);
  47.     else return false;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment