Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- int gCount[2048+1] = 0;
- public OnPluginStart()
- {
- HookEvent("player_use", Event_PlayerUse);
- }
- public OnMapStart()
- {
- for(int i = 1; i <= 2048; ++i)
- {
- gCount[i] = 0
- }
- }
- public Event_PlayerUse(Handle:event, const String:name[], bool:dontBroadcast)
- {
- int i = GetClientOfUserId(GetEventInt(event, "userid"));
- int entity_id = GetEventInt(event, "targetid");
- decl String:ent_name[64];
- if (IsValidEdict(entity_id))
- {
- GetEdictClassname(entity_id, ent_name, sizeof(ent_name)); //get the entities name
- if (StrEqual(ent_name, "weapon_ammo_spawn", false))
- {
- if(gCount[entity_id] >= 4)
- {
- gCount[entity_id] = 0;
- AcceptEntityInput(entity_id, "kill");
- PrintHintTextToAll("%N использовал последние патроны.", i);
- }
- gCount[entity_id]++;
- }
- }
- return;
- }
- stock bool:IsClientInGameHuman(client)
- {
- if (client > 0) return IsClientInGame(client) && !IsFakeClient(client);
- else return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment