new CD1Locations[][TLocation] =
{
{"SF Driving School Stop", -2070.2134,-76.9065,35.3203},
{"Burger Shot", -2327.7761,-183.9470,35.3203},
{"SF Hotel", -2724.3123,-314.2257,7.1867},
{"Clukin Bell", -2657.7583,280.5651,4.3281},
{"Supa Save", -2451.0186,737.3842,35.0156},
{"Esplanade North", -1951.1077,1327.4839,7.1888},
{"WangCars stop", -1998.8578,252.6071,30.3579}
};
new Float:dist,Float:maxdist = 99999.9,index;
for(new i,j=sizeof(CD1Locations);i<j;i++)
{
dist = GetPlayerDistanceFromPoint(playerid,CD1Locations[i][1],CD1Locations[i][2],CD1Locations[i][3]);
if(dist < maxdist)
{
maxdist = dist;
index = i;
}
}
printf("The closest location is %s",CD1Locations[index][0]);
Hello.
Do you mean something like this? PHP код:
|
if(TypeFlight[playerid] == 1) // Andromada
{
StartedMission[playerid] = 1;
new rand = random(sizeof(cd1Locations));
new string2[65], message[128];
SetPlayerFlightCheckpoint(playerid, cd1Locations[rand][LocX],cd1Locations[rand][LocY],cd1Locations[rand][LocZ], 15.0);
format(string2, sizeof(string2), "%s", cd1Locations[rand][LocationName]); //PASSWORD
strmid(FirstAPName[playerid], string2, 0, strlen(string2), 128); //PASSWORD
//FirstAPName[playerid] = ALocations[rand][LocationName];
//FirstAPName[playerid] = AndroDName;
format(message,sizeof(message), "Head to {1B8AE4}%s {FFFFFF}and pick up the cargo goods.", cd1Locations[rand][LocationName]);
SendClientMessage(playerid, COLOR_WHITE, message);
TypeFlight[playerid] = 1;
MissionStage[playerid] = 1;
WantsRecording[playerid] = 1;
Pos1[playerid] = cd1Locations[rand][LocX];
Pos2[playerid] = cd1Locations[rand][LocY];
Pos3[playerid] = cd1Locations[rand][LocZ];
if(TypeFlight[playerid] == 1) // Andromada
{
new Float:dist,Float:maxdist = 99999.9,index;
for(new i,j=sizeof(CD1Locations);i<j;i++)
{
dist = GetPlayerDistanceFromPoint(playerid,CD1Locations[i][1],CD1Locations[i][2],CD1Locations[i][3]);
if(dist < maxdist)
{
maxdist = dist;
index = i;
}
}
StartedMission[playerid] = 1;
new string2[65], message[128];
SetPlayerFlightCheckpoint(playerid, cd1Locations[index][LocX],cd1Locations[index][LocY],cd1Locations[index][LocZ], 15.0);
format(string2, sizeof(string2), "%s", cd1Locations[index][LocationName]); //PASSWORD
strmid(FirstAPName[playerid], string2, 0, strlen(string2), 128); //PASSWORD
//FirstAPName[playerid] = ALocations[index][LocationName];
//FirstAPName[playerid] = AndroDName;
format(message,sizeof(message), "Head to {1B8AE4}%s {FFFFFF}and pick up the cargo goods.", cd1Locations[index][LocationName]);
SendClientMessage(playerid, COLOR_WHITE, message);
TypeFlight[playerid] = 1;
MissionStage[playerid] = 1;
WantsRecording[playerid] = 1;
Pos1[playerid] = cd1Locations[index][LocX];
Pos2[playerid] = cd1Locations[index][LocY];
Pos3[playerid] = cd1Locations[index][LocZ];
dist = GetPlayerDistanceFromPoint(playerid,CD1Locations[i][1],CD1Locations[i][2],CD1Locations[i][3]);