Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
diogooonair committed Jun 11, 2019
1 parent 46a94c9 commit d9203c8
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
Binary file added plugins/antideaglespam.smx
Binary file not shown.
62 changes: 62 additions & 0 deletions scripting/antideaglespam.sp
@@ -0,0 +1,62 @@
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <smlib>

#pragma semicolon 1
#pragma tabsize 0;

#define PLUGIN_NAME "AntiDeagle Spray"
#define PLUGIN_AUTHOR "DiogoOnAir"
#define PLUGIN_DESCRIPTION "AntiDeagleSpray"
#define PLUGIN_VERSION "1.4vFix"

public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
};

public OnPluginStart()
{
HookEvent("weapon_fire", Event_WeaponFire, EventHookMode_Post);
}

public void Event_WeaponFire(Event event, const char[] sEventName, bool bDontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));

char sWeapon[65];
event.GetString("weapon", sWeapon, sizeof(sWeapon));

if (StrEqual(sWeapon, "weapon_deagle"))
{
CreateTimer(0.05, RemoveDeagle, client);
}
}

public Action RemoveDeagle(Handle timer, any client)
{
if (IsValidClient(client) && (IsPlayerAlive(client))) {
RemovePlayerItem(client, GetPlayerWeaponSlot(client, 1));
CreateTimer(0.15, GiveDeagle, client);
}
}


public Action GiveDeagle(Handle timer, any client)
{
if (IsValidClient(client) && (IsPlayerAlive(client)))
GivePlayerItem(client, "weapon_deagle");
Client_SetActiveWeapon(client, GetPlayerWeaponSlot(client, 1));
}

stock bool IsValidClient(int client)
{
if(client <= 0 ) return false;
if(client > MaxClients) return false;
if(!IsClientConnected(client)) return false;
return IsClientInGame(client);
}

0 comments on commit d9203c8

Please sign in to comment.