get_user_name ?
Hi all! I'm trying to get a users name. So I looked at the get_user_name function.
I saw someone post: Code:
new name[18] Now, what I don't understand is the array, name[18]. What exactly does this do? Then there's get_user_name(id, name, 17). what exactly is "id" for (index)? Then name? Also why's it 17 now? client_print(id, ...) Whats the index there for? What is the index? Sorry I'm just getting started in scripting. This may probably be the noobiest question ever asked. Hah. Thanks in advance. |
Re: get_user_name ?
You should start to read the existing tutorials for beginner : https://forums.alliedmods.net/showth...awnProgramming
|
Re: get_user_name ?
It's a string, not an array. The number means it can have 18 characters max. It looks exactly like an array because it works similiar to this:
Code:
For the second question, id is the player index. It starts from 1 and ends with 32. It is passed in forwards like client_connect( id ). In your example, it means you're getting the name of player with index id. name means you're copying the user's name into name string. It is 17 because every string starts from 0 (not 1, see my example above), thus it's always max characters - 1. For the third question, see above. |
Re: get_user_name ?
Thank you guys for taking the time to answer. I really apreciate it. I understand now :)
edit; Ok so I made this plugin but there are some errors: Code:
Error: Invalid function or declaration on line 11Code:
/* Plugin generated by AMXX-Studio */ |
Re: get_user_name ?
To get user name use this method:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
EDIT: Check my practice plugin here : http://forums.alliedmods.net/showthread.php?t=188202 It would help you. |
Re: get_user_name ?
@above Perfect! Thanks so much! I appreciate your help all!
I changed the bool to Code:
new bool:isSimon=falseI used the user name method Waleed suggested which worked perfectly. I also googled how to get user team and i found the cstrike one too :P so yeah using that one. Here's the working code: Code:
/* Plugin generated by AMXX-Studio */LOL edit; last question. how would one reset a boolean to false after round end? o.0 I dont want to create a new thread for each question. Lmfao sorry. |
Re: get_user_name ?
To find what natives or constants you need use AMX Wiki ---> http://www.amxmodx.org/funcwiki.php <---
Google is good for searching but AMX Wiki would be faster and easier to get info on modules and constants :) |
Re: get_user_name ?
Every bool has false as default value, so you don't need to set it.
|
Re: get_user_name ?
oh ok thanks. ^ i also figured out how to make it back to false if it was true after round end. so I'm done for now! Thanks all :P
|
Re: get_user_name ?
Quote:
Quote:
|
| All times are GMT -4. The time now is 06:16. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.