Raised This Month: $ Target: $400
 0% 

[SOLVED] Strange Entity Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
padilha007
Senior Member
Join Date: Jul 2008
Old 04-05-2011 , 13:25   [SOLVED] Strange Entity Problem
Reply With Quote #1

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 
GiveNadeid )
{
    static 
ID;
    
ID fm_give_itemid"weapon_hegrenade" );
    
    
client_print(0print_chat"Entity ID-1: %d"ID);
    
// i will have: 86
}

public 
Weaponbox_SpawnediEnt )
{
    if( 
pev_valid(iEnt) )
        
client_print(0print_chat"Entity ID-2: %d"iEnt);
    
    
// now i have: 87 Or 89
}

stock fm_give_itemidweapon[] )
{
    new 
wEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringweapon));
    if( !
pev_validwEnt ) )
        return -
1;
    
    
set_pevwEntpev_spawnflagsSF_NORESPAWN );
    
dllfuncDLLFunc_SpawnwEnt );
    
    if( !
ExecuteHamBHam_AddPlayerItemidwEnt ) )
    {
        if( 
pev_validwEnt ) )
            
set_pevwEntpev_flagspevwEntpev_flags ) | FL_KILLME );
    
        return -
1;
    }
    
    
ExecuteHamBHam_Item_AttachToPlayerwEntid );
    
    return 
wEnt;

__________________


Last edited by padilha007; 04-06-2011 at 12:27.
padilha007 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-05-2011 , 13:54   Re: Strange Entity Problem
Reply With Quote #2

What you get is the weaponbox entity. When you drop a weapon, a weaponbox entity is created and inside there is your weapon.
__________________

Last edited by Arkshine; 04-05-2011 at 13:59.
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-05-2011 , 14:01   Re: Strange Entity Problem
Reply With Quote #3

weapon_hegrenade is the weapon given to player, what you catch in spawn is "grenade", it's a different entity.
Why don't you use grenade_throw forward from csx module, you have grenade index, type, and player index.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 04-06-2011 , 12:26   Re: Strange Entity Problem
Reply With Quote #4

Tnx Ark and Connor.

Solved
__________________

padilha007 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 19:46.


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