AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problems with amx_spawn plugin. (https://forums.alliedmods.net/showthread.php?t=9567)

Theit 01-23-2005 13:11

Problems with amx_spawn plugin.
 
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]

twistedeuphoria 01-23-2005 15:52

Your cmd_target has the flag 7 which is Obey Immunity, allow yourself and User must be alive... try just a flag of 2.
http://www.amxmodx.org/funcwiki.php?go=func&id=596

Theit 01-23-2005 18:11

Thanks!

Most of that code was copied from another script. Trying to get into coding for amx more.


All times are GMT -4. The time now is 19:16.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.