How to call this enum?
#1

Fixed!
Reply
#2

Try "AccInfo[MAX_PLAYERS][currentpos][0]". I might be wrong though.
Reply
#3

Fixed!
Reply
#4

What was the error?
Reply
#5

Код:
GetPlayerPos(playerid, AccInfo[playerid][currentpos][0], AccInfo[playerid][currentpos][1], AccInfo[playerid][currentpos][2]);
"currentpos" isn't a variable by itself, it's a placeholder for a number, in this case it's a placeholder name for an array. You basically allowed a table to be three-dimensional by having an array in an enum (would be 2D if it wouldn't have been for MAX_PLAYERS).

Код:
enum e_somethings {
	hi,
	hello,
	samp[3],
	okay
};
Below you can see the same thing written on the left side as the right side with different ways, explaining what I said above.
Код:
Somethings[playerid][0] == Somethings[playerid][hi]
Somethings[playerid][1] == Somethings[playerid][hello]
Somethings[playerid][2][0] == Somethings[playerid][samp][0]
Somethings[playerid][2][1] == Somethings[playerid][samp][1]
Somethings[playerid][2][2] == Somethings[playerid][samp][2]
Somethings[playerid][3] == Somethings[playerid][okay]
Hope that made any sense to you lol.
Reply
#6

Fixed!
Reply
#7

No, the way you did it is fine, it's proven to be slower but just tried to explain how they work. For the sake of clarity I'd recommend you use the enum you posted just now, that way it will be a bit faster, not much but a bit.
Reply
#8

AccInfo[playerid][currentpos][0]
Reply
#9

GetPlayerPos(playerid, AccInfo[MAX_PLAYERS][currentpos[0]], AccInfo[MAX_PLAYERS][currentpos[1]], AccInfo[MAX_PLAYERS][currentpos[2]);

Errors highlighted.
Use playerid instead of MAX_PLAYERS.
Reply
#10

Quote:
Originally Posted by raydx
Посмотреть сообщение
GetPlayerPos(playerid, AccInfo[MAX_PLAYERS][currentpos[0]], AccInfo[MAX_PLAYERS][currentpos[1]], AccInfo[MAX_PLAYERS][currentpos[2]);

Errors highlighted.
Use playerid instead of MAX_PLAYERS.
An explanation to this:
When you define what "AccInfo" is, you define that it's an array. It contains Max_players slots available for use.
So when you are using it in the code, you got to use playerid to assign a value to the correct slot in the array.
Reply
#11

Quote:
Originally Posted by raydx
View Post
GetPlayerPos(playerid, AccInfo[MAX_PLAYERS][currentpos[0]], AccInfo[MAX_PLAYERS][currentpos[1]], AccInfo[MAX_PLAYERS][currentpos[2]);


Errors highlighted.

Use playerid instead of MAX_PLAYERS.
That is actually incorrect. Answer was already even given so I don\'t know why you post this. Only right thing you highlighted was about the max_players. Please refrain from doing this as confusion might appear for new users or new pawners
Reply
#12

Fixed!
Reply
#13

Already posted it before bud, enjoy:
Code:
GetPlayerPos(playerid, AccInfo[playerid][currentpos][0], AccInfo[playerid][currentpos][1], AccInfo[playerid][currentpos][2]);
Reply
#14

Fixed!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)