Help needed with no one man convoys
#1

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:
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;
}
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.

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");
}
Reply
#2

Convoy_StartMemberJob doesn't even activate Trucker_StartRandomJob
Reply
#3

No indeed... It just checks whether the leader has a job. If yes it starts the job for everyone. Now how will i not make it activate when theres only 1 guy in the convoy
Reply
#4

Quote:
Originally Posted by thimo
Посмотреть сообщение
No indeed... It just checks whether the leader has a job. If yes it starts the job for everyone. Now how will i not make it activate when theres only 1 guy in the convoy
Maybe try to loop trough all members in his convoy and if there is only one member then return..
Reply
#5

Example? Because in Trucker_SetRandomJob i cannot select the convoy... :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)