Raised This Month: $203 Target: $400
 50% 

Blocking weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 08-17-2017 , 12:00   Blocking weapons
Reply With Quote #1

I have a request if there is a good soul who will add an exception for people with a Root flag to have a smoke grenade

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <cstrike>

public OnPluginStart()
{
    
CreateConVar("Clear Weapons""1.0""Linux`");
}
public 
OnEntityCreated(entity, const String:classname[])
{
    if(
entity MaxClients && IsValidEntity(entity))
    {
        if(!
StrEqual(classname"weapon_awp") && StrContains(classname"weapon_"false) != -1)
        if(!
StrEqual(classname"weapon_knife") && StrContains(classname"knife_"false) != -1)
            
SDKHook(entitySDKHook_SpawnOnEntitySpawned);
    }
}
public 
Action:OnEntitySpawned(entity)
{
    
AcceptEntityInput(entity"kill");
    
SDKUnhook(entitySDKHook_SpawnOnEntitySpawned);

szogun is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 08-17-2017 , 23:15   Re: Blocking weapons
Reply With Quote #2

From what I understood, you wanted something like this?

PHP Code:
#include <sourcemod>
#include <sdkhooks>

public void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_WeaponCanUseOnWeaponDecideUse); 
}

public 
Action OnWeaponDecideUse(int clientint iWeapon)
{
    if (
IsValidEdict(iWeapon) && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
char[] sWeapon = new char[MAX_NAME_LENGTH];
        
GetEdictClassname(iWeaponsWeaponMAX_NAME_LENGTH);
        
        if (
StrEqual(sWeapon"weapon_smokegrenade") && !CheckCommandAccess(client"sm_rcon"ADMFLAG_ROOT))
            return 
Plugin_Handled;
    }
    return 
Plugin_Continue;

LenHard is offline
szogun
Senior Member
Join Date: Apr 2016
Old 08-19-2017 , 08:00   Re: Blocking weapons
Reply With Quote #3

Yes, thanks for your help
szogun is offline
szogun
Senior Member
Join Date: Apr 2016
Old 08-20-2017 , 10:47   Re: Blocking weapons
Reply With Quote #4

I have this small problem with this plugin because I still can not block the deagle
szogun is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:29.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode