FlacoBey

Untitled

Dec 26th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 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.                 char buffer[512];
  43.                 Format(buffer, sizeof(buffer), "%N", i);
  44.                 PrintHintTextToAll("%N использовал последние патроны", i)
  45.                 gCount[i] = 0;
  46.                 AcceptEntityInput(entity_id, "kill")
  47.             }
  48.            
  49.         }
  50.     }
  51.     return;
  52. }
  53.  
  54. stock bool:IsClientInGameHuman(client)
  55. {
  56.     if (client > 0) return IsClientInGame(client) && !IsFakeClient(client);
  57.     else return false;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment