Player respawn event, I'm looking for a way to do this.
Ive tried:
Code:
register_event("ResetHUD","re_spawn","b")
but it doesn't seem to work all the time.
Maybe I'm doing something wrong, here is the whole plug-in (v0.16):
Code:
#include <amxmodx>
#include <fun>
//--------------------------------------------------------------------------//
public plugin_init() {
register_plugin("Spawn Protection","0.1","Haircut")
register_cvar("amx_god","1")
register_cvar("amx_godtime","5")
register_event("ResetHUD","re_spawn","b")
}
public client_disconnect (id) {
if (task_exists(id))
remove_task(id)
return PLUGIN_CONTINUE
}
//--------------------------------------------------------------------------//
public re_spawn(id) {
if (!(get_cvar_num("amx_god") == 1))
return PLUGIN_CONTINUE
set_user_godmode(id, 1)
new Float:protect_time = get_cvar_float("amx_godtime")
set_hudmessage( 255, 0, 0, -1.0, 0.4, 0, 6.0, protect_time, 0.5, 1.5, 2 )
show_hudmessage(id, "SPAWN PROTECTION IS ENABLED FOR %.0f SECONDS", protect_time)
set_task(protect_time, "god_off", id)
return PLUGIN_CONTINUE
}
//--------------------------------------------------------------------------//
public god_off(id) {
set_user_godmode(id)
return PLUGIN_CONTINUE
}
__________________