Closest mission
#1

I want the player to be able to type /work and it will choose the most near mission of him. How can i do this?
Reply
#2

Help us please c:
Reply
#3

Loop through all mission and check if which distance is the lowest (nearest) to the player
Reply
#4

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Loop through all mission and check if which distance is the lowest (nearest) to the player
And how do we do that? We're not the best in scripting so yea...


ignore this, post got duplicated for some reason
Reply
#5

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Loop through all mission and check if which distance is the lowest (nearest) to the player
And how do we do that? We're not the best in scripting so yea...
Reply
#6

Although this had been asked 10 million of times and you just could ****** an example but here another one

I pretend that something like that already exists
pawn Код:
enum eMission {
    Float: mX,
    Float: mY,
    Float: mZ
}
new Mission[][eMission] {
    {0.0, 1.0, 2.0},
    {1.0, 2.0, 3.0}
};
pawn Код:
// Your /work command
new
    i,
    mission,
    Float: distance,
    Float: lowest = Float: 0x7F800000
;
while(++i < sizeof Mission) {
    if((distance = GetPlayerDistanceFromPoint(playerid, Mission[i][X], Mission[i][mY], Missions[i][mZ])) < lowest) {
        lowest = distance;
        mission = i;
    }
}
printf("Nearest mission is %d with the distance %f", mission, lowest);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)