Raised This Month: $ Target: $400
 0% 

Problems with amx_spawn plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Theit
New Member
Join Date: Jan 2005
Old 01-23-2005 , 13:11   Problems with amx_spawn plugin.
Reply With Quote #1

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]
Theit is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 01-23-2005 , 15:52  
Reply With Quote #2

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
__________________
twistedeuphoria is offline
Theit
New Member
Join Date: Jan 2005
Old 01-23-2005 , 18:11  
Reply With Quote #3

Thanks!

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


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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