View Single Post
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-21-2018 , 10:00   Hide custom entity, Game not loading functions first time, Entity ID problems
Reply With Quote #1

Hi,

1. Is there a way to hide custom entities same as we hide armoury_entity entities? By setting m_iCount to 0? When I mean 'hide' I don't mean remove.

2. Every time I get into the game for the first time and open a listen server, a lot of things don't load properly, such as:
- It doesn't properly load WeaponList, so my weaponbox entities don't get any ammo, until I restart the listen server and it works.
etc..

3.
And last, this code is not glowing the weapons I drop because of entity indexes getting messed up for some reason.
PHP Code:
public RoundStarted( ) // here we glow the weapon that we create
{
    
log_to_file"Rarity.txt""#1 iEnt: %d | Color: %d"WeaponBoxEntityg_iDataWeaponWeapon_Rarity ], g_iDataWeaponRarity_Damage ] );
    
set_pevWeaponBoxEntitypev_iuser2g_iDataWeaponWeapon_Rarity ] );
    
    
GlowWeaponWeaponBoxEntityg_iDataWeaponWeapon_Rarity ] );
}

public @
SetModeliEntszModel[ ] )
{
    if( ! 
pev_validiEnt ) )
    return 
FMRES_IGNORED;

    new 
szClassName32 ];
    
peviEntpev_classnameszClassNamecharsmaxszClassName ) );
    
    if( ! 
equalszClassName"weaponbox" ) )
    return 
FMRES_IGNORED;
    
    new 
iRarity peviEntpev_iuser2 );
    
log_to_file"Rarity.txt""#2 iEnt: %d | Color: %d | Class: %s"iEntiRarityszClassName );
    
    
GlowWeaponiEntiRarity );
    return 
FMRES_IGNORED;

Debug logs:
Quote:
L 07/21/2018 - 15:53:27: #2 iEnt: 544 | Color: 0 | Class: weaponbox
L 07/21/2018 - 15:53:27: #1 iEnt: 544 | Color: 4
L 07/21/2018 - 15:54:05: #2 iEnt: 113 | Color: 0 | Class: weaponbox
So basically this is what happens:

I create a weaponbox whose ID is 544, assign pev_iuser2 a value of 4, then hook FM_SetModel, and for the same weapon, the ID is 113? And of course the value is 0 because it's unassigned. Why does this happen?
__________________

Last edited by edon1337; 07-30-2018 at 18:01.
edon1337 is offline