AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] Screen flash and fade colour (https://forums.alliedmods.net/showthread.php?t=152780)

natkemon 03-13-2011 20:21

[help] Screen flash and fade colour
 
I found this healing script from one of the halo Mods. Instead of the glow, how can i make it so that the screen increases red as you have been damaged and the red fades away as it increases HP?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>


#define PLUGIN "Healing"
#define VERSION "2.4"
#define AUTHOR "soccodoods"

#define healingid(%1) %1
#define unglowid(%1) %1+33

new pGlowpHeal

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("Damage""onDamage""be")
    
    
pGlow register_cvar("cod_glow""1"FCVAR_SERVER)
    
pHeal register_cvar("cod_heal""1"FCVAR_SERVER)
}

public 
onDamage(id)
{
    if(!
is_user_alive(id) || !get_pcvar_num(pHeal))
        return 
PLUGIN_HANDLED
    
    
new parm[2]
    
parm[0] = id
    parm
[1] = get_user_health(id)
    
    
user_glow(id255,0,0)
    
    if(
task_exists(unglowid(id)))
        
remove_task(unglowid(id))
    
set_task(0.5"user_unglow"unglowid(id))
    
    if(
task_exists(healingid(id)))
        
remove_task(healingid(id))
    
set_task(5.0"healing"healingid(id), parm2)
    
    return 
PLUGIN_HANDLED
}

public 
healing(parm[])
{    
    new 
id parm[0]
    if(!
is_user_alive(id) || !get_pcvar_num(pHeal))
    {
        
user_unglow(id)
        return 
PLUGIN_HANDLED
    
}
    
    new 
init_health parm[1]
    new 
health get_user_health(id)
    if(
health == init_health && health 100)
    {
        
user_glow(id255255255)
        new 
i_heal 5
        
if(health<=100-i_heal)
            
set_user_health(idhealth i_heal)
        
        else
        {
            
set_user_health(id100)
            
user_unglow(id)
            return 
PLUGIN_HANDLED
            
        
}
        
parm[1] += i_heal
        set_task
(0.1"healing"healingid(id), parm2)
    }
    else
        
user_unglow(id)
    
    return 
PLUGIN_HANDLED
}

public 
user_glow(idredgreenblue)
{
    if(
is_user_alive(id) && get_pcvar_num(pGlow))
        
set_user_rendering(idkRenderFxGlowShellredgreenbluekRenderNormal,25)
}    

public 
user_unglow(id)
{    
    if(
id>32)
        
id-=33
    user_glow
(id0,0,0)




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

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