|
Veteran Member
Join Date: Oct 2013
Location: Serbia
|
03-15-2019
, 09:59
Re: A specific effect when the player moves/standing
|
#7
|
Quote:
Originally Posted by Moody92
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_fOrigins[ MAX_PLAYERS + 1 ][ Origins ][ 3 ];
public plugin_init()
{
register_plugin( "Glowing moving players" , Version , "bugsy" );
register_forward( FM_CmdStart , "fw_FMCmdStart" );
}
public client_disconnect( id )
{
g_IsMoving &= ~( 1 << id );
}
public fw_FMCmdStart( id , handle , seed )
{
static Float:fVelocity[ 3 ];
if ( get_uc( handle , UC_Buttons ) & ButtonBits )
{
pev( id , pev_velocity , fVelocity );
if ( !( g_IsMoving & ( 1 << id ) ) )
{
if ( vector_length( fVelocity ) )
{
client_started_moving( id );
}
}
else if ( !vector_length( fVelocity ) )
{
client_stopped_moving( id );
}
}
else if ( g_IsMoving & ( 1 << id ) )
{
client_stopped_moving( id );
}
}
public client_started_moving( id )
{
g_IsMoving |= ( 1 << id );
pev( id , pev_origin , g_fOrigins[ id ][ StartOrigin ] );
set_user_rendering(id, kRenderFxGlowShell, random_num(0,255), random_num(0,255), random_num(0,255), kRenderNormal, random_num(0,255))
}
public client_stopped_moving( id )
{
g_IsMoving &= ~( 1 << id );
pev( id , pev_origin , g_fOrigins[ id ][ EndOrigin ] );
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 16);
}
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.
__________________
|
|
|
|