I deceided to make this pluging simpler by just changing the speed of the player when he reaches a certain amount of HP for a certain amount of time.
here is the coding:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
public plugin_init() {
register_plugin("Stimpack", "1", "|GGW| Meta")
// Cvars
register_cvar("Stimpack_Health","15") //Defines at how much hp the plugin should start
register_cvar("Stimpack_time", "15") //Defines for how long the buzz should last
register_cvar("Stimpack","1")//enable or disable
register_cvar("Stimpack_speed","400")
register_cvar("NormalSpeed","0")
// Events
register_event("Damage","Damage_event","b")
register_event("DeathMsg","Reset","a")
}
public plugin_precache() {
precache_sound("misc/tmaSti01.wav")
return PLUGIN_CONTINUE
}
public Damage_event(id){
if (get_cvar_num("Stimpack") == 0)
return PLUGIN_HANDLED
if (!is_user_alive(id))
return PLUGIN_HANDLED
}else{
new n_speed = get_user_maxspeed(id)
new health = get_user_health(id)
new low_health = get_cvar_num("Stimpack_Health")
new speed = get_cvar_num("Stimpack_speed")
new timer = get_cvar_num("Stimpack_time")
if (health <= low_health){
set_cvar_num("NormalSpeed", n_speed)
client_print(id,print_chat,"Low Health Detected | Stimpack Administered! Awwww yeah")
set_user_maxspeed(id, speed)
client_cmd(id,"spk misc/tmaSti01.wav")
set_task(timer,"Stimpack_Reset")
}
return PLUGIN_CONTINUE
}
public Stimpack_Reset(id)
{
new n_speed2 = get_cvar_num("NormalSpeed")
set_user_maxspeed(id, n_speed2)
client_print(id,print_chat,"Stimpack effect has faded.")
return PLUGIN_CONTINUE
}
I get these errors when I try to compile:
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(30) : warning 209: function "Damage_event" should return a value
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(30) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(37) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(44) : error 010: invalid function or declaration
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(50) : warning 213: tag mismatch
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "health"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "low_health"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "n_speed"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "speed"
/home/groups/amxmodx/tmp3/phpH2eYMc.sma(55) : warning 203: symbol is never used: "timer"
Help?
__________________