FlacoBey

Untitled

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