26.09.2012, 13:15
it loaded at same....
Код:
new Float:Airports[][3] = { {1476.5433,1465.9758,10.8281}, {1869.8599,-2493.2256,13.5547}, {-1437.0648,48.4609,14.1484} }; Float:GetDisFromPlayerToPoint(playerid,Float:x,Float:y,Float:z) { new Float:xp,Float:yp,Float:zp; GetPlayerPos(playerid,xp,yp,zp); return floatsqroot(floatpower(floatabs(floatsub(x,xp)),2)+floatpower(floatabs(floatsub(y,yp)),2)+floatpower(floatabs(floatsub(z,zp)),2)); } GetClosestAirport(playerid) { new Airport = -1; new Float:dis = 999999.0; for(new x = 0 ; x < sizeof(Airports); x++) { if(GetDisFromPlayerToPoint(playerid,Airports[x][0],Airports[x][1],Airports[x][2]) < dis) { dis = GetDisFromPlayerToPoint(playerid,Airports[x][0],Airports[x][1],Airports[x][2]); Airport = x; } } return Airport; }
Код:
if(strcmp(cmdtext, "/work", true) == 0) { if (GetPVarInt(playerid, "Flight") == 1) { return SendClientMessage(playerid, COLOR_RED, "You are already in a flight!"); } if (GetPVarInt(playerid, "Work") > 0) { return SendClientMessage(playerid, COLOR_RED, "You are already in a work!"); } new IslandName[48], szString[128]; SetPVarInt(playerid, "Work", 1); MissionVehicle[playerid] = GetPlayerVehicleID(playerid); new Float:Airports[][3] GetClosestAirport(playerid, true); switch (GetClosestAirport(3)) { case 0: { Island[Las_Venturas][playerid]=SetPlayerFlightCheckpoint(playerid, 1476.5433,1465.9758,10.8281, 10.0); IslandName="Las Venturas"; } case 1: { Island[Los_Santos][playerid] = SetPlayerFlightCheckpoint(playerid, 1869.8599,-2493.2256,13.5547, 10.0); IslandName="Los Santos"; } case 2: { Island[San_Fierro][playerid] = SetPlayerFlightCheckpoint(playerid, -1437.0648,48.4609,14.1484, 10.0); IslandName="San Fierro"; } } FirstAPName[playerid] = IslandName; format(szString, 128, "Go to %s to pick up the passengers!", IslandName); WorkTimer[playerid] = SetTimerEx("WorkingMinutes", 60000, true, "i", playerid); SendClientMessage(playerid, COLOR_LIGHTGREEN, szString); return 1; }