SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 29/12/2014, 12:22 AM   #1
furyzaz
Little Clucker
 
Join Date: Oct 2013
Posts: 19
Reputation: 0
Question Server de Caminhoneiro

Olá galera, estou com 1 servidor de Caminhoneiro novo, com base na PCC_Trucking e estou com 1 dúvida.

os players estão achando que o valor das entregas de caminhão está muito baixa!

Já tentei várias vezes aumentar este valor, porem não obtive sucesso!

Gostaria de saber se alguém pode me ajudar.

ARQUIVO:

PPC_MissionsTrucking.inc :

pawn Code:
// Forward the function to Load or Unload goods during missions (used by a timer)
forward Trucker_LoadUnload(playerid);
// forward the function used to check if the player is still inside his vehicle during a job
forward Trucker_VehicleTimer(playerid);
// This function is called when a truckdriver enters a checkpoint
Trucker_OnPlayerEnterCheckpoint(playerid)
{

    switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
    {
        case VehicleFlatbed, VehicleDFT30, VehicleCementTruck, VehicleLineRunner, VehicleTanker, VehicleRoadTrain, VehicleReefer: // Plane (Shamal), Plane (Nevada), helicopter (Maverick)

    if (GetPlayerVehicleID(playerid) == APlayerData[playerid][VehicleID])
    {
        if (APlayerData[playerid][TrailerID] == GetVehicleTrailer(GetPlayerVehicleID(playerid)))
        {

            switch (APlayerData[playerid][JobStep])
            {
                case 1:
                {
                    new BonusMsg[128], Name[24];
                    GetPlayerName(playerid, Name, sizeof(Name));
                    if (RandomBonusMission[MissionFinished] == false)
                    {
                        if (RandomBonusMission[RandomLoad] == APlayerData[playerid][LoadID])
                        {
                            if (RandomBonusMission[RandomStartLoc] == APlayerData[playerid][JobLoc1])
                            {
                                if (RandomBonusMission[RandomEndLoc] == APlayerData[playerid][JobLoc2])
                                {

                                    format(BonusMsg, 128, "{FF1493}[BÔNUS] {BF3EFF}%s já está no primeiro carregamento da missão bônus!", Name);
                                    SendClientMessageToAll(0xFFFFFFFF, BonusMsg);

                                }
                            }
                        }
                    }
                    GameTextForPlayer(playerid, "~w~Carregando~n~Por favor espere", 5000, 4);
                }
                case 2, 3:
                {
                    GameTextForPlayer(playerid, "~w~Descarregando~n~Por favor espere", 5000, 4);
                }
            }

            // Disable the player's actions (he cannot move anymore)
            TogglePlayerControllable(playerid, 0);
            // Start a timer (Public function "LoadUnload(playerid)" gets called when the timer runs out)
            APlayerData[playerid][LoadingTimer] = SetTimerEx("Trucker_LoadUnload", 10000, false, "d" , playerid);
        }
        else
            SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[ERRO] {009D4F}Você precisa ter o seu reboque atrelado para proceder");
    }
    else
        SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[ERRO] {009D4F}Você precisa estar no seu veiculo para proceguir");
       
        default: SendClientMessage(playerid, 0xFF0000FF, "{FFFF00}[ERRO] {009D4F}Você não pode carregar com esse tipo de veículo.");
    }

    return 1;
}

// After a truckdriver entered a checkpoint, a timer is created. This function is called when the timer runs out
public Trucker_LoadUnload(playerid)
{
    // Check if the player is inside a convoy
    if (APlayerData[playerid][InConvoy] == true)
    {
        // If the player just loaded his goods at the loading-point
        if (APlayerData[playerid][JobStep] == 1)
        {
            APlayerData[playerid][JobStep] = 2; // Set the next step of the convoy-job (wait until all members have loaded their cargo)
            PlayerTextDrawSetString(playerid, Trabalho[playerid], "Espere todos os membros carregar suas cargas");
            PlayerInfo[playerid][Carregou] = true;
        }

        // If the player just delivered his goods at the unloading-point
        if (APlayerData[playerid][JobStep] == 3)
        {
            APlayerData[playerid][JobStep] = 4; // Set the next step of the convoy-job (wait until all members have unloaded their cargo)
            PlayerTextDrawSetString(playerid, Trabalho[playerid], "Espere todos os membros descarregar suas cargas");
            PlayerInfo[playerid][Carregou] = false;
        }

        DisablePlayerCheckpoint(playerid); // Delete the loading/unloading-checkpoint
        TogglePlayerControllable(playerid, 1); // Enable the player again (he can move again)

        return 1; // Don't allow the rest of the function to be executed
    }

    // If the player isn't inside a convoy, this part is executed

    // Check the JobStep
    switch (APlayerData[playerid][JobStep])
    {
        case 1: // Player must load his goods
        {
            // Setup local variables
            new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, UnloadMsg[100];
            // Set JobStep to 2 (unloading goods)
            APlayerData[playerid][JobStep] = 2;
            // Delete the loading-checkpoint
            DisablePlayerCheckpoint(playerid);
            // 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]);

            // Randomly set the load as overloaded (15% chance the load is overloaded)
            Trucker_SetRandomOverloaded(playerid);
            // Pre-format the missiontext (there may be some parts appended when overloaded/mafiaload
            format(RouteText, 255, "~w~Leve ~y~%s~w~ de ~y~%s ~w~para ~y~%s~w~", Load, StartLoc, EndLoc);
            // Check if the player is overloaded
            if (APlayerData[playerid][Overloaded] == true)
            {
                // Add "(OL)" to the missiontext to let the player know he's been overloaded
                format(RouteText, 255, "%s%s", RouteText, " ~r~(SC)~w~");
                // Send a message to the player to let him know he's been overloaded
                SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[INFO] {009D4F}Você está sobrecarregado, cuidado com os policiais!");
            }
            // Check if the player is carrying a mafia-load
            if (ALoads[APlayerData[playerid][LoadID]][Mafia] == true)
            {
                // Add "(ML)" to the missiontext to let the player know his load is wanted by the mafia
                format(RouteText, 255, "%s%s", RouteText, " ~r~(MF)~w~");
                // If the player is carrying a mafia-load, inform him about it
                GameTextForPlayer(playerid, "~r~a mafia podera roubar sua carga~n~cuidado", 5000, 4);
                // Also set the data for the player to indicate he's carrying a mafiaload
                APlayerData[playerid][MafiaLoad] = true;
                // Also set the player's trailer ID (or the vehicle itself) as Mafia-load in the array "AVehicleMafiaLoad"
                if (APlayerData[playerid][TrailerID] == 0)
                    AVehicleData[APlayerData[playerid][VehicleID]][MafiaLoad] = true; // The player has no trailer, so set his main vehicle as wanted by the mafia
                else
                    AVehicleData[APlayerData[playerid][TrailerID]][MafiaLoad] = true; // The player has a trailer, so set his trailer as wanted by the mafia
            }

            // Set the TextDraw so the player can see it
            PlayerTextDrawSetString(playerid, Trabalho[playerid], RouteText);

            // Grab the x, y, z positions for the second location (to unload the goods)
            x = ALocations[APlayerData[playerid][JobLoc2]][LocX];
            y = ALocations[APlayerData[playerid][JobLoc2]][LocY];
            z = ALocations[APlayerData[playerid][JobLoc2]][LocZ];
            // Create a checkpoint where the player should unload the goods
            SetPlayerCheckpoint(playerid, x, y, z, 7);
            // Inform the player that he must unload his goods
            format(UnloadMsg, 100, "{FFFF00}[INFO] {009D4F}Entregue %s para %s", Load, EndLoc);
            SendClientMessage(playerid, 0xFFFFFFFF, UnloadMsg);
        }
        case 2: // Player is delivering his goods
        {

            new Float:x1, Float:y1, Float:x2, Float:y2, Float:Distance, Message[128], Payment, Bonus;
            // Grab the x, y, z positions for the first location (to load the goods)
            x1 = ALocations[APlayerData[playerid][JobLoc1]][LocX];
            y1 = ALocations[APlayerData[playerid][JobLoc1]][LocY];
            // Grab the x, y, z positions for the second location (to unload the goods)
            x2 = ALocations[APlayerData[playerid][JobLoc2]][LocX];
            y2 = ALocations[APlayerData[playerid][JobLoc2]][LocY];
            // Calculate the distance between both points
            Distance = floatsqroot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));

            // Calculate the payment for the player
            Payment = floatround((Distance * ALoads[APlayerData[playerid][LoadID]][PayPerUnit]), floatround_floor);


            // Setup local variables
            new StartLoc[50], EndLoc[50], Load[50], Msg1[128], Msg2[128], Name[24], BonusMsg[128], dnh[20];

            // Get the player name
            GetPlayerName(playerid, Name, sizeof(Name));
            // 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]);

            // Construct the message sent to all players that this player completed a trucking mission
            format(Msg1, 128, "Caminhoneiro %s Transportou %s e recebeu {009D4F}R$ %i, {D2B48C}distancia: %d% KM", Name, Load, Payment, floatround(Distance)/10);
            format(Msg2, 128, "de %s para %s", StartLoc, EndLoc);
            SendClientMessageToAll(0xFF8570FF, Msg1);
            SendClientMessageToAll(0xFF8570FF, Msg2);
            format(dnh, 128, "~w~+~g~R$~y~%i", Payment);
            GameTextForPlayer(playerid, dnh, 5000, 0);
            Passou[playerid] = false;
            if (RandomBonusMission[MissionFinished] == false)
            {
                // Check all paramters (load, startlocation and end-location)
                if (RandomBonusMission[RandomLoad] == APlayerData[playerid][LoadID])
                    if (RandomBonusMission[RandomStartLoc] == APlayerData[playerid][JobLoc1])
                        if (RandomBonusMission[RandomEndLoc] == APlayerData[playerid][JobLoc2])
                        {
                            Payment = Payment * 2; // Double the payment is the player was the first to do the bonus mission
                            RandomBonusMission[MissionFinished] = true; // Only one player can do the bonus mission, a new one is chosen next
                            format(BonusMsg, 128, "{FF1493}[BÔNUS] {CFCFCF}Caminhoneiro %s concluiu a missão bônus com sucesso", Name);
                            SendClientMessageToAll(0xFFFFFFFF, BonusMsg);
                            ContarBonus--;
                            FazendoBonus[playerid] = 0;
                            Passou[playerid] = false;
                            for (new i; i < MAX_PLAYERS; i++)
                            {
                                if (FazendoBonus[i] == 1)
                                {
                                    FazendoBonus[i] = 0;
                                }
                            }
                        }
            }
            RewardPlayer(playerid, Payment, 100);
         // Send a message to let the player know he finished his mission and got paid
            format(Message, 128, "{FFFF00}[INFO] {009D4F}Você terminou sua missão e recebeu $%i", Payment);
            SendClientMessage(playerid, 0xFFFFFFFF, Message);
           

            // Add 25% bonus if the player has been overloaded
            if (APlayerData[playerid][Overloaded] == true)
            {
                // Calculate the bonus
                Bonus = (Payment * 60) / 800;
                // Pay the bonus to the player
                RewardPlayer(playerid, Bonus, 0);
                // Send a message to let the player know he was overloaded and got paid
                format(Message, 128, "{FFFF00}[INFO] {009D4F}Você também ganhou um bônus por estar sobrecarregado: $%i", Bonus);
                SendClientMessage(playerid, 0xFFFFFFFF, Message);
            }

            // Add 50% bonus if the player has delivered a mafia load (mafia couldn't steal his load)
            if (APlayerData[playerid][MafiaLoad] == true)
            {
                // Calculate the bonus
                Bonus = (Payment * 100) / 800;
                // Pay the bonus to the player
                RewardPlayer(playerid, Bonus, 0);
                // Send a message to let the player know he was overloaded and got paid
                format(Message, 128, "{FFFF00}[INFO] {009D4F}Voce tambem ganhou um bonus para a entrega uma carga pra mafia: $%i", Bonus);
                SendClientMessage(playerid, 0xFFFFFFFF, Message);
            }

            // Add 10% bonus if the player has delivered the load with his own truck
            if (AVehicleData[APlayerData[playerid][VehicleID]][Owned] == true)
            {
                // Calculate the bonus
                Bonus = (Payment * 80) / 800;
                // Pay the bonus to the player
                RewardPlayer(playerid, Bonus, 0);
                // Send a message to let the player know he was overloaded and got paid
                format(Message, 128, "{FFFF00}[INFO] {009D4F}Você tambem ganhou um bonus por usar seu proprio caminhao: $%i", Bonus);
                SendClientMessage(playerid, 0xFFFFFFFF, Message);
            }

            // Also add score-points to the score of the player based on the distance between the loading and unloading points
            if (Distance > 3000.0)
                RewardPlayer(playerid, 0, 4); // Distance is larger than 3000 units, so add 2 points
            else
                RewardPlayer(playerid, 0, 3); // Distance is less than 3000 units, so add 1 point

            // Increase the stats for completing a trucking job
            APlayerData[playerid][StatsTruckerJobs]++;
            // Also save the data (in case the server crashes, progress would be lost)
            PlayerFile_Save(playerid);

            // End the current trucker job (clear mission-data)
            Trucker_EndJob(playerid);
        }
    }

    // Enable the player again (he can move again)
    TogglePlayerControllable(playerid, 1);

    return 1;
}

