Raised This Month: $ Target: $400
 0% 

FM_SetModel, pev_impulse


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nato
Junior Member
Join Date: Jul 2011
Old 01-26-2014 , 11:03   FM_SetModel, pev_impulse
Reply With Quote #1

Hey. When give entity weapons set pev_impulse 500.
In FM_Setmodel do check
client_print (id, print_chat, "SetModel impulse ==% d", pev (entity, pev_impulse));
if (pev (entity, pev_impulse) == 500)

but it did not pass because the pev_impulse == 0
why pev_impulse == 0 ?

PHP Code:
stock fm_give_item(id, const item[]) 
{
    static 
ent;
    
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem));
    if (!
pev_valid(ent)) return;

        
set_pev(entpev_impulse500);
    
    static 
Float:originF[3];
    
pev(idpev_originoriginF);
    
set_pev(entpev_originoriginF);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);
    
    static 
save;
    
save pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentid);
    if (
pev(entpev_solid) != save)
        return;
    
    
engfunc(EngFunc_RemoveEntityent);
}

register_forward(FM_SetModel"fwd_SetModel"0);

public 
fwd_SetModel(entity, const model[]) 
{        
    static 
id;
    
id pev(entitypev_owner);
        
    
client_print(idprint_chat"SetModel impulse == %d"pev(entitypev_impulse));    
    
    if (
pev(entitypev_impulse) == 500)
    {
        
//code
        
return FMRES_SUPERCEDE;
    }
        
    return 
FMRES_IGNORED;

nato is offline
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 01-26-2014 , 17:49   Re: FM_SetModel, pev_impulse
Reply With Quote #2

You have different fm_give_item stock from my includes. Make sure that entity id's ar the same. Print them both out.
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness
GuskiS is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-26-2014 , 18:04   Re: FM_SetModel, pev_impulse
Reply With Quote #3

Weapon is given to a player, so SetModel is not called, or it is called but not viewable because it is given right to player.

If you want to set model when player gonna drop that weapon, then you have to check weapon that is hold by the created weaponbox, with get_pdata_cbase (there is a stock somewhere)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-27-2014 , 01:02   Re: FM_SetModel, pev_impulse
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
If you want to set model when player gonna drop that weapon, then you have to check weapon that is hold by the created weaponbox, with get_pdata_cbase (there is a stock somewhere)
Made by you...

https://forums.alliedmods.net/showpo...&postcount=134

PHP Code:
GetWeaponBoxPropsent, &weapon, &weaponType, &ammoCountammoName[], len 

    for(new 
1i<= 5i++) 
    { 
        
weapon get_pdata_cbase(entm_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX); 
        if( 
weapon 
        { 
            break; 
        } 
    } 

    if( 
weapon 
    { 
        
weaponType get_pdata_int(weaponm_iIdXO_CBASEPLAYERWEAPON); 
    } 
    else 
    { 
        
weaponType 0
    } 

    
ammoCount get_pdata_int(entm_rgAmmo_CWeaponBox[1], XO_CWEAPONBOX); 
    if( 
ammoCount 
    { 
        
global_get(glb_pStringBaseget_pdata_int(entm_rgiszAmmo[1], XO_CWEAPONBOX), ammoNamelen); 
    } 

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
nato
Junior Member
Join Date: Jul 2011
Old 01-27-2014 , 07:08   Re: FM_SetModel, pev_impulse
Reply With Quote #5

ConnorMcLeod, meTaLiCroSS Thanks
nato is offline
Reply


Thread Tools
Display Modes

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


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