Raised This Month: $ Target: $400
 0% 

Small question for get_user_name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 04-10-2011 , 10:28   Small question for get_user_name
Reply With Quote #1

And my question is this, I used this before:

PHP Code:
        new targetname[32]
        
get_user_name(tempidtargetname31)
        
        
client_print(idprint_chat"%s",  targetname
Now I found this somewhere and it works perfectly and I also like the way, I don't need to add make everytime a holder.

PHP Code:
client_print(idprint_chat"%s"username(tempid))

stock username(id)
{
    new 
player_name[32]
    
get_user_name(idplayer_namesizeof(player_name))
    
    return 
player_name

Is it ok to use it like that and would there be any big difference?
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2011 , 10:29   Re: Small question for get_user_name
Reply With Quote #2

It's fine, though depending where you will use it, it may not work properly. I, personally, use often such stocks to have a code more readable.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-10-2011 , 10:57   Re: Small question for get_user_name
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
it may not work properly. I, personally, use often such stocks to have a code more readable.
That was also the reason for me too.
And in which cases would it give me a problem then?
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-10-2011 , 11:32   Re: Small question for get_user_name
Reply With Quote #4

Don't remember exactly. Just remember having problem doing specific operation. When I will remember, I will post.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-10-2011 , 12:02   Re: Small question for get_user_name
Reply With Quote #5

Change sizeof with charsmax in that stock, it will be more correct even if you can't have any error due to name length limitation.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



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:53.


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