AlliedModders

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

BudaB 06-16-2011 11:53

freeze
 
How to freeze some players like for 5 seconds if FREEZE = TRUE?

BudaB 06-16-2011 15:56

Re: freeze
 
Would this

Code:

new bool:kazkas
 
if(kazkas)
{
    if(cs_get_user_team(id) == CS_TEAM_T)
        set_user_maxspeed(id, 0.1)
 
    set_task(5.0, "kazkas1", id)
}
 
public kazkas1
{
set_user_maxspeed(id, 250.0)
}

or this


Code:

new bool:kazkas
 
if(kazkas)
{
    if(cs_get_user_team(id) == CS_TEAM_T)
        set_pev(id, pev_flags, (pev(id, pev_flags) | FL_FROZEN));
 
    set_task(5.0, "kazkas1", id)
}
 
public kazkas1
{
set_pev(id, pev_flags, (pev(id, pev_flags) & ~FL_FROZEN));
}

codes might work?

ARES[ro] 06-16-2011 16:22

Re: freeze
 
PHP Code:

// no need for the bool with my example that was based on your code ... new bool:kazkas ... to use bool dont even use tasks, only forwards
#define TASK_kazkas 1000

[...]

public 
set_kazkas(idFloat:time)
{
    if(
cs_get_user_team(id) == CS_TEAM_T)
        
set_pev(idpev_flags, (pev(idpev_flags) | FL_FROZEN))  
    if(!
task_exists(TASK_kazkas id))
        
remove_task(TASK_kazkas id)
    
set_task(time"func_task_kazkas"TASK_kazkas id)
}

public 
func_task_kazkas(taskid)
{
    new 
id taskid TASK_kazkas1
    set_pev
(idpev_flags, (pev(idpev_flags) ^ FL_FROZEN))
    
// ^ is exclusive or, and its used in assembly to clear out a number of bits and making them 0 no matter what their value is


PHP Code:

//To verify if player is frozen just do this:
if(pev(idpev_flags) == pev(idpev_flags) & FL_FROZEN)
    [...] 


BudaB 06-17-2011 07:55

Re: freeze
 
Code does not work.

!Morte 06-17-2011 11:37

Re: freeze
 
PHP Code:

#include <amxmodx>
#include <fun>

const TASK_UNFREEZE 1589;

#define NORMAL_VELOCITY        240.0
#define FROZEN_VELOCITY        0.1

#define ID_UNFREEZE ( taskid - TASK_UNFREEZE )

new g_frozen[33]

public 
plugin_init()
{
    
register_plugin("Freeze test""9651854.1654""Me :D")
    
    
register_clcmd("say frozen""clcmd_frozenme")
}

public 
clcmd_frozenme(id)
{
    if(!
is_user_alive(id) || g_frozen[id] || task_exists(id+TASK_UNFREEZE))
        return;
        
    
g_frozen[id] = 1
    
    set_user_maxspeed
(idFROZEN_VELOCITY)
    
    
client_print(idprint_chat"FREEZE!")
    
    
set_task(4.0"remove_freeze"id+TASK_UNFREEZE)
}

public 
remove_freeze(taskid)
{
    
g_frozen[ID_UNFREEZE] = 0
    set_user_maxspeed
(ID_UNFREEZENORMAL_VELOCITY)



drekes 06-17-2011 12:03

Re: freeze
 
You can check this plugin: http://forums.alliedmods.net/showthread.php?t=134516


All times are GMT -4. The time now is 23:32.

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