Raised This Month: $51 Target: $400
 12% 

Block weapon switch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-16-2018 , 15:27   Block weapon switch
Reply With Quote #1

Hello, I'm trying to block weapon from being "holstered". I tried with member bAutoWepSwitch and superced Ham_Item_Deploy/Ham_Item_Holster, but none of them work. Any idea?
__________________









Last edited by CrazY.; 11-17-2018 at 06:25.
CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-17-2018 , 04:08   Re: Block weapon switch
Reply With Quote #2

You can always do the old ugly trick with CurWeapon + engclient_cmd("weapon_").
I'm not sure if there is a better way.
__________________

Last edited by HamletEagle; 11-17-2018 at 04:08.
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-17-2018 , 06:57   Re: Block weapon switch
Reply With Quote #3

What I did was work with player pev->weapons. They still can switch weapon if open console and write weapon_*, but this can be fixed if I return PLUGIN_HANDLED.
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-17-2018 , 10:11   Re: Block weapon switch
Reply With Quote #4

Check my jailbreak_main plugin i am using ham_item_can_deploy_pre to remove the weapon.
PHP Code:
public fw_wpn_deployed_pre(const iWpn)
{
    new 
id get_pdata_cbase(iWpnm_iWeaponOwnerWEAPON_LINUXDIFF)
    
    if(!
g_user_wpns_blocked[id]) return HAM_IGNORED;
    
    new 
sClassname[32], Wpn
    pev
(iWpnpev_classnamesClassnamecharsmax(sClassname))
    
    
Wpn cs_get_weapon_id(iWpn);
    
    if(
check_flag(g_user_wpns_blocked[id], Wpn))
    {
        
set_pev(idpev_weapons, (pev(id,pev_weapons) & ~(1<<Wpn)));
        
ExecuteHam(Ham_RemovePlayerItem,id,iWpn);
        
ExecuteHam(Ham_Item_KilliWpn);
        
SetHamReturnInteger(false);
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-17-2018 , 13:08   Re: Block weapon switch
Reply With Quote #5

Actually I'm trying to avoid remove weapons from player, but thank you anyway.
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-17-2018 , 15:24   Re: Block weapon switch
Reply With Quote #6

Quote:
Originally Posted by CrazY. View Post
Actually I'm trying to avoid remove weapons from player, but thank you anyway.
Then try calling the previous weapon instead of removing.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-17-2018 , 16:09   Re: Block weapon switch
Reply With Quote #7

Did you try to call (ExecuteHam) Ham_Item_Deploy( your_weapon_ent ) in Ham_Item_Holster( your_weapon_ent ) POST forward ?
__________________
My English is A0

Last edited by E1_531G; 11-17-2018 at 16:10.
E1_531G is offline
Reply



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 11:29.


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