How to call this enum? -
Sc0pion - 27.04.2017
Fixed!
Re: How to call this enum? -
Kane - 27.04.2017
Try "AccInfo[MAX_PLAYERS][currentpos][0]". I might be wrong though.
Re: How to call this enum? -
Sc0pion - 27.04.2017
Fixed!
Re: How to call this enum? -
Kane - 27.04.2017
What was the error?
Re: How to call this enum? -
Hansrutger - 27.04.2017
Код:
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.
Re: How to call this enum? -
Sc0pion - 27.04.2017
Fixed!
Re: How to call this enum? -
Hansrutger - 27.04.2017
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.
Re: How to call this enum? -
DRIFT_HUNTER - 27.04.2017
AccInfo[playerid][currentpos][0]
Re: How to call this enum? -
raydx - 27.04.2017
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.
Re: How to call this enum? -
denNorske - 27.04.2017
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.
Re: How to call this enum? -
Hansrutger - 27.04.2017
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.
|
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
Re: How to call this enum? -
Sc0pion - 27.04.2017
Fixed!
Re: How to call this enum? -
Hansrutger - 27.04.2017
Already posted it before bud, enjoy:
Code:
GetPlayerPos(playerid, AccInfo[playerid][currentpos][0], AccInfo[playerid][currentpos][1], AccInfo[playerid][currentpos][2]);
Re: How to call this enum? -
Sc0pion - 27.04.2017
Fixed!