FlacoBey

Untitled

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