AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   fwAddToFullPack (https://forums.alliedmods.net/showthread.php?t=293757)

grs4 02-09-2017 17:12

fwAddToFullPack
 
I want to set glow of ENT if is player turret (only for owner)

PHP Code:

public IsEntityPlayerTurret(iEntiPlayer)
    return 
entity_get_edict(iEntEV_ENT_turret_owner) == iPlayer && entity_get_int(iEntEV_INT_turret_level)

public 
fwAddToFullPack(es_handleeENTHOSThostflagsplayerset) {
    if(
player || !is_user_connected(HOST) || !is_valid_ent(ENT))
        return 
FMRES_IGNORED

    
/* If ranger owner is other than player -> hide him */
    
if(IsEntityRanger(ENT) && entity_get_int(ENTEV_INT_ranger_owner) != HOST
        return 
FMRES_OVERRIDE;
    
    if(
IsEntityPlayerTurret(ENTHOST))
    {
        
set_es(es_handleES_RenderModekRenderNormal)
        
set_es(es_handleES_RenderAmt13)
        
set_es(es_handleES_RenderColor25500)
        
set_es(es_handleES_RenderFxkRenderFxGlowShell)
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED


I tested all f....g options with ES_, with return TYPE. Checking IsEntityPlayer turret work well - (I do not want to checking all times classname, I think checking integers is Faster

What Am I doing wrong?

I tested too with
PHP Code:

set_es(es_handleES_RenderColor, {25500}) 

and others order

//edit
I tested too without if(player || ...) return....

georgik57 02-10-2017 21:33

Re: fwAddToFullPack
 
HOST is the player that the packet is being sent to.
ENT is the entity about which he is receiving the information.

If you said you removed the "player || " check then the problem is because of IsEntityRanger, EV_INT_ranger_owner, or IsEntityPlayerTurret.

Try
"!IsEntityRanger(ENT) || entity_get_int(ENT, EV_INT_ranger_owner) != HOST"
instead of
"IsEntityRanger(ENT) && entity_get_int(ENT, EV_INT_ranger_owner) != HOST".

And don't use the FMRES returns if you don't know what they do. Simply use "return" only.


All times are GMT -4. The time now is 20:42.

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