05.02.2014, 12:16
pawn Код:
Dialog_TruckerSelectEndLoc(playerid, response, listitem)
{
new RouteText[128], loadName[50], startlocName[50], endlocName[50], LoadMsg[128], Float:x, Float:y, Float:z, ProductID;
if(!response) return 1;
ProductID = APlayerData[playerid][LoadID];
// Store the chosen end-location in the player's account
APlayerData[playerid][JobLoc2] = ALoads[ProductID][ToLocations][listitem];
// Get the names for the load, startlocation and endlocation
format(loadName, 50, "%s", ALoads[ProductID][LoadName]);
format(startlocName, 50, "%s", ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
format(endlocName, 50, "%s", ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
// Job has started
APlayerData[playerid][JobStarted] = true;
// Store the vehicleID (required to be able to check if the player left his vehicle)
APlayerData[playerid][VehicleID] = GetPlayerVehicleID(playerid);
// Store the trailerID (required to be able to check if the player lost his trailer)
APlayerData[playerid][TrailerID] = GetVehicleTrailer(GetPlayerVehicleID(playerid));
// Set jobstep to 1 (going to load the goods)
APlayerData[playerid][JobStep] = 1;
// Combine all data into a string for the TextDraw (the player can see this all the time) to describe the mission
format(RouteText, 255, "~w~Hauling ~b~%s~w~ from ~r~%s~w~ to %s", loadName, startlocName, endlocName);
// Set the TextDraw so the player can see it
TextDrawSetString(Mission[playerid], RouteText);
// Grab the x, y, z positions for the first location
x = ALocations[APlayerData[playerid][JobLoc1]][LocX];
y = ALocations[APlayerData[playerid][JobLoc1]][LocY];
z = ALocations[APlayerData[playerid][JobLoc1]][LocZ];
// Create a checkpoint where the player should load the goods
SetPlayerCheckpoint(playerid, x, y, z, 7);
// Start a timer that ticks every second to see if the player is still inside his vehicle
APlayerData[playerid][VehicleTimerTime] = Trucker_TimeToFailMission;
APlayerData[playerid][VehicleTimer] = SetTimerEx("Trucker_VehicleTimer", 1000, true, "d" , playerid);
// Inform the player that he must load his goods
format(LoadMsg, 128, "{00FF00}Pickup the %s at %s", loadName, startlocName);
SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg);
return 1;
}