Global array
I have to use this code:
Code:
new String:players[SQL_GetRowCount(query)];This code in OnPluginStart, but I need a global array(I can't set it in global area 'cause I don't know how many rows in sql). Although I can declare an array in global area with fixed length of array, but it's bad. So how to figure it out? |
Re: Global array
If you want to make it global, set the String size to some maximum you know you won't exceed.
E.g. If the string holds a player's name, set the maximum length to MAX_NAME_LENGTH. |
Re: Global array
it's an array of strings.
I just hoped there is exist another way & better way to do it. Also I'll be able to use while if it's possible. |
Re: Global array
For a global array of strings use a 2-dimensional array. For example, for an array of players' names use:
new String:g_szPlayersNames[MAXPLAYERS+1][MAX_NAME_LENGTH]; |
Re: Global array
In array I store steamid's of vip players. I do not need to use 2D arrays.
but thx for helping :) |
Re: Global array
Quote:
Quote:
|
Re: Global array
may be I'm wrong, I just want to store e.g. 2 steamid's in array
Code:
players[1] = "STEAM_0:0:1"; |
Re: Global array
yep, you're right, thx
stupid pawn :) |
Re: Global array
Quote:
|
Re: Global array
Quote:
one advantage it is small(probably 'cause of this it is used by sourcemod) |
| All times are GMT -4. The time now is 11:41. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.