Raised This Month: $ Target: $400
 0% 

random_num issue


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 07-12-2013 , 10:36   Re: random_num issue
Reply With Quote #7

Quote:
Originally Posted by Mofforg View Post
Is that correct?
PHP Code:
static shortname[25];
format(shortname24"Short name!%d"random_num(1,999999))
set_user_info(id"name"shortname
It's alright, but you should use formatex for more efficiency. Check that: http://docs.sourcemod.net/api/

First, check for Format and then for FormatEx to see the difference. They'll make you understand better than me. This is for Source Mod, but the documentation seems better and the natives are approximately same.

An example:

PHP Code:
static AString[32];
AString "claudiuhks";
format(AString31"hattrick_%s"AString);
//result: hattrick_claudiuhks

static BString[32];
BString "claudiuhks";
formatex(BString31"hattrick_claudiuhks" /* can't use argument BString since you format it */);
//result: hattrick_claudiuhks 
__________________

Last edited by claudiuhks; 07-12-2013 at 10:45.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
 



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 06:22.


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