Quote:
Originally Posted by EvoLutionCRO
Check if user isn't moving
Is there any way to trigger event if user hadn't moved (Jumped, ducked, went forward, backward, left or right) for 5 seconds and then trigger other event if user moves again (Note: camera moving doesn't affect events)
|
Search for the plugin BAD CAMPER For Checking NO Movement..
Plus I had this code You can use it if it looks useful to you
PHP Code:
public FM_CmdStart_Pre( plr, uc_handle )
{
static bool:wasOnGround[33], bool:wasDuckingBeforeFalling[33];
static button, oldButtons, flags;
//button = pev( plr, pev_button );
button = get_uc( uc_handle , UC_Buttons );
oldButtons = pev( plr, pev_oldbuttons );
flags = pev( plr, pev_flags );
if( wasOnGround[plr] && !( flags & FL_ONGROUND ) )
{
wasDuckingBeforeFalling[plr] = bool:!!( oldButtons & IN_DUCK );
}
else if( wasDuckingBeforeFalling[plr] && wasOnGround[plr] && flags & FL_ONGROUND )
{
wasDuckingBeforeFalling[plr] = false;
}
if( button & IN_JUMP && !( oldButtons & IN_JUMP ) )
{
if( wasOnGround[plr] )
{
// detecting normal jumps
++g_iJumps[plr];
if(g_iJumps[plr]%3==0)
{
colored_print(0, "^x04 Yeah Baby !! ^x03 You got 1 point for perfect jump :D");
}
}
else
{
// detecting bhops
static Float:velocity[3];
pev( plr, pev_velocity, velocity );
if( !velocity[2] )
{
colored_print(0, "^x04 Whoaaa Pro !! ^x03 You got 2 point for Bhop jump :P");
if( button & IN_DUCK )
{
// detecting duckbhops
colored_print(plr, "^x04 PURE SKILL !! ^x03 You got 3 points for Perfect Duck Bhop xD ");
}
}
}
}
else if( button & IN_DUCK )
{
if( oldButtons & IN_DUCK )
{
if( !wasDuckingBeforeFalling[plr] && !wasOnGround[plr] && flags & FL_ONGROUND )
{
// detecting jumps or any cases where the user ducks in the air but does not release it on ground
colored_print(plr, "^x04 GODLIKE !! ^x03 You got 4 points for Weird Duck Bhop");
}
}
else
{
if( wasOnGround[plr] )
{
// detecting normal ducks
++g_iDucks[plr];
if(g_iDucks[plr]%3==0)
{
colored_print(plr, "^x04 Dont Keep Ducking Idiot :/");
}
}
}
}
wasOnGround[plr] = bool:!!( flags & FL_ONGROUND );
}
Use Colored_print Stock by Mercyless Or Just Remove those print commands.
__________________