AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   A specific effect when the player moves/standing (https://forums.alliedmods.net/showthread.php?t=314935)

Krtola 03-14-2019 08:05

A specific effect when the player moves/standing
 
I want to set a certain effect when the player moves and also when they are not moving.

For example,if player move they will have glow effect.
If player not moving that glow effect will disappear.

Any help is welcome.
Thanks in advance.

HamletEagle 03-14-2019 08:08

Re: A specific effect when the player moves/standing
 
Constantly check if the player is moving(his speed is not 0). If he is, apply glow, else remove glow.

Krtola 03-14-2019 08:37

Re: A specific effect when the player moves/standing
 
Quote:

Originally Posted by HamletEagle (Post 2643241)
Constantly check if the player is moving(his speed is not 0). If he is, apply glow, else remove glow.

Can u wryte code please?

Moody92 03-14-2019 09:28

Re: A specific effect when the player moves/standing
 
Quote:

Originally Posted by SonicSonedit (Post 1461221)
In your case, yes.
PHP Code:

static Float:Velocity[3], i pev(idpev_velocityVelocity) if (Velocity[0] > 0.0 || Velocity[1] > 0.0 || Velocity[2] > 0.0

Use static: the differance between new and static is that static variables are not allocated (destroyed&re-created) each time function is called, and prethink is called goddamn pretty often. You can also check some KZ & Deathrun plugins, they are really good examples.

I can't code now but here this might help.

OciXCrom 03-14-2019 10:49

Re: A specific effect when the player moves/standing
 
If he wanted to know how to code, he would have posted in the Scripting Help section.

Moody92 03-15-2019 05:17

Re: A specific effect when the player moves/standing
 
Quote:

Originally Posted by OciXCrom (Post 2643264)
If he wanted to know how to code, he would have posted in the Scripting Help section.

He was general in his request if you re-read it.

PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <fun>

new const Version[] = "0.1"

//Delete the below line if compiler throws error: Error: Invalid symbol name "" on line 6 
const MAX_PLAYERS 32

const 
ButtonBits = ( IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT IN_JUMP ); 

enum Origins 

    
StartOrigin
    
EndOrigin 
}; 

new 
g_IsMoving
new 
Float:g_fOriginsMAX_PLAYERS ][ Origins ][ ]; 

public 
plugin_init()  

    
register_plugin"Glowing moving players" Version "bugsy" ); 
     
    
register_forwardFM_CmdStart "fw_FMCmdStart" ); 


public 
client_disconnectid 

    
g_IsMoving &= ~( << id ); 


public 
fw_FMCmdStartid handle seed 

    static 
Float:fVelocity]; 
     
    if ( 
get_uchandle UC_Buttons ) & ButtonBits 
    { 
        
pevid pev_velocity fVelocity ); 
         
        if ( !( 
g_IsMoving & ( << id ) ) ) 
        { 
            if ( 
vector_lengthfVelocity ) ) 
            { 
                
client_started_movingid ); 
            } 
        } 
        else if ( !
vector_lengthfVelocity ) ) 
        { 
            
client_stopped_movingid ); 
        } 
    } 
    else if ( 
g_IsMoving & ( << id ) ) 
    { 
        
client_stopped_movingid ); 
    } 
}   

public 
client_started_movingid 

    
g_IsMoving |= ( << id ); 
    
pevid pev_origin g_fOriginsid ][ StartOrigin ] ); 
     
    
set_user_rendering(idkRenderFxGlowShellrandom_num(0,255), random_num(0,255), random_num(0,255), kRenderNormalrandom_num(0,255))


public 
client_stopped_movingid 

    
g_IsMoving &= ~( << id ); 
    
pevid pev_origin g_fOriginsid ][ EndOrigin ] ); 
         
    
set_user_rendering(idkRenderFxNone000kRenderNormal16);


From the topic I quoted in my previous post. All I did was add the rendering lines. Whenever a player moves, they're gonna have a random glow. When they stop, their glow is going to disappear.

Only downside to this is when player is falling, being slapped, etc. It's not going to be considered as movement unless they're holding their movement keys as discussed in the topic.

Krtola 03-15-2019 09:59

Re: A specific effect when the player moves/standing
 
Quote:

Originally Posted by Moody92 (Post 2643388)
He was general in his request if you re-read it.

PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <fun>

new const Version[] = "0.1"

//Delete the below line if compiler throws error: Error: Invalid symbol name "" on line 6 
const MAX_PLAYERS 32

const 
ButtonBits = ( IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT IN_JUMP ); 

enum Origins 

    
StartOrigin
    
EndOrigin 
}; 

new 
g_IsMoving
new 
Float:g_fOriginsMAX_PLAYERS ][ Origins ][ ]; 

public 
plugin_init()  

    
register_plugin"Glowing moving players" Version "bugsy" ); 
     
    
register_forwardFM_CmdStart "fw_FMCmdStart" ); 


public 
client_disconnectid 

    
g_IsMoving &= ~( << id ); 


public 
fw_FMCmdStartid handle seed 

    static 
Float:fVelocity]; 
     
    if ( 
get_uchandle UC_Buttons ) & ButtonBits 
    { 
        
pevid pev_velocity fVelocity ); 
         
        if ( !( 
g_IsMoving & ( << id ) ) ) 
        { 
            if ( 
vector_lengthfVelocity ) ) 
            { 
                
client_started_movingid ); 
            } 
        } 
        else if ( !
vector_lengthfVelocity ) ) 
        { 
            
client_stopped_movingid ); 
        } 
    } 
    else if ( 
g_IsMoving & ( << id ) ) 
    { 
        
client_stopped_movingid ); 
    } 
}   

public 
client_started_movingid 

    
g_IsMoving |= ( << id ); 
    
pevid pev_origin g_fOriginsid ][ StartOrigin ] ); 
     
    
set_user_rendering(idkRenderFxGlowShellrandom_num(0,255), random_num(0,255), random_num(0,255), kRenderNormalrandom_num(0,255))


public 
client_stopped_movingid 

    
g_IsMoving &= ~( << id ); 
    
pevid pev_origin g_fOriginsid ][ EndOrigin ] ); 
         
    
set_user_rendering(idkRenderFxNone000kRenderNormal16);


From the topic I quoted in my previous post. All I did was add the rendering lines. Whenever a player moves, they're gonna have a random glow. When they stop, their glow is going to disappear.

Only downside to this is when player is falling, being slapped, etc. It's not going to be considered as movement unless they're holding their movement keys as discussed in the topic.

Thanks a lot.
I'm just starting to think why on this site everything has to be too complicated when the help is in question.
I tested your plugin and worked fine.

HamletEagle 03-15-2019 12:25

Re: A specific effect when the player moves/standing
 
Quote:

I'm just starting to think why on this site everything has to be too complicated when the help is in question.
What was so complicated?

You requested something at: Yesterday , 07:05 AM
You got a fully working solution at: Today , 04:17 AM
Not even 24 hours.

I swear the entitlement this days is above the roof.

Krtola 03-16-2019 09:34

Re: A specific effect when the player moves/standing
 
Quote:

Originally Posted by HamletEagle (Post 2643447)
What was so complicated?

You requested something at: Yesterday , 07:05 AM
You got a fully working solution at: Today , 04:17 AM
Not even 24 hours.

I swear the entitlement this days is above the roof.

It referred to post #5

OciXCrom 03-16-2019 10:10

Re: A specific effect when the player moves/standing
 
And post #5 referred to posts #2 and #4 in YOUR favor.


All times are GMT -4. The time now is 19:32.

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