Since I can't figure out how 3D arrays work, I split them up into four different variable names. ((
Anyways, whenever I use the command /work, it always shows up "Gas Station 1" and "Gas Station 2". But the XYZ coordinates of four different TrailerDestination variables work, except for the Name variable.
PHP код:
enum Trailer
{
Name[32],
Float:DestX,
Float:DestY,
Float:DestZ
};
#define MAX_TRAILER1DESTINATION 2
new Trailer1Destination[MAX_TRAILER1DESTINATION][Trailer] =
{
{"Gas Station 1", 1941.9574, -1790.2637, 13.3828},
{"Gas Station 2", 980.5435, -921.2930, 41.2895}
};
#define MAX_TRAILER2DESTINATION 1
new Trailer2Destination[MAX_TRAILER2DESTINATION][Trailer] =
{
{"Ammu Nation", 1363.7482, -1287.4148, 13.5469}
};
#define MAX_TRAILER3DESTINATION 6
new Trailer3Destination[MAX_TRAILER3DESTINATION][Trailer] =
{
{"Well Stacked Pizza", 2094.8977, -1800.0154, 13.3426},
{"Cluckin' Bell", 2370.5210, -1910.6147, 13.1099},
{"Cluckin' Bell", 2408.2141, -1482.2157, 23.5552},
{"Cluckin' Bell", 922.3662, -1358.4125, 13.0151},
{"Joe's Sticky Ring", 1015.9811, -1345.2292, 13.1014},
{"Burger Shot", 788.3559, -1635.6775, 13.1099}
};
#define MAX_TRAILER4DESTINATION 2
new Trailer4Destination[MAX_TRAILER4DESTINATION][Trailer] =
{
{"Construction Materials", 1857.0723, -1321.2823, 13.1993},
{"Ammu Nation", 1363.82, -1287.4148, 13.5469}
};
CMD:work(playerid, params[])
{
new Float:x, Float:y, Float:z, string[512] = "Destination\tDistance\n";
if(IsPlayerInWork(playerid)) return SendClientMessage(playerid, COLOR_PLAYER, "ERROR: You are still on work! Use /cancelwork to cancel your current work.");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_PLAYER, "ERROR: You are not in any vehicle!");
if(!IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) return SendClientMessage(playerid, COLOR_PLAYER, "ERROR: You do not have any trailers attached!");
GetPlayerPos(playerid, x, y, z);
switch(GetVehicleTrailerType(GetPlayerVehicleID(playerid)) == 0)
{
case 0: for(new i = 0; i < MAX_TRAILER1DESTINATION; i++) format(string, sizeof(string), "%s%s\t%0.2fm\n", string, Trailer1Destination[i][Name], GetDistance(x, y, z, Trailer1Destination[i][DestX], Trailer1Destination[i][DestY], Trailer1Destination[i][DestZ]));
case 1: for(new i = 0; i < MAX_TRAILER2DESTINATION; i++) format(string, sizeof(string), "%s%s\t%0.2fm\n", string, Trailer2Destination[i][Name], GetDistance(x, y, z, Trailer2Destination[i][DestX], Trailer2Destination[i][DestY], Trailer2Destination[i][DestZ]));
case 2: for(new i = 0; i < MAX_TRAILER3DESTINATION; i++) format(string, sizeof(string), "%s%s\t%0.2fm\n", string, Trailer3Destination[i][Name], GetDistance(x, y, z, Trailer3Destination[i][DestX], Trailer3Destination[i][DestY], Trailer3Destination[i][DestZ]));
case 3: for(new i = 0; i < MAX_TRAILER4DESTINATION; i++) format(string, sizeof(string), "%s%s\t%0.2fm\n", string, Trailer4Destination[i][Name], GetDistance(x, y, z, Trailer4Destination[i][DestX], Trailer4Destination[i][DestY], Trailer4Destination[i][DestZ]));
}
ShowPlayerDialog(playerid, DIALOG_WORK, DIALOG_STYLE_TABLIST_HEADERS, "Select Destination", string, "Select", "Cancel");
return 1;
}
combine them into one. fix this too