AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   FM_SetModel, pev_impulse (https://forums.alliedmods.net/showthread.php?t=234174)

nato 01-26-2014 11:03

FM_SetModel, pev_impulse
 
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;



GuskiS 01-26-2014 17:49

Re: FM_SetModel, pev_impulse
 
You have different fm_give_item stock from my includes. Make sure that entity id's ar the same. Print them both out.

ConnorMcLeod 01-26-2014 18:04

Re: FM_SetModel, pev_impulse
 
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)

meTaLiCroSS 01-27-2014 01:02

Re: FM_SetModel, pev_impulse
 
Quote:

Originally Posted by ConnorMcLeod (Post 2091296)
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); 
    } 



nato 01-27-2014 07:08

Re: FM_SetModel, pev_impulse
 
ConnorMcLeod, meTaLiCroSS Thanks


All times are GMT -4. The time now is 10:12.

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