Raised This Month: $ Target: $400
 0% 

get_user_name question.


Post New Thread Reply   
 
Thread Tools Display Modes
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 10-29-2011 , 15:29   Re: get_user_name question.
Reply With Quote #11

Quote:
Originally Posted by Bugsy View Post
It is a macro so when your code is compiled the compiler replaces each occurrence of sizeof/charsmax with the numerical value.
Thanks a lot
__________________
Полный похуизм.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 10-29-2011 , 15:47   Re: get_user_name question.
Reply With Quote #12

Quote:
Originally Posted by Evaldas.Grigas View Post
Why can't I use it like this?
PHP Code:
if(get_user_name idEvaldas.Grigas )) 
I want to check if player name is Evaldas.Grigas.
In Pawn each string symbol (letter, number if it's assigned as a string and everything else) "consumes" 1 array cell:
Code:
new Name[32] get_user_name(id, Name, 31) Name[0] = E // not exactly, just showing example Name[1] = v

Which means you have to assign the cells first. If it's an integer, that uses only 1 cell, you won't have to do it this way;

Code:
new Random_Num = random_num(0, 2) //or if(random_num(0, 2) == 1) // something

In quite alot of other programming languages, let's say PHP for example, the string size is not defined and is assigned automatically; so you can use it like you want

PHP Code:
if(php_get_user_name() == "Evaldas.Grigas.")
// something 

Last edited by Backstabnoob; 10-29-2011 at 15:47.
Backstabnoob is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-29-2011 , 15:49   Re: get_user_name question.
Reply With Quote #13

@Backstabnoob, that post is really confusing and will likely just make him more confused.
__________________

Last edited by fysiks; 10-29-2011 at 15:49.
fysiks is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 10-29-2011 , 15:50   Re: get_user_name question.
Reply With Quote #14

Well it's kind of hard to explain, but I guess he'll at least get the basic idea from that
Backstabnoob is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-29-2011 , 18:15   Re: get_user_name question.
Reply With Quote #15

Quote:
Originally Posted by Backstabnoob View Post
Well it's kind of hard to explain, but I guess he'll at least get the basic idea from that
The point is that you probably just made it much harder for him to learn.
__________________
fysiks is offline
KillLikoe
BANNED
Join Date: Nov 2010
Location: Paraguay
Old 10-30-2011 , 01:27   Re: get_user_name question.
Reply With Quote #16

Quote:
Originally Posted by Napoleon_be View Post
PHP Code:
new szName[33]
get_user_name(idszNamecharsmax(szName)) 
or

PHP Code:
new szName[33]
get_user_name(id szName32
or

PHP Code:
new szName[33]
get_user_name(id szNamesizeof szName 1
KillLikoe is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-30-2011 , 03:03   Re: get_user_name question.
Reply With Quote #17

Quote:
Originally Posted by KillLikoe View Post
or

PHP Code:
new szName[33]
get_user_name(id szNamesizeof szName 1
1. You forgot a comma.
2. Use charsmax(). In the end it's the same thing as sizeof()-1 but it's more readable.
__________________
fysiks 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 14:15.


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