AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Freeze Code (https://forums.alliedmods.net/showthread.php?t=99902)

lolzin123 08-10-2009 14:42

Freeze Code
 
How i freeze the player per 10 seconds...

OBS: If the player stwich the weapon your maxspeed is set to default.

I have tryed with this code:
PHP Code:

 set_pevidpev_flagspevidpev_flags ) | FL_FROZEN ); + set_task()

To removeset_pevidpev_flagspevidpev_flags ) & ~FL_FROZEN ); 

But if the player are walking and this code are in action the screen of player bug.

Any other code without CurWeapon? :D

OBS: this code are used at blocks, like bm.

AntiBots 08-10-2009 17:04

Re: Freeze Code
 
Show the code. That have to work perfect.

One 08-10-2009 18:20

Re: Freeze Code
 
try to use set_task. like

set_task(1.0,"my_timer")

public my_timer()
{
the_time++
if(the_time < 10)
set_user_maxspeed(id,0)
else
set_user_maxspeed(id,320)
}
somthing like this

fysiks 08-10-2009 21:03

Re: Freeze Code
 
Afaik, you shouldn't be setting the FL_FROZEN flag in CurWeapon

Bugsy 08-10-2009 21:43

Re: Freeze Code
 
Quote:

Originally Posted by lolzin123 (Post 895489)
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 (Post 895489)
I have tryed with this code:
PHP Code:

 set_pevidpev_flagspevidpev_flags ) | FL_FROZEN ); + set_task()

To removeset_pevidpev_flagspevidpev_flags ) & ~FL_FROZEN ); 


This will work, see below.

Quote:

Originally Posted by lolzin123 (Post 895489)
But if the player are walking and this code are in action the screen of player bug.

Any other code without CurWeapon? :D

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 Floatg_fFreezeSeconds 10.0;
new 
boolg_bFrozen33 ];

public 
client_disconnectid )
{
    
//Just in case player disconnects while frozen.
    
g_bFrozenid ] = false;
}

public 
FreezePlayerid )
{
    if ( !
is_user_connectedid ) )
        return 
PLUGIN_HANDLED;

    if ( !
g_bFrozenid ] )
    {
        
set_pevid pev_velocity , { 0.0 0.0 0.0 } );
        
set_pevid pev_flags pevid pev_flags ) | FL_FROZEN ); 

        
set_taskg_fFreezeSeconds "fn_Freeze" id );
    }
    else
    {
        
set_pevid pev_flags pevid pev_flags ) & ~FL_FROZEN ); 
    }
    
    
client_printid print_chat "* You are %s frozen!" g_bFrozenid ] ? "no longer" "now" );
    
    
g_bFrozenid ] = !g_bFrozenid ];

    return 
PLUGIN_HANDLED;




All times are GMT -4. The time now is 18:31.

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