Quote:
Originally Posted by lolzin123
How i freeze the player per 10 seconds...
OBS: If the player stwich the weapon your maxspeed is set to default.
|
This method is not using maxspeed so it doesn't matter if maxspeed is reset @ CurWeapon.
Quote:
Originally Posted by lolzin123
I have tryed with this code:
PHP Code:
set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FROZEN ); + set_task()
To remove: set_pev( id, pev_flags, pev( id, pev_flags ) & ~FL_FROZEN );
|
This will work, see below.
Quote:
Originally Posted by lolzin123
But if the player are walking and this code are in action the screen of player bug.
Any other code without CurWeapon?
OBS: this code are used at blocks, like bm.
|
I assume you are referring to the screen shaking if you apply FL_FROZEN while the player is moving? If so this can be solved by zeroing the players velocity before freezing.
PHP Code:
const Float: g_fFreezeSeconds = 10.0;
new bool: g_bFrozen[ 33 ];
public client_disconnect( id )
{
//Just in case player disconnects while frozen.
g_bFrozen[ id ] = false;
}
public FreezePlayer( id )
{
if ( !is_user_connected( id ) )
return PLUGIN_HANDLED;
if ( !g_bFrozen[ id ] )
{
set_pev( id , pev_velocity , { 0.0 , 0.0 , 0.0 } );
set_pev( id , pev_flags , pev( id , pev_flags ) | FL_FROZEN );
set_task( g_fFreezeSeconds , "fn_Freeze" , id );
}
else
{
set_pev( id , pev_flags , pev( id , pev_flags ) & ~FL_FROZEN );
}
client_print( id , print_chat , "* You are %s frozen!" , g_bFrozen[ id ] ? "no longer" : "now" );
g_bFrozen[ id ] = !g_bFrozen[ id ];
return PLUGIN_HANDLED;
}
__________________