AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   change this stock (https://forums.alliedmods.net/showthread.php?t=275399)

wicho 11-29-2015 02:10

change this stock
 
Hi everybody, well basically my question is with what native I can replace this? fm_get_user_weapon_entity, I do not like to use use fakemeta util so I would like to replace it ... thx in advance

this:

fm_get_user_weapon_entity(id, get_user_weapon(id))

is the same as this?

get_pdata_cbase(id, m_pActiveItem, 5)

Bugsy 11-29-2015 14:28

Re: change this stock
 
Yes, they will both return the active/current weapon entity.

wicho 11-29-2015 19:33

Re: change this stock
 
Thank you for telling me, just another question its possible to optimaze this code?

PHP Code:

public changecolor(id)   
{       
         
    
ColorOption[id]++
    
ColorOption[id] %= 4
    
    
switch(ColorOption[id]) 
    {         
        case 
0// white  
        
{  
            
g_Color[id]{0} = 255 // r  
            
g_Color[id]{1} = 255 // g  
            
g_Color[id]{2} = 255 // b 
        
        
new ent = -1
            
while((ent engfunc(EngFunc_FindEntityByStringent"classname""grenade")) != 0)
            {
                 if (!
is_valid_ent(ent) || pev(entPEV_NADE_TYPE) != NADE_TYPE_FLARE)
                 continue;

                 
fm_set_rendering(entkRenderFxGlowShellg_Color[id]{0}, g_Color[id]{1}, g_Color[id]{2}, kRenderNormal16);  
            } 
        
printf(idGRAY"^x04 ZP |^x01 You have changed your color light to^x03 white^x01!")
        }   
        case 
1// red  
        
{       
            
g_Color[id]{0} = random_num(50,255// r  
            
g_Color[id]{1} = // g  
            
g_Color[id]{2} = // b 
        
        
new ent = -1
            
while((ent engfunc(EngFunc_FindEntityByStringent"classname""grenade")) != 0)
            {
                 if (!
is_valid_ent(ent) || pev(entPEV_NADE_TYPE) != NADE_TYPE_FLARE)
                 continue;

                 
fm_set_rendering(entkRenderFxGlowShellg_Color[id]{0}, g_Color[id]{1}, g_Color[id]{2}, kRenderNormal16);  
            } 
        
printf(idRED"^x04 ZP |^x01 You have changed your color light to^x03 red^x01!")
        }  
        case 
2// green  
        
{  
            
g_Color[id]{0} = // r  
            
g_Color[id]{1} = random_num(50,255// g  
            
g_Color[id]{2} = // b 
        
        
new ent = -1
            
while((ent engfunc(EngFunc_FindEntityByStringent"classname""grenade")) != 0)
            {
                 if (!
is_valid_ent(ent) || pev(entPEV_NADE_TYPE) != NADE_TYPE_FLARE)
                 continue;

                 
fm_set_rendering(entkRenderFxGlowShellg_Color[id]{0}, g_Color[id]{1}, g_Color[id]{2}, kRenderNormal16);  
            } 
        
printf(idGREEN"^x04 ZP |^x01 You have changed your color light to^x04 green^x01!")
        }  
        case 
3// blue 
        
{  
            
g_Color[id]{0} = // r  
            
g_Color[id]{1} = // g  
            
g_Color[id]{2} = random_num(50,255// b 
        
        
new ent = -1
            
while((ent engfunc(EngFunc_FindEntityByStringent"classname""grenade")) != 0)
            {
                 if (!
is_valid_ent(ent) || pev(entPEV_NADE_TYPE) != NADE_TYPE_FLARE)
                 continue;

                 
fm_set_rendering(entkRenderFxGlowShellg_Color[id]{0}, g_Color[id]{1}, g_Color[id]{2}, kRenderNormal16);  
            } 
        
printf(idBLUE"^x04 ZP |^x01 You have changed your color light to^x03 blue^x01!")
        }          
    }  



zmd94 11-29-2015 22:18

Re: change this stock
 
PHP Code:

public changecolor(id)   
{       
    
    
ColorOption[id]++
    
ColorOption[id] %= 4
    
    
switch(ColorOption[id]) 
    { 
        case 
0// white  
        
{  
            
g_Color[id]{0} = 255 // r  
            
g_Color[id]{1} = 255 // g  
            
g_Color[id]{2} = 255 // b 
            
            
printf(idGRAY"^x04 ZP |^x01 You have changed your color light to^x03 white^x01!")
        }   
        case 
1// red  
        
{       
            
g_Color[id]{0} = random_num(50,255// r  
            
g_Color[id]{1} = // g  
            
g_Color[id]{2} = // b 
            
            
printf(idRED"^x04 ZP |^x01 You have changed your color light to^x03 red^x01!")
        }  
        case 
2// green  
        
{  
            
g_Color[id]{0} = // r  
            
g_Color[id]{1} = random_num(50,255// g  
            
g_Color[id]{2} = // b 
            
            
printf(idGREEN"^x04 ZP |^x01 You have changed your color light to^x04 green^x01!")
        }  
        case 
3// blue 
        
{  
            
g_Color[id]{0} = // r  
            
g_Color[id]{1} = // g  
            
g_Color[id]{2} = random_num(50,255// b 
            
            
printf(idBLUE"^x04 ZP |^x01 You have changed your color light to^x03 blue^x01!")
        }
    }
        
    new 
ent = -1
    
while((ent engfunc(EngFunc_FindEntityByStringent"classname""grenade")) != 0)
    {
        if (!
is_valid_ent(ent) || pev(entPEV_NADE_TYPE) != NADE_TYPE_FLARE)
            continue;

        
fm_set_rendering(entkRenderFxGlowShellg_Color[id]{0}, g_Color[id]{1}, g_Color[id]{2}, kRenderNormal16);  
    }



fysiks 11-30-2015 00:48

Re: change this stock
 
Quote:

Originally Posted by zmd94 (Post 2367573)
PHP Code:

// code 


Don't just post code. Use your words and explain what you did.


All times are GMT -4. The time now is 17:55.

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