Raised This Month: $ Target: $400
 0% 

Finding an id with name


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-30-2005 , 23:06   Finding an id with name
Reply With Quote #1

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")
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
 



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 14:33.


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