21.03.2015, 16:18
Hello, it might be a sort of copy of my old topic but to prevent further problems, I'd rather create a new topic.
Is there any way to get this working?
My Enum + data
Which could be used in a command like:
I'm currently getting those errors unfortunately:
Whereas the errors are coming from the function itself.
Is there any way to get this working?
pawn Код:
stock testfunc(playerid, enumname)
{
new Float:closest = PlayerDistanceToPoint(playerid, enumname[0][LoadX], enumname[0][LoadY], enumname[0][LoadZ]);
for(new i=1; i<sizeof(enumname); i++)
{
if(PlayerDistanceToPoint(playerid, enumname[i][LoadX], enumname[i][LoadY], enumname[i][LoadZ]) < closest)
{
closest = PlayerDistanceToPoint(playerid, enumname[i][LoadX], enumname[i][LoadY], enumname[i][LoadZ]);
CurrentMission[playerid] = i;
CreateDynamicCP(enumname[i][LoadX], enumname[i][LoadY], enumname[i][LoadZ], 20.0, -1, -1, playerid);
}
}
}
pawn Код:
enum _Mission
{
LoadName[128],
Float:LoadX,
Float:LoadY,
Float:LoadZ
};
new ShamalMissions[][_Mission] =
{
{"Los Santos Airport - Gate 1", 1643.1703, -2413.4470, 13.5547},
{"San Fierro Airport - Gate 1", -1343.9749, -229.1865, 14.1484},
{"Los Santos Airport - Gate 2", 1727.5576, -2411.5198, 13.5547},
{"San Fierro Airport - Gate 2", -1232.2932, -363.1233, 14.1440},
{"Las Venturas Airport - Gate 1", 1578.1338, 1357.4642, 10.8580},
{"Las Venturas Airport - Gate 2", 1572.3075, 1398.5856, 10.8442},
{"Easter Bay Airport - Gate 1", -805.7103, -805.7494, 158.3181},
{"Las Venturas Airport - Gate 3", 1569.1445, 1504.1632, 10.8374},
{"Bayside Airport - Gate 1", -2370.4419, 2533.1575, 26.5271},
{"Las Venturas Airport - Gate 4", 1577.8265, 1538.7271, 10.8272},
{"Rockshore West Airport - Gate 1", 2337.7063, 554.1091, 7.7836},
{"Las Venturas Airport - Gate 5", 1608.7456, 1550.4012, 10.8171},
{"Rockshore West Airport - Gate 2", 2248.8269, 554.8190, 7.7836}
};
pawn Код:
CMD:testfunction(playerid, params[])
{
testfunc(playerid, ShamalMissions);
return 1;
}
Код:
crp.pwn(1758) : error 028: invalid subscript (not an array or too many subscripts): "enumname" crp.pwn(1758) : warning 215: expression has no effect crp.pwn(1758) : error 001: expected token: ";", but found "]" crp.pwn(1758) : error 029: invalid expression, assumed zero crp.pwn(1758) : fatal error 107: too many error messages on one line