Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #pragma semicolon 1
- #pragma newdecls required
- static const float BLOCKTIME = 0.3;
- static const char PISTOLNETCLASS[] = "CPistol";
- bool g_bProhibitClientUse[MAXPLAYERS+1];
- public void OnPluginStart()
- {
- HookEvent("player_use",PlayerUse_Event);
- }
- public Action PlayerUse_Event(Handle event, const char[] name, bool dontBroadcast)
- {
- char sBuffer[32];
- GetEntityNetClass(GetEventInt(event,"targetid"),sBuffer,sizeof(sBuffer));
- if (!StrEqual(PISTOLNETCLASS,sBuffer)){return;}
- int client = GetClientOfUserId(GetEventInt(event,"userid"));
- g_bProhibitClientUse[client] = true;
- CreateTimer(BLOCKTIME,BlockUse_Timer,client);
- }
- public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
- {
- if (!g_bProhibitClientUse[client]) return Plugin_Continue;
- if (!(buttons & IN_USE)) return Plugin_Continue;
- buttons = buttons^IN_USE;
- return Plugin_Continue;
- }
- public Action BlockUse_Timer(Handle timer, int client)
- {
- g_bProhibitClientUse[client] = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment