21.03.2011, 19:54
Ok, i made a new command for my server to make it give the players the nearest mission, but i need it to figure out which value is the smallest distance and give them that mission.
Heres the command so far:
Now, i need it to be like if DistanceAngleP is the shortest it calls MissionAngleP(playerid); or if DistanceFortC is the shortest then it calls MissionFortC(playerid);, how do i do that?
Heres the command so far:
pawn Code:
COMMAND:work(playerid,params[])
{
if(isworking[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You are already working!");
new vehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
if (vehiclemodel == 431 || vehiclemodel == 437)
{
TextDrawShowForPlayer(playerid,Textdraw0);
new DistanceAngleP, DistanceBayside, DistanceDill, DistanceElQue, DistanceFortC, DistanceLasB, DistanceLasP, DistanceMont, DistancePC;
DistanceAngleP = GetPlayerDistanceToPointEx(playerid,-2169.75, -2305.75, 30.46);
DistanceBayside = GetPlayerDistanceToPointEx(playerid,-2565.75,2315.25,4.83);
DistanceDill = GetPlayerDistanceToPointEx(playerid,736.00, -527.50, 16.18);
DistanceElQue = GetPlayerDistanceToPointEx(playerid,-1467.00, 2674.00, 55.68);
DistanceFortC = GetPlayerDistanceToPointEx(playerid,-45.37, 1200.68, 19.21);
DistanceLasB = GetPlayerDistanceToPointEx(playerid,-2565.75, 2315.25, 4.83);
DistanceLasP = GetPlayerDistanceToPointEx(playerid,-269.00, 2625.75, 62.64);
DistanceMont = GetPlayerDistanceToPointEx(playerid,1288.50, 329.00, 19.40);
DistancePC = GetPlayerDistanceToPointEx(playerid,2263.75, -30.75, 26.33);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You need a Bus Or Coach to work!");
}
return 1;
}