Raised This Month: $ Target: $400
 0% 

Dropping pistol while carrying shield


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Misery
Senior Member
Join Date: Dec 2010
Old 09-04-2012 , 15:18   Dropping pistol while carrying shield
Reply With Quote #1

Hi,

Say a CT has both a USP and a shield. Now, I'd like my plugin to make that CT drop the USP without dropping the shield.

This is problematic... engclient_cmd(id, "drop", "weapon_usp") will not work : the shield is dropped, but not the usp. How can I do that?

Cordially,
Misery
Misery is offline
Alekkkk
Member
Join Date: Mar 2012
Location: Bulgaria
Old 09-04-2012 , 15:58   Re: Dropping pistol while carrying shield
Reply With Quote #2

First thing i have in mind is that you can hook "drop" command and check if player have shield. Then you can take the pistol from the player .
__________________
Alekkkk is offline
Send a message via Skype™ to Alekkkk
Misery
Senior Member
Join Date: Dec 2010
Old 09-04-2012 , 17:35   Re: Dropping pistol while carrying shield
Reply With Quote #3

Sorry, I don't get you?
If I "drop weapon_usp" while shield is "true", the shield will be dropped first. If I do another "drop weapon_usp", this time the USP will be dropped. But... the problem is that I don't want to make the player drop the shield, only the USP.

Last edited by Misery; 09-04-2012 at 17:36.
Misery is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 09-05-2012 , 00:26   Re: Dropping pistol while carrying shield
Reply With Quote #4

try locking the weapon to knife while the shield is true. This way you don't need to force weapon dropping (which you'll just pick up anyway) and piss off clients.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Misery
Senior Member
Join Date: Dec 2010
Old 09-05-2012 , 01:06   Re: Dropping pistol while carrying shield
Reply With Quote #5

Not really the best way... don't really like to get around what I initially wanted with a hackfix.
There's really absolutely no way? How can this even be possible... after all, that should be a simple operation.

Any low level/Orpheu based solution? Hamsandwich?

Last edited by Misery; 09-05-2012 at 01:18.
Misery is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 09-05-2012 , 01:38   Re: Dropping pistol while carrying shield
Reply With Quote #6

It's not the way you wanted, but it can help you.
https://forums.alliedmods.net/showthread.php?t=131579
OvidiuS is offline
Send a message via Skype™ to OvidiuS
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-05-2012 , 01:51   Re: Dropping pistol while carrying shield
Reply With Quote #7

Try this :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Drop Gun Before Shield"
#define VERSION "0.0.1"

#define INT_BYTES        4
#define BYTE_BITS        8

#define m_pActiveItem 373
#define m_bHasShield 2043

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )
    
register_clcmd("drop""ClCmd_Drop")
}

public 
ClCmd_Dropid )
{
    if( 
is_user_alive(id) && get_pdata_bool(idm_bHasShield) )
    {
        new 
iActiveWeapon get_pdata_cbase(idm_pActiveItem)
        if( 
iActiveWeapon && ExecuteHam(Ham_Item_ItemSlotiActiveWeapon) == )
        {
            
set_pdata_bool(idm_bHasShieldfalse)
            
engclient_cmd(id"drop")
            
set_pdata_bool(idm_bHasShieldtrue)
            new 
iActiveWeapon get_pdata_cbase(idm_pActiveItem)
            if( 
iActiveWeapon )
            {
                
ExecuteHamB(Ham_Item_DeployiActiveWeapon)
            }
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

bool:get_pdata_bool(entcharbased_offsetintbase_linuxdiff 5)
{
    return !!( 
get_pdata_int(entcharbased_offset INT_BYTESintbase_linuxdiff) & (0xFF<<((charbased_offset INT_BYTES) * BYTE_BITS)) )
}

set_pdata_bool(entcharbased_offsetbool:valueintbase_linuxdiff 5)
{
    
set_pdata_char(entcharbased_offset_:valueintbase_linuxdiff)
}

set_pdata_char(entcharbased_offsetvalueintbase_linuxdiff 5)
{
    
value &= 0xFF
    
new int_offset_value get_pdata_int(entcharbased_offset INT_BYTESintbase_linuxdiff)
    new 
bit_decal = (charbased_offset INT_BYTES) * BYTE_BITS
    int_offset_value 
&= ~(0xFF<<bit_decal// clear byte
    
int_offset_value |= value<<bit_decal
    set_pdata_int
(entcharbased_offset INT_BYTESint_offset_valueintbase_linuxdiff)
    return 
1

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 08:17.


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