Raised This Month: $ Target: $400
 0% 

how to make a string array? *i forgot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-23-2009 , 12:16   Re: how to make a string array? *i forgot
Reply With Quote #1

Quote:
Originally Posted by .Owyn. View Post
i need an array to store a individual string for every player, so i can campare it with other strings and use it like string_array[id] = string1; or a simular way, i looked thru my codes and.. do i have to use ArrayGetString() and like that just for this purpose?
To create an array of strings just make a 2 dimensional array. The first dimension is the number of strings you want to hold and the second dimension must be sized large enough for the largest possible string you wish to hold.

Suppose you want to put the following in an array:
Hello
this
is
an
array

new szArray[5][6];

Dimension 1 = 5 for 5 words
Dimension 2 = 6 because longest words are hello\array, each 5 chars in length + 1 for null so 6.

To store data in them, pass it as you would with a normal string except include the array element you wish to use.

new szAuthID[33][33];
get_user_authid( id , szAuthID[id] , 32 );
__________________

Last edited by Bugsy; 05-23-2009 at 12:19.
Bugsy 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 01:28.


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