im starting to think that this isn't possible =\ when you join spec, you'll definately be killed so hooking DeathMsg event to check if player was still alive before he joins spectator is kinda pointless cause it will always return false there..
Code:
#include <amxmodx>
#include <fakemeta>
new bool:g_bAlive[33]
public plugin_init()
{
register_plugin("Bad Frag for Evader", "0.1", "Me")
register_event("TeamInfo", "Event_JoinTeam", "a")
register_event("DeathMsg", "Event_Death", "a")
register_event("ResetHUD", "Event_ResetHud", "b")
}
public client_disconnect(id)
{
if(!is_user_bot(id))
{
g_bAlive[id] = false
log_to_file("evade.log", "client_disconnect: %s", g_bAlive[id] ? "true" : "false")
}
}
public Event_ResetHud(id)
{
if(!is_user_bot(id))
{
g_bAlive[id] = bool:(is_user_alive(id))
log_to_file("evade.log", "Event_ResetHud: %s", g_bAlive[id] ? "true" : "false")
}
}
public Event_Death()
{
new id = read_data(2)
if(!is_user_bot(id))
{
g_bAlive[id] = bool:(is_user_alive(id))
log_to_file("evade.log", "Event_Death: %s", g_bAlive[id] ? "true" : "false")
}
}
public Event_JoinTeam()
{
new id = read_data(1)
static user_team[32]
read_data(2, user_team, charsmax(user_team))
if(user_team[0] == 'S' && g_bAlive[id])
{
g_bAlive[id] = false
log_to_file("evade.log", "Entered spec")
}
return PLUGIN_CONTINUE;
}
evade.log
Code:
L 01/07/2009 - 01:21:29: Log file started (file "cstrike\addons\amxmodx\logs\evade.log") (game "cstrike") (amx "1.8.0.3660")
L 01/07/2009 - 01:21:29: Event_ResetHud: false
L 01/07/2009 - 01:21:32: Event_ResetHud: true
L 01/07/2009 - 01:21:40: Event_ResetHud: true
L 01/07/2009 - 01:21:54: Event_Death: false
L 01/07/2009 - 01:22:04: client_disconnect: false
any more ideas?