When I create the entity i get your id, when I check later I know is that entity but shows a different id. I used pev_iuser* to hold my informations but they are gone:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < engine >
public plugin_init()
{
register_plugin( "*", "*", "*" );
register_clcmd("say /he", "GiveNade");
RegisterHam(Ham_Spawn, "grenade", "Weaponbox_Spawned", 1);
}
public GiveNade( id )
{
static ID;
ID = fm_give_item( id, "weapon_hegrenade" );
client_print(0, print_chat, "Entity ID-1: %d", ID);
// i will have: 86
}
public Weaponbox_Spawned( iEnt )
{
if( pev_valid(iEnt) )
client_print(0, print_chat, "Entity ID-2: %d", iEnt);
// now i have: 87 Or 89
}
stock fm_give_item( id, weapon[] )
{
new wEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, weapon));
if( !pev_valid( wEnt ) )
return -1;
set_pev( wEnt, pev_spawnflags, SF_NORESPAWN );
dllfunc( DLLFunc_Spawn, wEnt );
if( !ExecuteHamB( Ham_AddPlayerItem, id, wEnt ) )
{
if( pev_valid( wEnt ) )
set_pev( wEnt, pev_flags, pev( wEnt, pev_flags ) | FL_KILLME );
return -1;
}
ExecuteHamB( Ham_Item_AttachToPlayer, wEnt, id );
return wEnt;
}
__________________