AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get player specific id's (https://forums.alliedmods.net/showthread.php?t=45590)

desert 10-06-2006 14:29

get player specific id's
 
I need a way to get a players specific ID. would their be a native for it or would it be a couple commands formed together to get it?

XxAvalanchexX 10-06-2006 14:34

Re: get player specific id's
 
Their userid (ie: kick #123), their steamid (ie: STEAM_0:1:123456), their player index (1-32) from their name, or something else? You need to be a little bit more clear please.

desert 10-06-2006 14:51

Re: get player specific id's
 
player index. im trying to gain each players specific index this way when they type a command for a client command it only acts for them. Lemme add my coding this way i can explain it better. Where i need the help is in the Antidote section where it only works for CT Team Members. And only the specific player who calls upon it.

desert 10-06-2006 14:52

Re: get player specific id's
 
Code:
  public antidote (id) {         new ANTIDOTE = 50         new playerMoney         new playerHealth         new newPlayerHealth         new minHealth         new userid                 userid = get_user_userid(id)                 minHealth = 50         playerHealth = get_user_health (userid)         newPlayerHealth = (playerHealth + ANTIDOTE)         playerMoney = cs_get_user_money (userid)                         if(playerHealth <= minHealth)         {             if (get_cvar_num("amx_antidote") <= playerMoney)             {                   set_user_health(userid,newPlayerHealth)             cs_set_user_money(userid,playerMoney - get_cvar_num("amx_antidote"),1)             client_print(userid,print_chat,"[REO] You Have Bought The T-Virus Antidote")             }             else if (get_cvar_num("amx_antidote") > playerMoney)             {                   client_print(userid,print_chat,"[REO] You Don't Have Enough for Antitdote")             }         }                 if (playerHealth >= minHealth)         {               client_print(userid,print_chat,"[REO] You Aren't Infected")         } }

Silencer123 10-06-2006 14:52

Re: get player specific id's
 
Code:
// AMXModX is using the Players Ent-IDs (From 1 to 32) to do Stuff with Players. new authid[32] get_user_authid(id,authid,31) // Will print Players STEAM_ID to variable 'authid' (For example: STEAM_0:1:23456) new userid=get_user_userid(id) // Will write Players User_ID to variable 'userid' (userid>=1)

desert 10-06-2006 14:56

Re: get player specific id's
 
would that be using it correctly?

Silencer123 10-06-2006 16:56

Re: get player specific id's
 
No.
Did you never ask yourself why you have this "(id)" behind your public Function?
For example, if a Player says the Command to call that Function, the "(id)" means:
"Create a new variable called "id"". Would be the same as "new id". But:
The variable is created in a special way: In brackets behind the Function.
This tells AMXX: In this Variable write the Data that comes with the fact,
that a Player used this Command: His ID. This ID goes from 1 to 32. So,
do not use userid. Use id. These public Functions can have Tons of Parameters
behind them in Brackets! Also, you can call a Function inside a Function.
Code:
public function_a(id,bla,blupp,hello) {     function_b(id,bla,blupp,hello) }   public function_b(asd,gogo,gaga,dingdong) {     // The id from function_a is = asd here in function_b     // The bla from function_a is = gogo here in function_b     // The blupp from function_a is = gaga here in function_b     // The hello from function_a is = dingdong here in function_b }

desert 10-06-2006 22:46

Re: get player specific id's
 
Iight Thanks Man.


All times are GMT -4. The time now is 04:55.

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