Raised This Month: $ Target: $400
 0% 

Solved Ent has null Private Data | Array not being read


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 08-05-2018 , 09:36   Re: Ent has null Private Data | Array not being read
Reply With Quote #1

Code:
WeaponEntity = create_entity( eData[ Weapon_Name ] );
create_entity creates just entity without any private data cause there's no classname to link its privatedata.
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-05-2018 , 10:03   Re: Ent has null Private Data | Array not being read
Reply With Quote #2

Quote:
Originally Posted by Ghosted View Post
Code:
WeaponEntity = create_entity( eData[ Weapon_Name ] );
create_entity creates just entity without any private data cause there's no classname to link its privatedata.
So that means I have to create an entity such as info_target then set it's classname to eData[ Weapon_Name ] ?
__________________

Last edited by edon1337; 08-05-2018 at 10:03.
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-05-2018 , 10:39   Re: Ent has null Private Data | Array not being read
Reply With Quote #3

Quote:
Originally Posted by Ghosted View Post
Code:
WeaponEntity = create_entity( eData[ Weapon_Name ] );
create_entity creates just entity without any private data cause there's no classname to link its privatedata.
No, that's EngFunc_CreateEntity.
@OP, debug every line of your code and check runtime errors. You may be having issues with weapon_glock like in one of your previous topics IIRC.
But I'm on my phone atm so I can't check the code thoroughly, just guessing.
__________________

Last edited by klippy; 08-05-2018 at 10:40.
klippy is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 08-05-2018 , 11:03   Re: Ent has null Private Data | Array not being read
Reply With Quote #4

Quote:
Originally Posted by KliPPy View Post
No, that's EngFunc_CreateEntity.
@OP, debug every line of your code and check runtime errors. You may be having issues with weapon_glock like in one of your previous topics IIRC.
But I'm on my phone atm so I can't check the code thoroughly, just guessing.
My bad!


Code:
 WeaponEntity = create_entity( eData[ Weapon_Name ] ); 
         
        if( pev_valid( WeaponEntity ) != 2 ) 
        { 
            remove_entity( WeaponBoxEntity ); 
        } 

        ExecuteHamB( Ham_Spawn, WeaponEntity );
Check if entity is removed by remove_entity
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 08-05-2018 at 11:09.
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-05-2018 , 14:13   Re: Ent has null Private Data | Array not being read
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
No, that's EngFunc_CreateEntity.
@OP, debug every line of your code and check runtime errors. You may be having issues with weapon_glock like in one of your previous topics IIRC.
But I'm on my phone atm so I can't check the code thoroughly, just guessing.
Thanks, I always forget that it should be weapon_glock18, also that should fix the 2nd problem too, since there's nothing wrong with the method I'm using to retrieve the data from array. I'll let you know when I test.

Quote:
Originally Posted by Ghosted View Post
Code:
 WeaponEntity = create_entity( eData[ Weapon_Name ] ); 
         
        if( pev_valid( WeaponEntity ) != 2 ) 
        { 
            remove_entity( WeaponBoxEntity ); 
        } 

        ExecuteHamB( Ham_Spawn, WeaponEntity );
I don't think that's safe. You have to call m_pfnThink on weaponbox entities to properly remove them, remove_entity creates a memory leak.

Furthermore, HamletEagle didn't remove the weaponbox here and that surely has a reason behind.
__________________

Last edited by edon1337; 08-05-2018 at 14:14.
edon1337 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 08-05-2018 , 14:20   Re: Ent has null Private Data | Array not being read
Reply With Quote #6

Quote:
Originally Posted by edon1337 View Post
I don't think that's safe.
actually that's ur code, said to use print debugging option, nvm...
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 08-05-2018 at 14:24.
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-05-2018 , 14:24   Re: Ent has null Private Data | Array not being read
Reply With Quote #7

Quote:
Originally Posted by Ghosted View Post
actually that's ur code.
Ah, just a misunderstanding, I've accidentally put it there when I was trying to test, but I never got the chance.
__________________
edon1337 is offline
Reply



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 12:12.


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