// This function randomly determines if the load is overloaded and adds 2 to the playerwanted-level
Trucker_SetRandomOverloaded(playerid)
{
    // Setup local variables
    new Name[24], Msg[128];

    // Check the vehicle model that the player is driving
    switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
    {
        case VehicleCementTruck: return 0; // A cementtruck cannot be overloaded
        case VehicleLineRunner, VehicleTanker, VehicleRoadTrain: // When driving a LineRunner, Tanker or RoadTrain
        {
            // A Fluids-trailer cannot be overloaded
            if (GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == VehicleTrailerFluids) return 0;
        }
    }

    // The player wasn't driving one of the above vehicle models, so this one can be overloaded
    // There is a 15% chance that your load will be overloaded
    if (random(100) <= 15)
    {
        // Set overloaded for this player to True
        APlayerData[playerid][Overloaded] = true;
        // Add 2 to the player's wanted level
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
        // Inform the police this trucker is overloaded
        GetPlayerName(playerid, Name, sizeof(Name));
        format(Msg, 128, "{FFFF00}[INFO] {009D4F}Caminhoneiro %s está sobrecarregado, pare-o e multe-o", Name);
        Police_SendMessage(Msg);
    }

    return 1;
}

// This function is called when a truckdriver wants to start a job by entering "/work" and has no truckers license
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~Leve ~y~%s~w~ de ~y~%s ~w~para ~y~%s", Load, StartLoc, EndLoc);
        // Set the TextDraw so the player can see it
        PlayerTextDrawSetString(playerid, Trabalho[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}Pegue %s em %s", Load, StartLoc);
        SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg);
        new Convoy, LeaderID, MemberName[24], Msg[128], Membros;
        Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
        LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
        Membros = Convoy_CountMembers(Convoy);
        if (APlayerData[playerid][InConvoy] == true)
        {

            if (LeaderID == playerid)
            {
                GetPlayerName(playerid, MemberName, sizeof(MemberName));
                format(Msg, 128, "[CONVOY] O Convoy do player %s acaba de partir com seus %i membros!", MemberName, Membros);
                SendClientMessageToAll(0x00FF00FF, Msg);
            }
        }
    }

    return 1;
}

// This function sets a random job based on the player's vehicle and returns 1 if a job has been set
// The function returns 0 if a job couldn't be set (if the player is driving an invalid vehicle to start trucking-jobs)
Trucker_SetRandomJob(playerid)
{
    // If the player is the driver of the vehicle (GetPlayerVehicleSeat returns -1 if the player is not in a vehicle)
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        // Check the vehicle-model of the player to decide which job the player can get
        switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case VehicleReefer: // Select a random job from the routes that don't require a trailer and store the data for the player (Flatbed or DFT-30)
                return Trucker_SetRandomJobData(playerid, PCV_Reefer);
            case VehicleFlatbed, VehicleDFT30: // Select a random job from the routes that don't require a trailer and store the data for the player (Flatbed or DFT-30)
                return Trucker_SetRandomJobData(playerid, PCV_TruckerNoTrailer);
            case VehicleCementTruck: // Select a random job from the routes for cementtrucks and store the data for the player
                return Trucker_SetRandomJobData(playerid, PCV_TruckerCementTruck);
            case VehicleLineRunner, VehicleTanker, VehicleRoadTrain: // If the player's vehicle is a "LineRunner", "Tanker" or "RoadTrain"
            {
                // Select a job based on the trailer model of the player
                switch (GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))))
                {
                    case VehicleTrailerCargo, VehicleTrailerCargo2: // Select a random job from the routes that require a cargo-trailer and store the data for the player
                        return Trucker_SetRandomJobData(playerid, PCV_TruckerCargoTrailer);
                    case VehicleTrailerOre: // Select a random job from the routes that require a ore-trailer and store the data for the player
                        return Trucker_SetRandomJobData(playerid, PCV_TruckerOreTrailer);
                    case VehicleTrailerFluids: // Select a random job from the routes that require a fluids-trailer and store the data for the player
                        return Trucker_SetRandomJobData(playerid, PCV_TruckerFluidsTrailer);
                }
            }
        }
        new Convoy, LeaderID, MemberName[24], Msg[128], Membros;
        Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
        LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
        Membros = Convoy_CountMembers(Convoy);
        if (APlayerData[playerid][InConvoy] == true)
        {

            if (LeaderID == playerid)
            {
                GetPlayerName(playerid, MemberName, sizeof(MemberName));
                format(Msg, 128, "[CONVOY] O Convoy do player %s acaba de partir com seus %i membros!", MemberName, Membros);
                SendClientMessageToAll(0x00FF00FF, Msg);
            }
        }
    }
    // If no job could be set correctly, return 0
    return 0;
}

// This function chooses a random product for the trucker with a given vehicle-type and also the start-location and end-location
Trucker_SetRandomJobData(playerid, PCV_Needed)
{
    // Get a random Load from the loads that are defined for truckers with the given vehicle-type
    APlayerData[playerid][LoadID] = Product_GetRandom(PCV_Needed);
    // Get a random start-location and end-location for this load
    APlayerData[playerid][JobLoc1] = Product_GetRandomStartLoc(APlayerData[playerid][LoadID]);
    APlayerData[playerid][JobLoc2] = Product_GetRandomEndLoc(APlayerData[playerid][LoadID]);

    // 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));

    // Return 1 to indicate that a job has been set correctly
    return 1;
}



// A timer that runs every second to see if the player is still inside his vehicle
public Trucker_VehicleTimer(playerid)
{
    new OldVehicleID = APlayerData[playerid][VehicleID];
    new NewVehicleID = GetPlayerVehicleID(playerid);
    new OldTrailerID = APlayerData[playerid][TrailerID];
    new NewTrailerID = GetVehicleTrailer(GetPlayerVehicleID(playerid));

    if (APlayerData[playerid][VehicleTimerTime] != 0)
    {
        // If VehicleID and TrailerID are still the same as when the player accepted the job
        if ((OldVehicleID == NewVehicleID) && (OldTrailerID == NewTrailerID))
            APlayerData[playerid][VehicleTimerTime] = Trucker_TimeToFailMission; // Reset the time before the mission fails
        else // One (or both) aren't still the same (player lost his trailer or vehicle)
        {
            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
            GameTextForPlayer(playerid, TimeLeft, 1000, 4);
            // Send only one message to inform the player what he must do
            if (APlayerData[playerid][VehicleTimerTime] == (Trucker_TimeToFailMission - 1))
                SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[ERRO] {009D4F}Voce deve estar dentro do seu veiculo ou recolocar seu reboque");
        }
    }
    else
    {
        // Time left has reached 0
        Trucker_EndJob(playerid);
        // If the player is part of a convoy, kick him from it (as he failed his mission, the rest of the convoy would be stuck)
        Convoy_Leave(playerid);
        // Inform the player that he failed the mission
        GameTextForPlayer(playerid, "~w~voce falhou na sua missao.", 5000, 4);
        // Reduce the player's cash by 1000
        //RewardPlayer(playerid, -1000, 0);
    }
}

// This function is used to cleanup the current job
Trucker_EndJob(playerid)
{
    if (APlayerData[playerid][JobStarted] == true)
    {
        // Clear the Mafia-wanted status of the vehicle (or trailer) in the array "AVehicleData"
        if (APlayerData[playerid][TrailerID] == 0)
            AVehicleData[APlayerData[playerid][VehicleID]][MafiaLoad] = false; // The player has no trailer, so clear his main vehicle as wanted by the mafia
        else
            AVehicleData[APlayerData[playerid][TrailerID]][MafiaLoad] = false; // The player has a trailer, so clear his trailer as wanted by the mafia

        // Clear all data about the job from the player, so he can start a new one
        APlayerData[playerid][JobStarted] = false;
        APlayerData[playerid][JobStep] = 0;
        APlayerData[playerid][JobID] = 0;
        APlayerData[playerid][VehicleTimerTime] = 0;
        APlayerData[playerid][VehicleID] = 0;
        APlayerData[playerid][TrailerID] = 0;
        APlayerData[playerid][LoadID] = 0;
        APlayerData[playerid][JobLoc1] = 0;
        APlayerData[playerid][JobLoc2] = 0;
        APlayerData[playerid][MafiaLoad] = false;

        // Delete the checkpoint
        DisablePlayerCheckpoint(playerid);
        // Reset the missiontext
        PlayerTextDrawSetString(playerid, Trabalho[playerid], "Nenhum trabalho no momento. Digite \"~y~/trabalhar ou /t~w~\" para iniciar um trabalho");
        // Kill the VehicleTimer and LoadingTimer
        KillTimer(APlayerData[playerid][VehicleTimer]);
        KillTimer(APlayerData[playerid][LoadingTimer]);
        if(FazendoBonus[playerid] == 1)
        {
            ContarBonus--;
            FazendoBonus[playerid] = 0;
        }
        // Check if the player has been overloaded
        if (APlayerData[playerid][Overloaded] == true)
        {
            // Clear the overloaded status of the player
            APlayerData[playerid][Overloaded] = false;

            // Check if the player has a wanted level of 2 or higher
            if (GetPlayerWantedLevel(playerid) >= 2)
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) - 2); // Reduce the wanted level by 2
            else
                SetPlayerWantedLevel(playerid, 0); // If the player has a wanted level of less than 2, reset the wanted level to 0
        }
    }

    return 1;
}

Alguém pode me ajudar? ficarei muito grato.

Obrigado
furyzaz is offline   Reply With Quote
Old 29/12/2014, 12:55 AM   #2
Skun Fly
Big Clucker
 
Skun Fly's Avatar
 
Join Date: Jan 2012
Location: Marte
Posts: 162
Reputation: 4
Default Re: Server de Caminhoneiro

O valor do pagamento é atribuido nesta linha:

pawn Code:
Payment = floatround((Distance * ALoads[APlayerData[playerid][LoadID]][PayPerUnit]), floatround_floor);

Então se quer o dobro do pagamento é só alterar nessa linha por exemplo:

pawn Code:
Payment = floatround((2*Distance * ALoads[APlayerData[playerid][LoadID]][PayPerUnit]), floatround_floor);

Código completo:
pawn Code:
// Forward the function to Load or Unload goods during missions (used by a timer)
forward Trucker_LoadUnload(playerid);
// forward the function used to check if the player is still inside his vehicle during a job
forward Trucker_VehicleTimer(playerid);
// This function is called when a truckdriver enters a checkpoint
Trucker_OnPlayerEnterCheckpoint(playerid)
{

    switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
    {
        case VehicleFlatbed, VehicleDFT30, VehicleCementTruck, VehicleLineRunner, VehicleTanker, VehicleRoadTrain, VehicleReefer: // Plane (Shamal), Plane (Nevada), helicopter (Maverick)

    if (GetPlayerVehicleID(playerid) == APlayerData[playerid][VehicleID])
    {
        if (APlayerData[playerid][TrailerID] == GetVehicleTrailer(GetPlayerVehicleID(playerid)))
        {

            switch (APlayerData[playerid][JobStep])
            {
                case 1:
                {
                    new BonusMsg[128], Name[24];
                    GetPlayerName(playerid, Name, sizeof(Name));
                    if (RandomBonusMission[MissionFinished] == false)
                    {
                        if (RandomBonusMission[RandomLoad] == APlayerData[playerid][LoadID])
                        {
                            if (RandomBonusMission[RandomStartLoc] == APlayerData[playerid][JobLoc1])
                            {
                                if (RandomBonusMission[RandomEndLoc] == APlayerData[playerid][JobLoc2])
                                {

                                    format(BonusMsg, 128, "{FF1493}[BÔNUS] {BF3EFF}%s já está no primeiro carregamento da missão bônus!", Name);
                                    SendClientMessageToAll(0xFFFFFFFF, BonusMsg);

                                }
                            }
                        }
                    }
                    GameTextForPlayer(playerid, "~w~Carregando~n~Por favor espere", 5000, 4);
                }
                case 2, 3:
                {
                    GameTextForPlayer(playerid, "~w~Descarregando~n~Por favor espere", 5000, 4);
                }
            }

            // Disable the player's actions (he cannot move anymore)
            TogglePlayerControllable(playerid, 0);
            // Start a timer (Public function "LoadUnload(playerid)" gets called when the timer runs out)
            APlayerData[playerid][LoadingTimer] = SetTimerEx("Trucker_LoadUnload", 10000, false, "d" , playerid);
        }
        else
            SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[ERRO] {009D4F}Você precisa ter o seu reboque atrelado para proceder");
    }
    else
        SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[ERRO] {009D4F}Você precisa estar no seu veiculo para proceguir");
       
        default: SendClientMessage(playerid, 0xFF0000FF, "{FFFF00}[ERRO] {009D4F}Você não pode carregar com esse tipo de veículo.");
    }

    return 1;
}

// After a truckdriver entered a checkpoint, a timer is created. This function is called when the timer runs out
public Trucker_LoadUnload(playerid)
{
    // Check if the player is inside a convoy
    if (APlayerData[playerid][InConvoy] == true)
    {
        // If the player just loaded his goods at the loading-point
        if (APlayerData[playerid][JobStep] == 1)
        {
            APlayerData[playerid][JobStep] = 2; // Set the next step of the convoy-job (wait until all members have loaded their cargo)
            PlayerTextDrawSetString(playerid, Trabalho[playerid], "Espere todos os membros carregar suas cargas");
            PlayerInfo[playerid][Carregou] = true;
        }

        // If the player just delivered his goods at the unloading-point
        if (APlayerData[playerid][JobStep] == 3)
        {
            APlayerData[playerid][JobStep] = 4; // Set the next step of the convoy-job (wait until all members have unloaded their cargo)
            PlayerTextDrawSetString(playerid, Trabalho[playerid], "Espere todos os membros descarregar suas cargas");
            PlayerInfo[playerid][Carregou] = false;
        }

        DisablePlayerCheckpoint(playerid); // Delete the loading/unloading-checkpoint
        TogglePlayerControllable(playerid, 1); // Enable the player again (he can move again)

        return 1; // Don't allow the rest of the function to be executed
    }

    // If the player isn't inside a convoy, this part is executed

    // Check the JobStep
    switch (APlayerData[playerid][JobStep])
    {
        case 1: // Player must load his goods
        {
            // Setup local variables
            new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, UnloadMsg[100];
            // Set JobStep to 2 (unloading goods)
            APlayerData[playerid][JobStep] = 2;
            // Delete the loading-checkpoint
            DisablePlayerCheckpoint(playerid);
            // 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]);

            // Randomly set the load as overloaded (15% chance the load is overloaded)
            Trucker_SetRandomOverloaded(playerid);
            // Pre-format the missiontext (there may be some parts appended when overloaded/mafiaload
            format(RouteText, 255, "~w~Leve ~y~%s~w~ de ~y~%s ~w~para ~y~%s~w~", Load, StartLoc, EndLoc);
            // Check if the player is overloaded
            if (APlayerData[playerid][Overloaded] == true)
            {
                // Add "(OL)" to the missiontext to let the player know he's been overloaded
                format(RouteText, 255, "%s%s", RouteText, " ~r~(SC)~w~");
                // Send a message to the player to let him know he's been overloaded
                SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[INFO] {009D4F}Você está sobrecarregado, cuidado com os policiais!");
            }
            // Check if the player is carrying a mafia-load
            if (ALoads[APlayerData[playerid][LoadID]][Mafia] == true)
            {
                // Add "(ML)" to the missiontext to let the player know his load is wanted by the mafia
                format(RouteText, 255, "%s%s", RouteText, " ~r~(MF)~w~");
                // If the player is carrying a mafia-load, inform him about it
                GameTextForPlayer(playerid, "~r~a mafia podera roubar sua carga~n~cuidado", 5000, 4);
                // Also set the data for the player to indicate he's carrying a mafiaload
                APlayerData[playerid][MafiaLoad] = true;
                // Also set the player's trailer ID (or the vehicle itself) as Mafia-load in the array "AVehicleMafiaLoad"
                if (APlayerData[playerid][TrailerID] == 0)
                    AVehicleData[APlayerData[playerid][VehicleID]][MafiaLoad] = true; // The player has no trailer, so set his main vehicle as wanted by the mafia
                else
                    AVehicleData[APlayerData[playerid][TrailerID]][MafiaLoad] = true; // The player has a trailer, so set his trailer as wanted by the mafia
            }

            // Set the TextDraw so the player can see it
            PlayerTextDrawSetString(playerid, Trabalho[playerid], RouteText);

            // Grab the x, y, z positions for the second location (to unload the goods)
            x = ALocations[APlayerData[playerid][JobLoc2]][LocX];
            y = ALocations[APlayerData[playerid][JobLoc2]][LocY];
            z = ALocations[APlayerData[playerid][JobLoc2]][LocZ];
            // Create a checkpoint where the player should unload the goods
            SetPlayerCheckpoint(playerid, x, y, z, 7);
            // Inform the player that he must unload his goods
            format(UnloadMsg, 100, "{FFFF00}[INFO] {009D4F}Entregue %s para %s", Load, EndLoc);
            SendClientMessage(playerid, 0xFFFFFFFF, UnloadMsg);
        }
        case 2: // Player is delivering his goods
        {

            new Float:x1, Float:y1, Float:x2, Float:y2, Float:Distance, Message[128], Payment, Bonus;
            // Grab the x, y, z positions for the first location (to load the goods)
            x1 = ALocations[APlayerData[playerid][JobLoc1]][LocX];
            y1 = ALocations[APlayerData[playerid][JobLoc1]][LocY];
            // Grab the x, y, z positions for the second location (to unload the goods)
            x2 = ALocations[APlayerData[playerid][JobLoc2]][LocX];
            y2 = ALocations[APlayerData[playerid][JobLoc2]][LocY];
            // Calculate the distance between both points
            Distance = floatsqroot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));

            // Calculate the payment for the player
            Payment = floatround((2*Distance * ALoads[APlayerData[playerid][LoadID]][PayPerUnit]), floatround_floor);


            // Setup local variables
            new StartLoc[50], EndLoc[50], Load[50], Msg1[128], Msg2[128], Name[24], BonusMsg[128], dnh[20];

            // Get the player name
            GetPlayerName(playerid, Name, sizeof(Name));
            // 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]);

            // Construct the message sent to all players that this player completed a trucking mission
            format(Msg1, 128, "Caminhoneiro %s Transportou %s e recebeu {009D4F}R$ %i, {D2B48C}distancia: %d% KM", Name, Load, Payment, floatround(Distance)/10);
            format(Msg2, 128, "de %s para %s", StartLoc, EndLoc);
            SendClientMessageToAll(0xFF8570FF, Msg1);
            SendClientMessageToAll(0xFF8570FF, Msg2);
            format(dnh, 128, "~w~+~g~R$~y~%i", Payment);
            GameTextForPlayer(playerid, dnh, 5000, 0);
            Passou[playerid] = false;
            if (RandomBonusMission[MissionFinished] == false)
            {
                // Check all paramters (load, startlocation and end-location)
                if (RandomBonusMission[RandomLoad] == APlayerData[playerid][LoadID])
                    if (RandomBonusMission[RandomStartLoc] == APlayerData[playerid][JobLoc1])
                        if (RandomBonusMission[RandomEndLoc] == APlayerData[playerid][JobLoc2])
                        {
                            Payment = Payment * 2; // Double the payment is the player was the first to do the bonus mission
                            RandomBonusMission[MissionFinished] = true; // Only one player can do the bonus mission, a new one is chosen next
                            format(BonusMsg, 128, "{FF1493}[BÔNUS] {CFCFCF}Caminhoneiro %s concluiu a missão bônus com sucesso", Name);
                            SendClientMessageToAll(0xFFFFFFFF, BonusMsg);
                            ContarBonus--;
                            FazendoBonus[playerid] = 0;
                            Passou[playerid] = false;
                            for (new i; i < MAX_PLAYERS; i++)
                            {
                                if (FazendoBonus[i] == 1)
                                {
                                    FazendoBonus[i] = 0;
                                }
                            }
                        }
            }
            RewardPlayer(playerid, Payment, 100);
         // Send a message to let the player know he finished his mission and got paid
            format(Message, 128, "{FFFF00}[INFO] {009D4F}Você terminou sua missão e recebeu $%i", Payment);
            SendClientMessage(playerid, 0xFFFFFFFF, Message);
           

            // Add 25% bonus if the player has been overloaded
            if (APlayerData[playerid][Overloaded] == true)
            {
                // Calculate the bonus
                Bonus = (Payment * 60) / 800;
                // Pay the bonus to the player
                RewardPlayer(playerid, Bonus, 0);
                // Send a message to let the player know he was overloaded and got paid
                format(Message, 128, "{FFFF00}[INFO] {009D4F}Você também ganhou um bônus por estar sobrecarregado: $%i", Bonus);
                SendClientMessage(playerid, 0xFFFFFFFF, Message);
            }

            // Add 50% bonus if the player has delivered a mafia load (mafia couldn't steal his load)
            if (APlayerData[playerid][MafiaLoad] == true)
            {
                // Calculate the bonus
                Bonus = (Payment * 100) / 800;
                // Pay the bonus to the player
                RewardPlayer(playerid, Bonus, 0);
                // Send a message to let the player know he was overloaded and got paid
                format(Message, 128, "{FFFF00}[INFO] {009D4F}Voce tambem ganhou um bonus para a entrega uma carga pra mafia: $%i", Bonus);
                SendClientMessage(playerid, 0xFFFFFFFF, Message);
            }

            // Add 10% bonus if the player has delivered the load with his own truck
            if (AVehicleData[APlayerData[playerid][VehicleID]][Owned] == true)
            {
                // Calculate the bonus
                Bonus = (Payment * 80) / 800;
                // Pay the bonus to the player
                RewardPlayer(playerid, Bonus, 0);
                // Send a message to let the player know he was overloaded and got paid
                format(Message, 128, "{FFFF00}[INFO] {009D4F}Você tambem ganhou um bonus por usar seu proprio caminhao: $%i", Bonus);
                SendClientMessage(playerid, 0xFFFFFFFF, Message);
            }

            // Also add score-points to the score of the player based on the distance between the loading and unloading points
            if (Distance > 3000.0)
                RewardPlayer(playerid, 0, 4); // Distance is larger than 3000 units, so add 2 points
            else
                RewardPlayer(playerid, 0, 3); // Distance is less than 3000 units, so add 1 point

            // Increase the stats for completing a trucking job
            APlayerData[playerid][StatsTruckerJobs]++;
            // Also save the data (in case the server crashes, progress would be lost)
            PlayerFile_Save(playerid);

            // End the current trucker job (clear mission-data)
            Trucker_EndJob(playerid);
        }
    }

    // Enable the player again (he can move again)
    TogglePlayerControllable(playerid, 1);

    return 1;
}

// This function randomly determines if the load is overloaded and adds 2 to the playerwanted-level
Trucker_SetRandomOverloaded(playerid)
{
    // Setup local variables
    new Name[24], Msg[128];

    // Check the vehicle model that the player is driving
    switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
    {
        case VehicleCementTruck: return 0; // A cementtruck cannot be overloaded
        case VehicleLineRunner, VehicleTanker, VehicleRoadTrain: // When driving a LineRunner, Tanker or RoadTrain
        {
            // A Fluids-trailer cannot be overloaded
            if (GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == VehicleTrailerFluids) return 0;
        }
    }

    // The player wasn't driving one of the above vehicle models, so this one can be overloaded
    // There is a 15% chance that your load will be overloaded
    if (random(100) <= 15)
    {
        // Set overloaded for this player to True
        APlayerData[playerid][Overloaded] = true;
        // Add 2 to the player's wanted level
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
        // Inform the police this trucker is overloaded
        GetPlayerName(playerid, Name, sizeof(Name));
        format(Msg, 128, "{FFFF00}[INFO] {009D4F}Caminhoneiro %s está sobrecarregado, pare-o e multe-o", Name);
        Police_SendMessage(Msg);
    }

    return 1;
}

// This function is called when a truckdriver wants to start a job by entering "/work" and has no truckers license
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~Leve ~y~%s~w~ de ~y~%s ~w~para ~y~%s", Load, StartLoc, EndLoc);
        // Set the TextDraw so the player can see it
        PlayerTextDrawSetString(playerid, Trabalho[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}Pegue %s em %s", Load, StartLoc);
        SendClientMessage(playerid, 0xFFFFFFFF, LoadMsg);
        new Convoy, LeaderID, MemberName[24], Msg[128], Membros;
        Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
        LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
        Membros = Convoy_CountMembers(Convoy);
        if (APlayerData[playerid][InConvoy] == true)
        {

            if (LeaderID == playerid)
            {
                GetPlayerName(playerid, MemberName, sizeof(MemberName));
                format(Msg, 128, "[CONVOY] O Convoy do player %s acaba de partir com seus %i membros!", MemberName, Membros);
                SendClientMessageToAll(0x00FF00FF, Msg);
            }
        }
    }

    return 1;
}

// This function sets a random job based on the player's vehicle and returns 1 if a job has been set
// The function returns 0 if a job couldn't be set (if the player is driving an invalid vehicle to start trucking-jobs)
Trucker_SetRandomJob(playerid)
{
    // If the player is the driver of the vehicle (GetPlayerVehicleSeat returns -1 if the player is not in a vehicle)
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        // Check the vehicle-model of the player to decide which job the player can get
        switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case VehicleReefer: // Select a random job from the routes that don't require a trailer and store the data for the player (Flatbed or DFT-30)
                return Trucker_SetRandomJobData(playerid, PCV_Reefer);
            case VehicleFlatbed, VehicleDFT30: // Select a random job from the routes that don't require a trailer and store the data for the player (Flatbed or DFT-30)
                return Trucker_SetRandomJobData(playerid, PCV_TruckerNoTrailer);
            case VehicleCementTruck: // Select a random job from the routes for cementtrucks and store the data for the player
                return Trucker_SetRandomJobData(playerid, PCV_TruckerCementTruck);
            case VehicleLineRunner, VehicleTanker, VehicleRoadTrain: // If the player's vehicle is a "LineRunner", "Tanker" or "RoadTrain"
            {
                // Select a job based on the trailer model of the player
                switch (GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))))
                {
                    case VehicleTrailerCargo, VehicleTrailerCargo2: // Select a random job from the routes that require a cargo-trailer and store the data for the player
                        return Trucker_SetRandomJobData(playerid, PCV_TruckerCargoTrailer);
                    case VehicleTrailerOre: // Select a random job from the routes that require a ore-trailer and store the data for the player
                        return Trucker_SetRandomJobData(playerid, PCV_TruckerOreTrailer);
                    case VehicleTrailerFluids: // Select a random job from the routes that require a fluids-trailer and store the data for the player
                        return Trucker_SetRandomJobData(playerid, PCV_TruckerFluidsTrailer);
                }
            }
        }
        new Convoy, LeaderID, MemberName[24], Msg[128], Membros;
        Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
        LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
        Membros = Convoy_CountMembers(Convoy);
        if (APlayerData[playerid][InConvoy] == true)
        {

            if (LeaderID == playerid)
            {
                GetPlayerName(playerid, MemberName, sizeof(MemberName));
                format(Msg, 128, "[CONVOY] O Convoy do player %s acaba de partir com seus %i membros!", MemberName, Membros);
                SendClientMessageToAll(0x00FF00FF, Msg);
            }
        }
    }
    // If no job could be set correctly, return 0
    return 0;
}

// This function chooses a random product for the trucker with a given vehicle-type and also the start-location and end-location
Trucker_SetRandomJobData(playerid, PCV_Needed)
{
    // Get a random Load from the loads that are defined for truckers with the given vehicle-type
    APlayerData[playerid][LoadID] = Product_GetRandom(PCV_Needed);
    // Get a random start-location and end-location for this load
    APlayerData[playerid][JobLoc1] = Product_GetRandomStartLoc(APlayerData[playerid][LoadID]);
    APlayerData[playerid][JobLoc2] = Product_GetRandomEndLoc(APlayerData[playerid][LoadID]);

    // 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));

    // Return 1 to indicate that a job has been set correctly
    return 1;
}



// A timer that runs every second to see if the player is still inside his vehicle
public Trucker_VehicleTimer(playerid)
{
    new OldVehicleID = APlayerData[playerid][VehicleID];
    new NewVehicleID = GetPlayerVehicleID(playerid);
    new OldTrailerID = APlayerData[playerid][TrailerID];
    new NewTrailerID = GetVehicleTrailer(GetPlayerVehicleID(playerid));

    if (APlayerData[playerid][VehicleTimerTime] != 0)
    {
        // If VehicleID and TrailerID are still the same as when the player accepted the job
        if ((OldVehicleID == NewVehicleID) && (OldTrailerID == NewTrailerID))
            APlayerData[playerid][VehicleTimerTime] = Trucker_TimeToFailMission; // Reset the time before the mission fails
        else // One (or both) aren't still the same (player lost his trailer or vehicle)
        {
            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
            GameTextForPlayer(playerid, TimeLeft, 1000, 4);
            // Send only one message to inform the player what he must do
            if (APlayerData[playerid][VehicleTimerTime] == (Trucker_TimeToFailMission - 1))
                SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}[ERRO] {009D4F}Voce deve estar dentro do seu veiculo ou recolocar seu reboque");
        }
    }
    else
    {
        // Time left has reached 0
        Trucker_EndJob(playerid);
        // If the player is part of a convoy, kick him from it (as he failed his mission, the rest of the convoy would be stuck)
        Convoy_Leave(playerid);
        // Inform the player that he failed the mission
        GameTextForPlayer(playerid, "~w~voce falhou na sua missao.", 5000, 4);
        // Reduce the player's cash by 1000
        //RewardPlayer(playerid, -1000, 0);
    }
}

// This function is used to cleanup the current job
Trucker_EndJob(playerid)
{
    if (APlayerData[playerid][JobStarted] == true)
    {
        // Clear the Mafia-wanted status of the vehicle (or trailer) in the array "AVehicleData"
        if (APlayerData[playerid][TrailerID] == 0)
            AVehicleData[APlayerData[playerid][VehicleID]][MafiaLoad] = false; // The player has no trailer, so clear his main vehicle as wanted by the mafia
        else
            AVehicleData[APlayerData[playerid][TrailerID]][MafiaLoad] = false; // The player has a trailer, so clear his trailer as wanted by the mafia

        // Clear all data about the job from the player, so he can start a new one
        APlayerData[playerid][JobStarted] = false;
        APlayerData[playerid][JobStep] = 0;
        APlayerData[playerid][JobID] = 0;
        APlayerData[playerid][VehicleTimerTime] = 0;
        APlayerData[playerid][VehicleID] = 0;
        APlayerData[playerid][TrailerID] = 0;
        APlayerData[playerid][LoadID] = 0;
        APlayerData[playerid][JobLoc1] = 0;
        APlayerData[playerid][JobLoc2] = 0;
        APlayerData[playerid][MafiaLoad] = false;

        // Delete the checkpoint
        DisablePlayerCheckpoint(playerid);
        // Reset the missiontext
        PlayerTextDrawSetString(playerid, Trabalho[playerid], "Nenhum trabalho no momento. Digite \"~y~/trabalhar ou /t~w~\" para iniciar um trabalho");
        // Kill the VehicleTimer and LoadingTimer
        KillTimer(APlayerData[playerid][VehicleTimer]);
        KillTimer(APlayerData[playerid][LoadingTimer]);
        if(FazendoBonus[playerid] == 1)
        {
            ContarBonus--;
            FazendoBonus[playerid] = 0;
        }
        // Check if the player has been overloaded
        if (APlayerData[playerid][Overloaded] == true)
        {
            // Clear the overloaded status of the player
            APlayerData[playerid][Overloaded] = false;

            // Check if the player has a wanted level of 2 or higher
            if (GetPlayerWantedLevel(playerid) >= 2)
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) - 2); // Reduce the wanted level by 2
            else
                SetPlayerWantedLevel(playerid, 0); // If the player has a wanted level of less than 2, reset the wanted level to 0
        }
    }

    return 1;
}

PS: Aconselho a não só traduzir GM's mas ao menos estudar e melhor ainda fazer o seu próprio mesmo que seja por base noutro, assim saberia o que fazer..
__________________
Se você encontrar um caminho sem obstáculos, ele provavelmente não leva a lugar nenhum..
Skype:
mocadaspereira

Estou de volta!
Skun Fly is offline   Reply With Quote
Old 29/12/2014, 01:10 AM   #3
furyzaz
Little Clucker
 
Join Date: Oct 2013
Posts: 19
Reputation: 0
Default Respuesta: Server de Caminhoneiro

Opa eu estava analisando isto agora mesmo, porém não sabia onde colocar o 2* pois sou iniciante em pawn, vou testar aqui MUITO OBRIGADOO!!
furyzaz is offline   Reply With Quote
Old 29/12/2014, 01:16 AM   #4
Skun Fly
Big Clucker
 
Skun Fly's Avatar
 
Join Date: Jan 2012
Location: Marte
Posts: 162
Reputation: 4
Default Re: Server de Caminhoneiro

De nada, testa e avisa se funcionou
__________________
Se você encontrar um caminho sem obstáculos, ele provavelmente não leva a lugar nenhum..
Skype:
mocadaspereira

Estou de volta!
Skun Fly is offline   Reply With Quote
Old 29/12/2014, 01:24 AM   #5
furyzaz
Little Clucker
 
Join Date: Oct 2013
Posts: 19
Reputation: 0
Default Respuesta: Server de Caminhoneiro

Opaa funcionou 100% Muito obrigado mesmo cara! tem sistema de rep aqui ou algo assim??

Falta só 1 detalhe no server agora que preciso mudar haha, retirar aquele velocimetro horrivel kk
furyzaz is offline   Reply With Quote
Old 29/12/2014, 01:27 AM   #6
Skun Fly
Big Clucker
 
Skun Fly's Avatar
 
Join Date: Jan 2012
Location: Marte
Posts: 162
Reputation: 4
Default Re: Respuesta: Server de Caminhoneiro

Quote:
Originally Posted by furyzaz View Post
Opaa funcionou 100% Muito obrigado mesmo cara! tem sistema de rep aqui ou algo assim??

Falta só 1 detalhe no server agora que preciso mudar haha, retirar aquele velocimetro horrivel kk
Sim tem sistema de rep debaixo do meu nome tem uma estrela. Se precisar de ajuda com o velocímetro não e hesite em postar no forum ou mandar pm (:
__________________
Se você encontrar um caminho sem obstáculos, ele provavelmente não leva a lugar nenhum..
Skype:
mocadaspereira

Estou de volta!
Skun Fly is offline   Reply With Quote
Old 29/12/2014, 01:47 AM   #7
JoshNudock
Huge Clucker
 
JoshNudock's Avatar
 
Join Date: Aug 2014
Posts: 491
Reputation: 14
Question Re: Respuesta: Server de Caminhoneiro

Quote:
Originally Posted by Skun Fly View Post
Sim tem sistema de rep debaixo do meu nome tem uma estrela. Se precisar de ajuda com o velocímetro não e hesite em postar no forum ou mandar pm (:
Olha ele ae! tá de volta, parabéns!!

@quem é vc? '.'
JoshNudock is offline   Reply With Quote
Old 29/12/2014, 02:36 AM   #8
Skun Fly
Big Clucker
 
Skun Fly's Avatar
 
Join Date: Jan 2012
Location: Marte
Posts: 162
Reputation: 4
Default Re: Respuesta: Server de Caminhoneiro

Quote:
Originally Posted by JoshNudock View Post
Olha ele ae! tá de volta, parabéns!!

@quem é vc? '.'
Entrei no fórum à 2 anos(quase 3), mas depois deixei de me dedicar ao fórum e ao pawn. Este meu "estou de volta" é mais estou de volta ao pawn (:

Mas de qualquer maneira o meu nome é André Pereira, meu nickname já conhece, prazer (:
__________________
Se você encontrar um caminho sem obstáculos, ele provavelmente não leva a lugar nenhum..
Skype:
mocadaspereira

Estou de volta!
Skun Fly is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Off] Dicas de sistemas para server de caminhoneiro Foodinha Português/Portuguese 9 22/04/2014 04:11 PM
[Ajuda] Titulo server de Caminhoneiro gba Português/Portuguese 11 08/04/2014 08:21 PM
[Projeto] GM DE CAMINHONEIRO O_mestre Português/Portuguese 13 24/09/2013 09:31 PM
Algum GM de caminhoneiro? duuuwh Português/Portuguese 10 16/06/2013 01:36 AM
[Ajuda] GM de Caminhoneiro GrandRig Português/Portuguese 5 15/10/2012 09:07 PM


All times are GMT. The time now is 02:53 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.