Hello. I'm trying to create a plugin that will manually spawn a player.
I have a script installed on my server which does an auto-respawn when the player dies, but when playing a map like surf_egypt and someone presses the "kill afk" button, the players that die dont automatically respawn.
here is my script currently
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
public plugin_init()
{
register_plugin("amx_spawn","1.6","Spawn a player plugin")
register_concmd("amx_spawn","admin_spawn",ADMIN_LEVEL_A,"<nick>")
}
public spawnthem(parm[2]){
new id = parm[0]
if (is_user_alive(id))
return PLUGIN_CONTINUE
spawn(id)
set_task(0.1,"spawnit",2,parm,2)
set_task(0.2,"spawnit",2,parm,2)
set_task(0.5,"suit",2,parm,2)
give_item(id, "weapon_knife")
new money = cs_get_user_money(id)
if (money < get_cvar_num("mp_startmoney"))
cs_set_user_money(id,get_cvar_num("mp_startmoney"),0)
return PLUGIN_CONTINUE
}
public suit(parm[2]){
new id = parm[0]
give_item(id, "item_suit")
give_item(id, "weapon_knife")
return PLUGIN_CONTINUE
}
public spawnit(parm[2]){
new id = parm[0]
spawn(id)
return PLUGIN_CONTINUE
}
public admin_spawn(id){
new arg[32]
read_argv(1,arg,31)
new player = cmd_target(id,arg,7)
if (!player) return PLUGIN_HANDLED
spawn(player)
new parm[2]
parm[0]=player
set_task(0.1,"spawnthem",72,parm,2)
return PLUGIN_HANDLED
}
The only problem is, when i try to spawn a dead player i get
] amx_spawn Jack
That action can't be performed on dead client "n^Jack"
Is there any way to run an amx_ command on a dead player? I dont see anything in the script that would prohibit that.
[edit]Just a side note: the script works when Im alive and i do amx_spawn Jack...[/edit]