Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- static killcount[MAXPLAYERS+1];
- static Handle:hCount = INVALID_HANDLE;
- static bool:NoDoubleEventFire;
- public OnPluginStart()
- {
- HookEvent("infected_death", hGiveAwp);
- HookEvent("round_start", RoundStartEvent);
- hCount = CreateConVar("l4d2_specialammo_killcountsetting", "5", "How much Infected a Player has to shoot to win special ammo. (default 120) ", FCVAR_NONE);
- AutoExecConfig(true, "l4d2_specialammo"); // an autoexec! ooooh shiny
- }
- public Action:RoundStartEvent(Handle:event, const String:name[], bool:dontBroadcast)
- {
- for (new i = 1; i <= MaxClients; i++)
- {
- killcount[i] = 0;
- }
- }
- public OnClientDisconnect(client)
- {
- killcount[client] = 0;
- }
- public OnClientPostAdminCheck(client)
- {
- killcount[client] = 0;
- }
- public Action:hGiveAwp(Handle:event, String:ename[], bool:dontBroadcast)
- {
- if (NoDoubleEventFire) return Plugin_Continue;
- new client = GetClientOfUserId(GetEventInt(event, "attacker"));
- new bool:minigun = GetEventBool(event, "minigun");
- new bool:blast = GetEventBool(event, "blast");
- if (client)
- {
- if (!minigun && !blast)
- killcount[client] += 1;
- else
- {
- NoDoubleEventFire = false;
- return Plugin_Continue;
- }
- if ((killcount[client] > GetConVarInt(hCount)))
- {
- if(IsClientInGame(client) && GetClientTeam(client) == 2)
- {
- CheatCommand(client, "give", "sniper_awp");
- }
- }
- }
- NoDoubleEventFire = false;
- return Plugin_Continue;
- }
- stock CheatCommand(client, String:command[], String:arguments[]="")
- {
- new userflags = GetUserFlagBits(client);
- SetUserFlagBits(client, ADMFLAG_ROOT);
- new flags = GetCommandFlags(command);
- SetCommandFlags(command, flags & ~FCVAR_CHEAT);
- FakeClientCommand(client, "%s %s", command, arguments);
- SetCommandFlags(command, flags);
- SetUserFlagBits(client, userflags);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement