Getting nearest Cords
#1

/fixed thanks!
Reply
#2

pawn Код:
GetNearestCoordsForPlayer(playerid)
{
    new
        Float:DefDist = 999999999.9,
        Float:CurDist,
        ID = -1;

    for(new d; 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;
}

if(TypeFlight[playerid] == 1) // Andromada
{
    new rand = GetNearestCoordsForPlayer(playerid);
    if(rand == -1) return SendClientMessage(playerid, COLOR_WHITE, "ERROR");
    new string2[65], message[128];
    StartedMission[playerid] = 1;
    SetPlayerCheckpoint(playerid, ALocations[rand][LocX],ALocations[rand][LocY],ALocations[rand][LocZ], 15.0);
    strcat((FirstAPName[playerid][0]='\0',FirstAPName[playerid]),ALocations[rand][LocationName],sizeof(FirstAPName[])); //PASSWORD
    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];
}
Reply
#3

thanks for helping but how can i fix this errors?
pawn Код:
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(9) : error 031: unknown directive
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3963) : error 017: undefined symbol "GetNearestCoordsForPlayer"
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3964) : warning 217: loose indentation
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3968) : warning 219: local variable "ID" shadows a variable at a preceding level
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3976) : error 022: must be lvalue (non-constant)
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3976) : warning 215: expression has no effect
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3968) : warning 204: symbol is assigned a value that is never used: "ID"
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3968 -- 3982) : warning 225: unreachable code
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3984) : error 017: undefined symbol "GetNearestCoordsForPlayer"
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(3986) : warning 204: symbol is assigned a value that is never used: "string2"
C:\Users\Daoud\Desktop\Pilots heaven\gamemodes\PH.pwn(4495) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)