AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SDKHooks_DropWeapon make item disappear (https://forums.alliedmods.net/showthread.php?t=290414)

Nekoz 11-12-2016 17:38

SDKHooks_DropWeapon make item disappear
 
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?

_GamerX 11-13-2016 07:58

Re: SDKHooks_DropWeapon make item disappear
 
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;



Nekoz 11-14-2016 04:12

Re: SDKHooks_DropWeapon make item disappear
 
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

_GamerX 11-14-2016 04:25

Re: SDKHooks_DropWeapon make item disappear
 
Quote:

Originally Posted by Nekoz (Post 2470052)
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?

Nekoz 11-14-2016 04:35

Re: SDKHooks_DropWeapon make item disappear
 
Quote:

Originally Posted by _GamerX (Post 2470055)
This error getting only if you try drop gun?

Yea that only happen when i drop gun

_GamerX 11-14-2016 16:38

Re: SDKHooks_DropWeapon make item disappear
 
Becouse CS:GO allows drop gun set this drop command only for grenades, knife and taser like in my code.

Nekoz 11-14-2016 18:48

Re: SDKHooks_DropWeapon make item disappear
 
Quote:

Originally Posted by _GamerX (Post 2470186)
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


All times are GMT -4. The time now is 08:40.

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