question about variables
#1

Is it possible to make this:

for example:

Enum[ vehicleid/playerid ][ variable ][ 1 ] = "string";

?

Because, if i do for example:

enum<...>
Name[ 5 ][ 10 ]; // it gives no errors, but not works the way it should work.
<..>

if i create a global variable like:

new Something[ 5 ][ 100 ]; it works perfectly, but with MAX_PLAYERS/MAX_VEHICLES it doesn't work, so is there any method to create it?
Reply
#2

pawn Код:
new Variable[MAX_PLAYERS][100 char];
then you can use...

pawn Код:
format(Variable[playerid], size, "string", ...);
Reply
#3

I meant not this, i mean that how (if its possible) to make that:

pawn Код:
format(Variable[playerid][ 0 ], size, "string", ...);
pawn Код:
format(Variable[playerid][ 1 ], size, "string", ...);
and so on...
Reply
#4

pawn Код:
new Variable[MAX_PLAYERS][NUMBER OF ARRAYS][100 char];
Reply
#5

Add another dimension to your array?

For example:

pawn Код:
new variable[MAX_PLAYERS][10][128];

format(variable[playerid][0], 128, "string");
format(variable[playerid][1], 128, "string");
That's what you're looking for?

Edit: Woah, way too slow!
Reply
#6

Quote:
Originally Posted by Pharrel
Посмотреть сообщение
pawn Код:
new Variable[MAX_PLAYERS][NUMBER OF ARRAYS][100 char];
Try'd, it gives no error, but works not how it should work. (If you format it - it gives a one letter of each format in others message, in case i have a photo:

Code:
pawn Код:
Format( myEnum[ playerid ][ BankOperation ][ 0 ], 8, "Nėra." ); // In english it means: N/A
Format( myEnum[ playerid ][ BankOperation ][ 1 ], 8, "Nėra." );
Format( myEnum[ playerid ][ BankOperation ][ 2 ], 8, "Nėra." );
Format( myEnum[ playerid ][ BankOperation ][ 3 ], 8, "Nėra." );
Format( myEnum[ playerid ][ BankOperation ][ 4 ], 8, "Nėra." );
how it looks in game:
http://www.part.lt/perziura/37ab4d80...7ffcb9f288.png
Reply
#7

Now you're using it as a 4D array, he only showed you how to create a 3D array!

Although now ****** tells us that it's not possible, which I didn't know, although I did some small quick tests and it did work in the ways I tested it.
Reply
#8

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Now you're using it as a 4D array, he only showed you how to create a 3D array!

Although now ****** tells us that it's not possible, which I didn't know, although I did some small quick tests and it did work in the ways I tested it.
Oh, so only, 2d is possible in PAWN? Not even 3? : / sad.
Reply
#9

Sorry for double post, but i run a few tests too, and actually it works for me too (without enum).
pawn Код:
// TEST
new
    myVeh[ MAX_VEHICLES ][ 4 ][ 256 ];
And the output was a good.

So thank you guys. you can close/delete theard.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)