Raised This Month: $ Target: $400
 0% 

[Help] How to change trail color every 1 second


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ReneF
Junior Member
Join Date: Oct 2014
Location: In the world
Old 10-29-2014 , 16:23   [Help] How to change trail color every 1 second
Reply With Quote #1

I need the trail changes color every 1 second, whether you are walking, running, moving from side to side, jumping, etc...

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.0"

#define TASKID        81732519124

#define TRAIL_ACTIVE 1
#define TRAIL_INACTIVE 0
#define TRAIL_LIFE 30
#define ACCES_FLAG  ADMIN_BAN

new gTrailSprite;
new 
gTrailRandomColor33 ][ ];
new 
bPlayerTrailStatus33 ];
new 
Float:bflNextCheck33 ];
new const 
gTrailSpriteIndex[] = "sprites/zbeam3.spr";

const 
IN_MOVING IN_FORWARD IN_BACK IN_LEFT IN_RIGHT IN_JUMP;

public 
plugin_init()

    
register_plugin"Owner Trail"PLUGIN_VERSION"tuty" );  
    
register_forwardFM_CmdStart"forward_cmdstart" );
    
register_clcmd"say /trail""cmdMakeOwnerTrail" ); 
    
register_clcmd"say_team /trail""cmdMakeOwnerTrail" );
    
    
RegisterHam(Ham_Spawn"player""Fwd_Spawn"1);
}

public 
plugin_precache()

    
gTrailSprite precache_modelgTrailSpriteIndex );
}

public 
client_connectid )

    
bPlayerTrailStatusid ] = TRAIL_INACTIVE;
}

public 
Fwd_Spawn(id)
{
    if(
get_user_flags(id) & ACCES_FLAG)
    {
        
bPlayerTrailStatus[id] = TRAIL_ACTIVE;
        
        
gTrailRandomColorid ][ ] = random_num0255 );  
        
gTrailRandomColorid ][ ] = random_num0255 );  
        
gTrailRandomColorid ][ ] = random_num0255 );
        
        
set_task(10.0"change_color"id TASKID, .flags="b");
    }
}

public 
change_color(taskid)
{
    new 
id taskid TASKID;
    
    if(!
is_user_alive(id))
    {
        
remove_task(taskid);
        return;
    }
    
    
gTrailRandomColorid ][ ] = random_num0255 );  
    
gTrailRandomColorid ][ ] = random_num0255 );  
    
gTrailRandomColorid ][ ] = random_num0255 );    
}

public 
cmdMakeOwnerTrailid )

    if( !
is_user_aliveid ) )
    {  
        
client_printidprint_center"No puedes utilizar este comando estando muerto" );  
        return 
PLUGIN_HANDLED
    }  
    if( !( 
get_user_flagsid ) & ACCES_FLAG ) )
    {  
        
client_printidprint_center"No tienes acceso" );   
        return 
PLUGIN_HANDLED
    } 
    
    if( 
bPlayerTrailStatusid ] == TRAIL_ACTIVE )
    {  
        
        
client_printidprint_center"Trail desactivado" );  
        
        
bPlayerTrailStatusid ] = TRAIL_INACTIVE;  
        
        
UTIL_KillBeamFollowid );  
        
        
bflNextCheckid ] = -5000.0;    
        
        return 
PLUGIN_HANDLED
    }  
    
    if( 
bPlayerTrailStatusid ] == TRAIL_INACTIVE 
    {  
        
client_printidprint_center"Trail activado" );  
        
        
bPlayerTrailStatusid ] = TRAIL_ACTIVE;    
        
        
gTrailRandomColorid ][ ] = random_num0255 );  
        
gTrailRandomColorid ][ ] = random_num0255 );  
        
gTrailRandomColorid ][ ] = random_num0255 );    
        
        return 
PLUGIN_HANDLED
    }  
    
    return 
PLUGIN_CONTINUE;
}

public 
forward_cmdstartidhandle )

    if( !
is_user_aliveid ) || bPlayerTrailStatusid ] == TRAIL_INACTIVE 
    {  
        return 
FMRES_IGNORED
    } 
    
    new 
iButton get_uchandleUC_Buttons ); 
    
    if( !( 
iButton IN_MOVING ) ) 
    {
        new 
Float:flGameTime get_gametime();   
        if( 
bflNextCheckid ] < flGameTime )
        {   
            
UTIL_KillBeamFollowid );   
            
UTIL_BeamFollowid );
            
bflNextCheckid ] = flGameTime + ( TRAIL_LIFE );  
        } 
    }  
    
    return 
FMRES_IGNORED;
}  

stock UTIL_BeamFollow( const iClient )
{
    
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 
    
write_byteTE_BEAMFOLLOW ); 
    
write_shortiClient );
    
write_shortgTrailSprite ); 
    
write_byteTRAIL_LIFE );
    
write_byte20 ); 
    
write_bytegTrailRandomColoriClient ][ ] ); 
    
write_bytegTrailRandomColoriClient ][ ] ); 
    
write_bytegTrailRandomColoriClient ][ ] ); 
    
write_byte255 ); 
    
message_end();
}
    
stock UTIL_KillBeamFollow( const iClient )

    
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 
    
write_byteTE_KILLBEAM );     
    
write_shortiClient ); 
    
message_end();

Sorry for bad english
ReneF is offline
 


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 17:31.


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