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

[SM] Exception reported: Entity 1 (1) is invalid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 06-06-2020 , 09:11   [SM] Exception reported: Entity 1 (1) is invalid
Reply With Quote #1

06/06/2020 - 16:06:48: [SM] Exception reported: Entity 1 (1) is invalid
06/06/2020 - 16:06:48: [SM] Blaming: pluginn.smx
06/06/2020 - 16:06:48: [SM] Call stack trace:
06/06/2020 - 16:06:48: [SM][0] GetEntPropArraySize
06/06/2020 - 16:06:48: [SM][1] Line 3122, pluginn.sp::RemoveAllWeapons
06/06/2020 - 16:06:48: [SM][2] Line 6302, pluginn.sp::functiondd

6302: RemoveAllWeapons(x);

code
PHP Code:
void RemoveAllWeapons(int client)
{   
    
int length GetEntPropArraySize(clientProp_Send"m_hMyWeapons");
    for (
int i 0lengthi++) 
    {
        
int weapon GetEntPropEnt(clientProp_Send"m_hMyWeapons"i); 
        if (
weapon != -1)
        {
            
RemovePlayerItem(clientweapon);
            
AcceptEntityInput(weapon"KillHierarchy");
        }
    }
    
    
SetEntPropEnt(clientProp_Send"m_hActiveWeapon", -1);

what is problem?
jugule is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-06-2020 , 09:16   Re: [SM] Exception reported: Entity 1 (1) is invalid
Reply With Quote #2

Whatever is calling RemoveAllWeapons is where the problem is. The client its passing to this function is invalid.
__________________
Silvers is offline
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 06-18-2020 , 17:46   Re: [SM] Exception reported: Entity 1 (1) is invalid
Reply With Quote #3

Hey!

PHP Code:
DisarmPlayer(client)
{
    for(new 
05i++)
    {
        new 
weapon = -1;
        while((
weapon GetPlayerWeaponSlot(clienti)) != -1)
        {
            if(
IsValidEntity(weapon))
            {
                
RemovePlayerItem(clientweapon);
            }
        }
    }
    
SetEntProp(clientProp_Send"m_bHasDefuser"0);
    
SetEntProp(clientProp_Send"m_bHasHeavyArmor"0);
    
SetEntProp(clientProp_Send"m_ArmorValue"0);
    
SetEntProp(clientProp_Send"m_bHasHelmet"0);

I usually use this to disarm players. Try that! And the problem might not be with your custom void but yes where it is being used...

Contact me on steam or, for better purposes, post your .sp here.

Best Regards,

SpirT.
__________________

Last edited by SpirT; 06-18-2020 at 17:46.
SpirT is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-18-2020 , 19:13   Re: [SM] Exception reported: Entity 1 (1) is invalid
Reply With Quote #4

You're missing a IsClientInGame check in there.
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 04:53.


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