Raised This Month: $ Target: $400
 0% 

How to take away a player's shield if they are holding a knife


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Woodi5
Junior Member
Join Date: Nov 2020
Location: Russia
Old 12-15-2020 , 13:09   Re: How to take away a player's shield if they are holding a knife
Reply With Quote #4

Quote:
Originally Posted by CrazY. View Post
Just check whether the player is holding a shield or not, if true execute the drop command on him
Code:
if (cs_get_user_shield(id)) {     client_cmd(id, "drop") }

https://www.amxmodx.org/api/cstrike/cs_get_user_shield
https://www.amxmodx.org/api/amxmodx/client_cmd
Works:
HTML Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

const m_bOwnsShield = 2043;

public plugin_init()
{
    RegisterHam(Ham_Item_Deploy, "weapon_knife", "Item_Deploy_Post", 1)
}
 
public Item_Deploy_Post(weapon)
{
    new id = get_pdata_cbase(weapon, 41, 4)
    client_print(id, print_chat, "You changed your weapon for a knife!")
    
    if(get_pdata_bool(id, m_bOwnsShield) && get_pdata_cbase(weapon, 41, 4))
    {
        engclient_cmd(id, "drop", "weapon_shield")
    }
    return HAM_IGNORED
}
But I need the command not "drop", but the command strip_user_weapons (id, "weapon_shield") or ham_strip_weapon(id, "weapon_shield") or fm_strip_user_gun(id,"weapon_shield")
How do i do this?

Last edited by Woodi5; 12-15-2020 at 13:26.
Woodi5 is offline
 


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 10:23.


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