| 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 pGlow, pHeal
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) 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(id, 255,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), parm, 2) 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(id, 255, 255, 255) new i_heal = 5 if(health<=100-i_heal) set_user_health(id, health + i_heal) else { set_user_health(id, 100) user_unglow(id) return PLUGIN_HANDLED } parm[1] += i_heal set_task(0.1, "healing", healingid(id), parm, 2) } else user_unglow(id) return PLUGIN_HANDLED }
public user_glow(id, red, green, blue) { if(is_user_alive(id) && get_pcvar_num(pGlow)) set_user_rendering(id, kRenderFxGlowShell, red, green, blue, kRenderNormal,25) }
public user_unglow(id) { if(id>32) id-=33 user_glow(id, 0,0,0) }
|