01.03.2016, 15:07
(
Последний раз редактировалось Shaheen; 02.03.2016 в 04:03.
)
so well i have came up this issue this time
i have a script for pilot job so here is the definition for it ::
if a player starts work it will show the nearest check point and unload it in random cp so i have currently 4 airports as load and unload location so these are sfa,lva,lsa,vma so when i start load it will start from nearest airport so i will sometimes get unload from same atarting point so how can i fix it ??

i have a script for pilot job so here is the definition for it ::
if a player starts work it will show the nearest check point and unload it in random cp so i have currently 4 airports as load and unload location so these are sfa,lva,lsa,vma so when i start load it will start from nearest airport so i will sometimes get unload from same atarting point so how can i fix it ??
Код:
#include <a_samp> #define COLOR_ORANGE 0xFFA500FF #define COLOR_LIMEGREEN 0x32CD32FF #define COLOR_ROYALBLUE 0x4169E1FF #define COLOR_PINK 0xFA8072FF #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_BLUE 0x0000BBAA #define COLOR_LIGHTBLUE 0x33CCFFAA forward time(); #include <a_samp> #define FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------"); print("Clock by Kapil"); print("--------------\n"); return 1; } public time(){ new Text:Clock; TextDrawDestroy(Clock); new hour,minute,second; gettime(hour,minute,second); new string[256]; if (minute <= 9){format(string,25,"%d:0%d",hour,minute);} else {format(string,25,"%d:%d",hour,minute);} TextDrawHideForAll(Clock); Clock=TextDrawCreate(552,28,string); TextDrawLetterSize(Clock,0.5,1.8); TextDrawFont(Clock,3); TextDrawBackgroundColor(Clock,40); TextDrawSetOutline(Clock,2); TextDrawShowForAll(Clock); SetTimer("time",30000,0); return 1; } enum { STAGE_IDLE, STAGE_LOAD, STAGE_UNLOAD } new MissionStage[MAX_PLAYERS]; new Float: gPickupCPs[][] = { { 1579.6099,1460.0630,10.8307},//lva { -1353.9780,-238.9976,14.1484 },//sfa { 1563.6893,-2449.4089,13.5547 },//lsa { 389.6915,2530.2002,16.5391 }//vma }; new Float: gDeliverCPs[][] = { { 1563.6893,-2449.4089,13.5547 },//lsa { 389.6915,2530.2002,16.5391 },//vma { 1579.6099,1460.0630,10.8307 },//lva { -1353.9780,-238.9976,14.1484 }//sfa }; public OnPlayerConnect(playerid) { MissionStage[playerid] = STAGE_IDLE; time(); return true; } DeliveryMission(playerid) { if(MissionStage[playerid] == STAGE_IDLE) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519) { new idx, Float: tmp, Float: dist = GetPlayerDistanceFromPoint(playerid, gPickupCPs[0][0], gPickupCPs[0][1], gPickupCPs[0][2]) ; for(new i = 1; i < sizeof gPickupCPs; ++i) { tmp = GetPlayerDistanceFromPoint(playerid, gPickupCPs[i][0], gPickupCPs[i][1], gPickupCPs[i][2]); if(tmp < dist) { dist = tmp; idx = i; } } MissionStage[playerid] = STAGE_LOAD; return SetPlayerCheckpoint(playerid, gPickupCPs[idx][0], gPickupCPs[idx][1], gPickupCPs[idx][2], 20.0); } } else { MissionStage[playerid] = STAGE_IDLE; return DisablePlayerCheckpoint(playerid); } return false; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/work", cmdtext, true) == 0) { if(MissionStage[playerid] != STAGE_IDLE) { return SendClientMessage(playerid, COLOR_RED, "You are already in a work!"); } if(DeliveryMission(playerid)) { return 1; } } if (strcmp("/stopwork", cmdtext, true) == 0) { if(DeliveryMission(playerid)) { GivePlayerMoney(playerid,-10000) return SendClientMessage(playerid, COLOR_RED, "You had Paid $10,000 for stopping your Work!"); } return 1; } return false; } public OnPlayerEnterCheckpoint(playerid) { switch(MissionStage[playerid]) { case STAGE_LOAD: { new rand = random(sizeof gDeliverCPs) ; DisablePlayerCheckpoint(playerid); GameTextForPlayer(playerid, "~g~Passengers Boarding !", 2000, 4); TogglePlayerControllable(playerid, false); // Freeze the player SetTimerEx("Unfreeze", 3000, false, "i", playerid); // Make a 3 second timer for that player to get unfroze SetPlayerCheckpoint(playerid, gDeliverCPs[rand][0], gDeliverCPs[rand][1], gDeliverCPs[rand][2], 10.0); SendClientMessage(playerid, COLOR_GREY, "All Passengers has Been Boarded and Fastened Their Seat Belts!"); MissionStage[playerid] = STAGE_UNLOAD; } case STAGE_UNLOAD: { DisablePlayerCheckpoint(playerid); GameTextForPlayer(playerid, "~g~Passengers UnLoading !", 2000, 4); TogglePlayerControllable(playerid, false); // Freeze the player SetTimerEx("Unfreeze", 3000, false, "i", playerid); // Make a 3 second timer for that player to get unfroze SetPlayerScore(playerid, GetPlayerScore(playerid) + 1); new cash = random(8000); GivePlayerMoney(playerid, cash); new string[64] ; GetPlayerName(playerid, string, MAX_PLAYER_NAME); strcat(string, " Completed a Flight!"); SendClientMessageToAll(COLOR_ORANGE, string); MissionStage[playerid] = STAGE_IDLE; } } return false; } public OnPlayerDeath(playerid, killerid, reason){ MissionStage[playerid] = STAGE_IDLE; DisablePlayerCheckpoint(playerid); return true; } forward Unfreeze(playerid); public Unfreeze(playerid) { TogglePlayerControllable(playerid, true); // Unfreeze the player after 5 seconds return 1; }