14.05.2013, 20:06
i have this nearest to check point mission for player but it used to work but now it don't i dont understand why
any way here is the code
hope you can help thanks!
any way here is the code
pawn Код:
stock GetNearestCoordsForPlayer(playerid)
{
new
Float:DefDist = 999999999.9,
Float:CurDist,
id = -1
;
for(new d = 0; d < sizeof(ALocations); d++)
{
CurDist = GetPlayerDistanceFromPoint(playerid, ALocations[d][LocX], ALocations[d][LocY], ALocations[d][LocZ]);
if(CurDist < DefDist)
{
DefDist = CurDist;
id = d;
}
}
return id;
}
public StartMission(playerid)
{
if(TypeFlight[playerid] == 1) // Andromada
{
StartedMission[playerid] = 1;
new rand = random(sizeof(ALocations));
new string2[65], message[128];
SetPlayerCheckpoint(playerid, ALocations[rand][LocX],ALocations[rand][LocY],ALocations[rand][LocZ], 15.0);
format(string2, sizeof(string2), "%s", ALocations[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 {FF9900}%s {FFFFFF}and pick up the cargo goods.", ALocations[rand][LocationName]);
SendClientMessage(playerid, COLOR_WHITE, message);
GameTextForPlayer(playerid, "~w~Andromada ~r~Mission Started", 4000, 3);
TypeFlight[playerid] = 1;
MissionStage[playerid] = 1;
WantsRecording[playerid] = 1;
Pos1[playerid] = ALocations[rand][LocX];
Pos2[playerid] = ALocations[rand][LocY];
Pos3[playerid] = ALocations[rand][LocZ];
}
