Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- // #include
- int gCount[MAXPLAYERS + 1] = 0;
- int g_mapFinale;
- public OnPluginStart()
- {
- HookEvent("player_use", Event_PlayerUse);
- HookEvent("round_start", Event_RoundStart);
- }
- public OnMapStart()
- {
- g_mapFinale = FindEntityByClassname(-1, "trigger_finale") != -1;
- if (g_mapFinale)
- UnhookEvent("player_use", Event_PlayerUse);
- else
- HookEvent("player_use", Event_PlayerUse);
- }
- public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
- {
- OnMapStart();
- }
- 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[i] <= 2)
- {
- gCount[i]++;
- }
- else
- {
- char buffer[512];
- Format(buffer, sizeof(buffer), "%N", i);
- PrintHintTextToAll("%N использовал последнии патроны", i)
- gCount[i] = 0;
- AcceptEntityInput(entity_id, "kill")
- }
- }
- }
- 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