01.08.2013, 11:26
Hello,
I am making it so people cant do one man convoys. Now it is half working. It gives me a message No one man convoys but it still starts the job because of the Trucker_StartRandomJob. Because the timer checks if the leader is started the convoy. This is my Trucker_StartRandomJob:
The Convoy_Start is working. It says no one man convoys when you are alone in the convoy. But i dont know how to get it working so it doesnt excecute the Trucker_StartRandomJob.
I am making it so people cant do one man convoys. Now it is half working. It gives me a message No one man convoys but it still starts the job because of the Trucker_StartRandomJob. Because the timer checks if the leader is started the convoy. This is my Trucker_StartRandomJob:
pawn Код:
Trucker_StartRandomJob(playerid)
{
// Check if a job could be set correctly (player must be driving a valid trucking vehicle)
if (Trucker_SetRandomJob(playerid) != 0)
{
// Setup local variables
new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, LoadMsg[128];
// Job has started
APlayerData[playerid][JobStarted] = true;
// Set jobstep to 1 (going to load the goods)
APlayerData[playerid][JobStep] = 1;
// Get the startlocation, endlocation and the load texts
format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);
// Combine it all 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", Load, StartLoc, EndLoc);
// 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", Load, StartLoc);
SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg);
}
return 1;
}
pawn Код:
Convoy_StartMemberJob(playerid, Convoy)
{
// Setup local variables
new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, LoadMsg[128];
// Job has started
APlayerData[playerid][JobStarted] = true;
// Copy the convoy-data to this player
APlayerData[playerid][LoadID] = AConvoys[Convoy][LoadID];
APlayerData[playerid][JobLoc1] = AConvoys[Convoy][Location1];
APlayerData[playerid][JobLoc2] = AConvoys[Convoy][Location2];
// 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;
// Get the startlocation, endlocation and the load texts
format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);
// Combine it all 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", Load, StartLoc, EndLoc);
// 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", Load, StartLoc);
SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg);
SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Meet the other members of the convoy at the loading point");
}