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

SDKHooks_DropWeapon make item disappear


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nekoz
Member
Join Date: Oct 2016
Old 11-12-2016 , 17:38   SDKHooks_DropWeapon make item disappear
Reply With Quote #1

So I'm trying to figure it out why this SDKHooks_DropWeapon keep making item gone sometime

Code:
new weapon = GetPlayerWeaponSlot(client, slot)
SDKHooks_DropWeapon(client, weapon, NULL_VECTOR, NULL_VECTOR)
I'm trying to make players able to drop their gear and stuff
It work but whenever the stuff it drop, it just disappear right away
It there a way to prevent the item de-spawn or disappear on drop?

Last edited by Nekoz; 11-12-2016 at 17:38.
Nekoz is offline
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 11-13-2016 , 07:58   Re: SDKHooks_DropWeapon make item disappear
Reply With Quote #2

Here is my code

PHP Code:
public Action Command_Drop(int client, const char[] commandint args)
{
    if(
IsValidClient(client))
    {
        
char sName[32];
        
int weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
        if(!
IsValidEdict(weapon))
            return 
Plugin_Continue;

        
GetEdictClassname(weaponsNamesizeof(sName));

        if(
StrEqual("weapon_taser"sNamefalse))
        {
            if(
GetEntProp(weaponProp_Data"m_iClip1") > 0)
            {
                
int iSequence GetEntProp(weaponProp_Data"m_nSequence");
                if(
iSequence != 2)
                {
                    
SDKHooks_DropWeapon(clientweapon);
                    return 
Plugin_Handled;
                }
            }
        }
        else if(
StrEqual("weapon_hegrenade"sNamefalse) || StrEqual("weapon_flashbang"sNamefalse) || StrEqual("weapon_smokegrenade"sNamefalse) || StrEqual("weapon_incgrenade"sNamefalse) || StrEqual("weapon_molotov"sNamefalse) || StrEqual("weapon_tagrenade"sNamefalse) || StrEqual("weapon_decoy"sNamefalse))
        {
            
int iSequence GetEntProp(weaponProp_Data"m_nSequence");
            if(
iSequence != 2)
            {
                
SDKHooks_DropWeapon(clientweapon);
                return 
Plugin_Handled;
            }
        }
        else if((
StrContains(sName"knife"false) != -1) || (StrContains(sName"bayonet"false) != -1))
        {
            
SDKHooks_DropWeapon(clientweapon);
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;


Last edited by _GamerX; 11-13-2016 at 07:59.
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Nekoz
Member
Join Date: Oct 2016
Old 11-14-2016 , 04:12   Re: SDKHooks_DropWeapon make item disappear
Reply With Quote #3

I did use the GetEntPropEnt
But somehow im getting new error now

My code:

PHP Code:
public OnPluginStart()
{
    
RegConsoleCmd("drop"Drop"Drop the stuff");
}

public 
Action:Drop(client,args)
{
    new 
CurrentUserWeapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
SDKHooks_DropWeapon(clientCurrentUserWeaponNULL_VECTORNULL_VECTOR);
    
    return 
Plugin_Handled;


Error im getting

Code:
Call stack trace:
[0] SDKHooks_DropWeapon
[1] Line 29, drop.sp::Drop
[SM] Exception reported: Weapon 1199 is not owned by client 2
Not sure wat I did wrong XD
And the item still disappear sometime

Last edited by Nekoz; 11-14-2016 at 04:13.
Nekoz is offline
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 11-14-2016 , 04:25   Re: SDKHooks_DropWeapon make item disappear
Reply With Quote #4

Quote:
Originally Posted by Nekoz View Post
Error im getting

Code:
Call stack trace:
[0] SDKHooks_DropWeapon
[1] Line 29, drop.sp::Drop
[SM] Exception reported: Weapon 1199 is not owned by client 2
Not sure wat I did wrong XD
And the item still disappear sometime
This error getting only if you try drop gun?

Last edited by _GamerX; 11-14-2016 at 04:25.
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Nekoz
Member
Join Date: Oct 2016
Old 11-14-2016 , 04:35   Re: SDKHooks_DropWeapon make item disappear
Reply With Quote #5

Quote:
Originally Posted by _GamerX View Post
This error getting only if you try drop gun?
Yea that only happen when i drop gun
Nekoz is offline
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 11-14-2016 , 16:38   Re: SDKHooks_DropWeapon make item disappear
Reply With Quote #6

Becouse CS:GO allows drop gun set this drop command only for grenades, knife and taser like in my code.
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Nekoz
Member
Join Date: Oct 2016
Old 11-14-2016 , 18:48   Re: SDKHooks_DropWeapon make item disappear
Reply With Quote #7

Quote:
Originally Posted by _GamerX View Post
Becouse CS:GO allows drop gun set this drop command only for grenades, knife and taser like in my code.
Oh im not doing this for CSGO XD
I drop explosives or knife still give me that error LOL
But it drop, not sure if i should just ignore it

Last edited by Nekoz; 11-14-2016 at 18:49.
Nekoz 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 06:11.


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