AlliedModders

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

Napoleon_be 05-11-2013 08:11

Freeze Players
 
PHP Code:

for(new icounti++) {
        
set_user_maxspeed(players[i], -1.0)
        
set_task(11.0"RemoveFreeze"players[i])
    } 

What i'm trying to do is freeze the players, but it ain't working... I just keep frozen after those 11 seconds...
PHP Code:

public RemoveFreeze(id) {
    if(
is_user_alive(id)) {
        
set_user_maxspeed(id)
    }



hornet 05-11-2013 08:17

Re: Freeze Players
 
Use FL_FROZEN with pev_flags.

EpicMonkey 05-11-2013 08:18

Re: Freeze Players
 
There are better ways for freezing a player, Take a look at: https://forums.alliedmods.net/showthread.php?p=1262605

Napoleon_be 05-11-2013 08:23

Re: Freeze Players
 
how to unfreeze using set_pev?

hornet 05-11-2013 08:30

Re: Freeze Players
 
Freeze:
Code:

set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FROZEN );
Unfreeze:
Code:

set_pev( id, pev_flags, pev( id, pev_flags ) & ~FL_FROZEN );

Napoleon_be 05-11-2013 08:32

Re: Freeze Players
 
Quote:

Originally Posted by hornet (Post 1949862)
Freeze:
Code:

set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FROZEN );
Unfreeze:
Code:

set_pev( id, pev_flags, pev( id, pev_flags ) & ~FL_FROZEN );

Thanks, will try it :)

Napoleon_be 05-11-2013 08:39

Re: Freeze Players
 
still doesn't work....

PHP Code:

public Cmdround(id)
{
    if (
task_exists(TASKID))
        
remove_task(TASKID)
    
    
set_hudmessage(25500, -1.00.000.114.00.11.01)
    
show_hudmessage(0"[HideNseeK]")
    
    
Timer 10
    set_task
(1.0"Cmdcountdown"TASKID__"a"Timer)
    
    new 
players[32], count
    get_players
(playerscount"ae""CT")
    
    for(new 
icounti++) {
        
set_pev(idpev_flagspev(ipev_flags) | FL_FROZEN
        
set_task(11.0"RemoveFreeze"players[i])
    }
    
    
get_players(playerscount"ae""TERRORIST")
    
    for(new 
icounti++) {
        
strip_user_weapons(players[i])
    }
}

public 
Cmdcountdown(id)
{
    
Timer--
    
    if (
Timer 0)
    {
        
set_hudmessage(255255255, -1.00.0300.11.00.10.12)
        
show_hudmessage(0"%i"Timer)
    }
    else
    {
        
set_hudmessage(255255255, -1.00.0300.13.00.11.03)
        
show_hudmessage(0"Ready or not, here we come!")
        new 
players[32], count
        get_players
(playerscount"ae""CT")
        
        for(new 
icounti++) {
            
set_task(2.0"StripWeapons"players[i])
        }
    }
}

public 
RemoveFreeze(id) {
    if(
is_user_alive(id)) {
        
set_pev(idpev_flagspev(idpev_flags) & ~FL_FROZEN)
    }


PHP Code:

register_logevent("Cmdround"2"1=Round_Start"


Blizzard_87 05-11-2013 09:05

Re: Freeze Players
 
Code:
public Cmdround(id) {     if (task_exists(TASKID))         remove_task(TASKID)         set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 0.1, 14.0, 0.1, 1.0, 1)     show_hudmessage(0, "[HideNseeK]")         Timer = 10     set_task(1.0, "Cmdcountdown", TASKID, _, _, "a", Timer)         new players[32], count     get_players(players, count, "ae", "CT")         for(new i; i < count; i++) {         set_pev(players[ i ], pev_flags, pev(i, pev_flags) | FL_FROZEN) // you still had id here instead of players[ i ]         set_task(11.0, "RemoveFreeze", players[i])     }         get_players(players, count, "ae", "TERRORIST")         for(new i; i < count; i++) {         strip_user_weapons(players[i])     } } public Cmdcountdown(id) {     Timer--         if (Timer > 0)     {         set_hudmessage(255, 255, 255, -1.0, 0.03, 0, 0.1, 1.0, 0.1, 0.1, 2)         show_hudmessage(0, "%i", Timer)     }     else     {         set_hudmessage(255, 255, 255, -1.0, 0.03, 0, 0.1, 3.0, 0.1, 1.0, 3)         show_hudmessage(0, "Ready or not, here we come!")         new players[32], count         get_players(players, count, "ae", "CT")                 for(new i; i < count; i++) {             set_task(2.0, "StripWeapons", players[i])         }     } } public RemoveFreeze(id) {     if(is_user_alive(id)) {         set_pev(id, pev_flags, pev(id, pev_flags) & ~FL_FROZEN)     } }

ConnorMcLeod 05-11-2013 09:07

Re: Freeze Players
 
Quote:

Originally Posted by Napoleon_be (Post 1949870)
still doesn't work....

Wow, you still don't know how to use get_players :nono:

hornet 05-11-2013 09:08

Re: Freeze Players
 
-.^ Whats this:
Code:
set_pev(id, pev_flags, pev(i, pev_flags) | FL_FROZEN)
You didn't use the players array :nono:


All times are GMT -4. The time now is 16:14.

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