An Array in gerneral or his defining system?
He's shown you his system so an array would be like
pawn Код:
new List[][] = // This has two paramaters The column as its going to hold strings.
{
"Column 1",
"Column 2",
"Column 3"
};
Now were going to prin one of theres colums into a string
format(string, sizeof(string), "%s is viewing %s", GetPlayerNameEx(playerid), List[1]); // GetPlayerNameEx a custom function I use - self explanitory List[1] this tells the array which to loook at and notice i've only called one paramater. Thats because I dont want to take a certain character amount from the string or it could turn ouyt like below [/pawn]
List[1][3] - this tells the array its column one, and we only want 3 characters (Col)
an Array with one paramater could be like this elevator I made
pawn Код:
new Float:FloorZ[] =
{
78.11,
83.4000,
88.6200,
93.8800,
99.0700,
104.4100,
109.7100,
114.9500,
120.1100,
125.3700,
133.6900
};
I've got this code to sahow you code in action in a script now to work out the Z level the elevator has to goto I use the listitem in my dialog.
pawn Код:
MoveObject(ElevatorObjects[0], -318.94, 1564.73, FloorZ[listitem], 5.0);
//This moves the elevator to the co-ords shown the the listem pressed if the listitem is 1 the Z co ords would be 88.6200, [/pawn]
if you would like me to show you differnt ways and things you can do with an array add my Skype as its hard coding in thei sbox I cant see whats above
EDIT: I have time
You could even go as far as a 2 dimional array with 3 bits of info in this cae Co-Ords
new Float:dimentions[2][3] = // we put 3 as we have a row inside the bracket not jsut one answer...
{
{0.0, 0.0, 0.0},
{1.0, 1.0, 1.0}
}
We would get all 3 parts like we would in a enum fixed with an array
SetPlayerPos(playerid, dimentions[1][0], dimentions[1][1], dimentions[1][2]);
Now if I were to debug this in a console and print it lets say like this
pawn Код:
Printf("%0.2f", dimentions[1][0]); It would print 0.0 as its calling that first segment inside the brackets.
EDIT at OP:
Quote:
Originally Posted by Twisted_Insane
pawn Код:
new CheckpointAreaType[1][] = { {CHECKPOINT_CLOTHES}, }; case CheckPointAreaType[0]:
Alright, so we're defining the array "CheckpointAreaType", the '1' means it holds 1 cell, in that case CHECKPOINT_CLOTHES. Now we set easily the cases from takin' out the information of our array.
|
This doesnt work AS thingy pointed out above. YOu would have to define each type of check point.
Like I have done with my car creator in Surreal Roleplay..
pawn Код:
#define MAX_PLATE_CHARS 20
#define Vehicle_Type_Public 0
#define Vehicle_Type_pOwned 1
#define Vehicle_Type_Faction 2
#define Vehicle_Type_Gang 3
#define Vehicle_Type_Rental 4
#define Vehicle_Type_Dealership 5