In the below code, how would I match the person's name with their id, if no client called the command? It says in cmd_target that someone has to have called it.
Code:
public join_respawn()
{
if(surfmap == false)
{
return PLUGIN_CONTINUE
}
if(get_cvar_num("surf_on")==0)
{
return PLUGIN_CONTINUE
}
if ( !get_cvar_num("surf_respawn") )
return PLUGIN_CONTINUE
new arg[32]
read_data(3,arg,31)
//Debug stuff
client_print(0,print_chat,"[AMXX] data is %s",arg)
new id = cmd_target(0,"arg")
/* Spawn the player twice to avoid the HL engine bug */
set_task(0.5,"player_spawn",id)
set_task(0.7,"player_spawn",id)
/* Then give them a suit and a knife */
set_task(0.9,"player_giveitems",id)
return PLUGIN_CONTINUE
}
My console gets spammed with this:
Code:
L 08/30/2005 - 22:01:02: [AMXX] [FUN] Invalid player 0 (not in-game)
L 08/30/2005 - 22:01:02: [AMXX] Displaying call trace (plugin "cstrike\addons\amxmodx\plugins\surftools.amxx")
L 08/30/2005 - 22:01:02: [AMXX] [0] surftools.sma::player_spawn (line 298)
L 08/30/2005 - 22:01:02: [AMXX] [FUN] Invalid player 0 (not in-game)
L 08/30/2005 - 22:01:02: [AMXX] Displaying call trace (plugin "cstrike\addons\amxmodx\plugins\surftools.amxx")
L 08/30/2005 - 22:01:02: [AMXX] [0] surftools.sma::player_spawn (line 298)
L 08/30/2005 - 22:01:02: [AMXX] [FUN] Player out of range (0)
L 08/30/2005 - 22:01:02: [AMXX] Displaying call trace (plugin "cstrike\addons\amxmodx\plugins\surftools.amxx")
L 08/30/2005 - 22:01:02: [AMXX] [0] surftools.sma::player_giveitems (line 263)
[AMXX] data is Hawk
Which leads me to believe "id" is improperly matched, and remains at it's default value, 1.
If needed, this is what calls it:
Code:
register_event("TextMsg","join_respawn","a","1=1","2&Game_join_te","2&Game_join_ct")
__________________