Couple errors I noticed:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
// 2 cells, 1 is for team T, the other is for team CT
new g_iLastDead[2]
public plugin_init()
{
// register plugin
register_plugin("Revive Last","1.0","Hawk552")
// this is the command to revive the last dead player
register_clcmd("amx_revive_last","fnReviveLast")
// Register the death event
register_event("DeathMsg","fnEventDeathMsg","a")
// Register the events where the round ends, to make sure it's zeroed
register_logevent("fnLogEventRoundEnd",2,"1=Round_End")
register_logevent("fnLogEventRoundEnd",2,"1&Restart_Round_")
}
// amx_revive_last command
public fnReviveLast(id)
{
// get the person's team
new iTeam = get_user_team(id)
// check if anyone on the team is dead
if(g_iLastDead[iTeam-1])
{
// if so, spawn that last dead person
cs_user_spawn(g_iLastDead[iTeam - 1])
// they aren't dead now, are they?
g_iLastDead[iTeam - 1] = 0
}
}
// set the last dead, when they die
public fnEventDeathMsg()
g_iLastDead[get_user_team(read_data(2)) - 1] = read_data(2)
// zero out the things when round ends
public fnLogEventRoundEnd()
{
g_iLastDead[0] = 0
g_iLastDead[1] = 0
}
__________________