AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Strange Entity Problem (https://forums.alliedmods.net/showthread.php?t=154283)

padilha007 04-05-2011 13:25

[SOLVED] Strange Entity Problem
 
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;



Arkshine 04-05-2011 13:54

Re: Strange Entity Problem
 
What you get is the weaponbox entity. When you drop a weapon, a weaponbox entity is created and inside there is your weapon.

ConnorMcLeod 04-05-2011 14:01

Re: Strange Entity Problem
 
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.

padilha007 04-06-2011 12:26

Re: Strange Entity Problem
 
Tnx Ark and Connor.

Solved


All times are GMT -4. The time now is 19:46.

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