AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stop players and 15 seconds to resume (https://forums.alliedmods.net/showthread.php?t=244954)

Administrator 07-26-2014 07:27

Stop players and 15 seconds to resume
 
Hi.
Prompt why players do not stop?

PHP Code:

new g_Timer 15 

PHP Code:

public plugin_init()
{
set_task(15.5"frozen")


PHP Code:

public frozen()
{
g_Timer -= 1
new g_Tume g_Timer -= 1
if(g_Tume >= 1)
{
set_hudmessage(25500, -1.0, -1.006.01.0)
show_hudmessage(0"You will be able to move after: %d"g_Tume)
set_task(1.0"frozen")
set_user_maxspeed(00.0)
}
else
{
un_frozen()
}
}

public 
un_frozen()
{
set_user_maxspeed(0300.0)
client_print(0print_chat,"unfrozen")



HamletEagle 07-26-2014 08:23

Re: Stop players and 15 seconds to resume
 
You can use this to freeze players:

PHP Code:

UTIL_FreezePlayer index value 
{
    if (!
is_user_alive(id))
    {
        return;
    }
    
    new 
Flags pev(index pev_flags);
    
    if (
value && !(Flags FL_FROZEN))
    {
        
set_pev(indexpev_flags, (Flags FL_FROZEN));
    }        
    
    else if (!
value && (Flags FL_FROZEN))
    {
        
set_pev(indexpev_flags, (Flags &~ FL_FROZEN));
    }


UTIL_FreezePlayer(id , 1) freeze a player. UTIL_FreezePlayer(id, 0) unfreeze it.

About your code, set the speed to 0.1 if you want to stop them from moving. Setting to 0.0 let them move normally.

Administrator 07-26-2014 08:30

Re: Stop players and 15 seconds to resume
 
Thanks!


All times are GMT -4. The time now is 13:09.

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