15.12.2013, 15:05
if a player doing a mission and get out the car. you have timeleft to get back in car. Well, TimeLeft don't move at all.
disappear it
Here code:
Max mission fail
disappear it
Here code:
Max mission fail
Код:
#define Job_TimeToFailMission 60
Код:
PlayerLeftVehicle(playerid) { // Setup local variables new TimeLeft[5]; // Reduce the time left by 1 APlayerData[playerid][VehicleTimerTime] = APlayerData[playerid][VehicleTimerTime] - 1; // Convert the time left to a string for displaying valstr(TimeLeft, APlayerData[playerid][VehicleTimerTime]); // Display the time left // Send only one message to inform the player what he must do if (APlayerData[playerid][VehicleTimerTime] == (Job_TimeToFailMission - 1)) { // Check the class of the player and inform them what to do switch (APlayerData[playerid][PlayerClass]) { case Trucker: { if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0) { new string[64]; format(string,sizeof(string),"trailer had gone~n~%s", TimeLeft); GameTextForPlayer(playerid, string, 2000, 4); } if(IsPlayerInAnyVehicle(playerid) == 0) { new string[64]; format(string,sizeof(string),"Get back in vehicle~n~%s", TimeLeft); GameTextForPlayer(playerid, string, 2000, 4); } } case BusDriver: { SendClientMessage(playerid, 0xFFFFFFFF, TXT_BusDriverMustEnterBus); new string[64]; //format(string,sizeof(string),"Get back in veh ~n~%s", TimeLeft); GameTextForPlayer(playerid, string, 1000, 4); } case Courier: { SendClientMessage(playerid, 0xFFFFFFFF, TXT_CourierMustEnterVehicle); } case RoadWorker: { SendClientMessage(playerid, 0xFFFFFFFF, TXT_RoadworkerMustEnterVehicle); } } } }
Код:
Dialog_TruckerSelectEndLoc(playerid, response, listitem) { // Setup local variables new RouteText[128], loadName[50], startlocName[50], endlocName[50], LoadMsg[128], Float:x, Float:y, Float:z, ProductID; // Just close the dialog if the player clicked "Cancel" if(!response) return 1; // Get the LoadID that's stored in the player's account 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, TXT_HaulingCargoFromToPickup, loadName, startlocName, endlocName); // Set the TextDraw so the player can see it TextDrawSetString(APlayerData[playerid][MissionText], 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); // Set the job-fail-time for the global vehicle-timer APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission; // Inform the player that he must load his goods format(LoadMsg, 128, TXT_PickupCargoAt, loadName, startlocName); SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg); return 1; }