[Ajuda] Gasolina Bugo PPC_trucking
#1

BOA TARDE

fiz tudo q DON fez mais ta acabando a gasolina rбpido de mais olha aii oq eu fiz de errado pq nao vejo nada...
tutorial de Don_Speed

http://forum.sa-mp.com/showthread.ph...PC_Speedometer

PPC_Defines

pawn Код:
Text:Lataria
olha ai como ta meu PPC_Speedometer


pawn Код:
// Forward the function needed to update the speedometer (used by a timer)
forward Speedometer_Update(playerid);
forward RefuelVehicle(playerid);

// This function sets up the speedometer for the given player
Speedometer_Setup(playerid)
{
    //lataria
    APlayerData[playerid][Lataria] = TextDrawCreate(500.000000, 404.000000, " "); // Sem estar escrito nada
    TextDrawFont(APlayerData[playerid][Lataria], 3);
    TextDrawLetterSize(APlayerData[playerid][Lataria], 0.449999, 1.599998);
    TextDrawSetOutline(APlayerData[playerid][Lataria], 1);
    TextDrawSetProportional(APlayerData[playerid][Lataria], 1);

    TextDrawShowForPlayer(playerid, APlayerData[playerid][Lataria]);

    APlayerData[playerid][SpeedometerTimer] = SetTimerEx("Speedometer_Update", 100, true, "i", playerid);

    // Setup the speedometer for the player
    APlayerData[playerid][SpeedometerText] = TextDrawCreate(498.000000, 364.000000, " ");
    APlayerData[playerid][FuelGauge] = TextDrawCreate(499.000000, 382.000000, " ");
    TextDrawFont(APlayerData[playerid][SpeedometerText], 3);
    TextDrawFont(APlayerData[playerid][FuelGauge], 3);
    TextDrawLetterSize(APlayerData[playerid][FuelGauge], 0.449999, 1.599998);
    TextDrawLetterSize(APlayerData[playerid][SpeedometerText], 0.449999, 1.599998);

    TextDrawFont(APlayerData[playerid][SpeedometerText], 3);
    TextDrawLetterSize(APlayerData[playerid][SpeedometerText], 0.449999, 1.599998);
    TextDrawSetOutline(APlayerData[playerid][SpeedometerText], 1);
    TextDrawSetProportional(APlayerData[playerid][SpeedometerText], 1);

    TextDrawFont(APlayerData[playerid][FuelGauge], 3);
    TextDrawLetterSize(APlayerData[playerid][FuelGauge], 0.449999, 1.599998);
    TextDrawSetOutline(APlayerData[playerid][FuelGauge], 1);
    TextDrawSetProportional(APlayerData[playerid][FuelGauge], 1);

    // Enable the TextDraw for this player
    TextDrawShowForPlayer(playerid, APlayerData[playerid][FuelGauge]);
    TextDrawShowForPlayer(playerid, APlayerData[playerid][SpeedometerText]);

    // Start the speedometer timer
    APlayerData[playerid][SpeedometerTimer] = SetTimerEx("Speedometer_Update", 300, true, "i", playerid);

    return 1;
}

// This function cleans up the speedometer for the given player
Speedometer_Cleanup(playerid)
{
    //detroy lataria
    TextDrawDestroy(APlayerData[playerid][Lataria]);
    // Destroy the speedometer textdraw
    TextDrawDestroy(APlayerData[playerid][SpeedometerText]);
    TextDrawDestroy(APlayerData[playerid][FuelGauge]);
    // Kill the speedometer timer
    KillTimer(APlayerData[playerid][SpeedometerTimer]);
    // Set player speed to 0
    APlayerData[playerid][PlayerSpeed] = 0;

    return 1;
}

// This function gets called by a timer which runs every 500ms to display and update the speedometer
public Speedometer_Update(playerid)
{
    // Setup local variables
    new vehicleid, Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, speed_string[50], final_speed_int, Float:vehiclehealth;
    new FuelString[50], FuelStatus[50];
    new Msg[128], Name[24];

    // Get the ID of the player's vehicle
    vehicleid = GetPlayerVehicleID(playerid);

    AntiHack(playerid);

    // Check and toggle spectate-mode when needed (when target player entered or exited his vehicle)
    if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
    {
        // Get the target player's ID and name
        new OtherPlayer = APlayerData[playerid][SpectateID];
        GetPlayerName(OtherPlayer, Name, sizeof(Name));

        // Use the same worldid and interiorid as the OtherPlayer
        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(OtherPlayer));
        SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));

        // Check if the player is spectating a player
        if (APlayerData[playerid][SpectateType] == ADMIN_SPEC_TYPE_PLAYER)
        {
            // Check if the target player has entered a vehicle
            if (GetPlayerVehicleSeat(OtherPlayer) != -1)
            {
                // Change spectate mode to vehicle
                PlayerSpectateVehicle(playerid, GetPlayerVehicleID(OtherPlayer));
                APlayerData[playerid][SpectateID] = OtherPlayer;
                APlayerData[playerid][SpectateVehicle] = GetPlayerVehicleID(OtherPlayer);
                APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_VEHICLE;
                format(Msg, 128, "{FFFFFF}[ESPIAR]: {FF0000}%s{FFFFFF} entrou num veiculo, modo de espiar alterado.", Name);
                SendClientMessage(playerid, 0x00FF00, Msg);
            }
        }
        else
        {
            if (GetPlayerVehicleSeat(OtherPlayer) == -1)
            {
                PlayerSpectatePlayer(playerid, OtherPlayer);
                SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
                APlayerData[playerid][SpectateID] = OtherPlayer;
                APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
                format(Msg, 128, "{FFFFFF}[ESPIAR]: {FF0000}%s{FFFFFF} saiu do veiculo, modo de espiar alterado.", Name);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
    }
    if (APlayerData[playerid][PoliceWarnedMe] == true)
    {
        if (GetPlayerWantedLevel(playerid) == 0)
        {
            APlayerData[playerid][PoliceCanJailMe] = false;
            APlayerData[playerid][PoliceWarnedMe] = false;
            APlayerData[playerid][Value_PoliceCanJailMe] = 0;
            KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]);
        }
    }
    if(vehicleid != 0)
    {

        new Float:Vida;// Variavel da vida
        GetVehicleHealth(GetPlayerVehicleID(playerid), Vida); // getando a vida
        /*------------------------------------------------------------------------------
                                            Lataria
        ------------------------------------------------------------------------------*/

        new ss[50];
        if ((Vida > 0) && (Vida < 1000))
            format(ss, 50, "~g~Lataria: ~w~I~r~IIIIIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 1)) && (Vida < ((1000 / 10) * 2)))
            format(ss, 50, "~g~Lataria: ~w~II~r~IIIIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 2)) && (Vida < ((1000 / 10) * 3)))
            format(ss, 50, "~g~Lataria: ~w~III~r~IIIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 3)) && (Vida < ((1000 / 10) * 4)))
            format(ss, 50, "~g~Lataria: ~w~IIII~r~IIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 4)) && (Vida < ((1000 / 10) * 5)))
            format(ss, 50, "~g~Lataria: ~w~IIIII~r~IIIII", Vida);

        if ((Vida >= ((1000 / 10) * 5)) && (Vida < ((1000 / 10) * 6)))
            format(ss, 50, "~g~Lataria: ~w~IIIIII~r~IIII", Vida);

        if ((Vida >= ((1000 / 10) * 6)) && (Vida < ((1000 / 10) * 7)))
            format(ss, 50, "~g~Lataria: ~w~IIIIIII~r~III", Vida);

        if ((Vida >= ((1000 / 10) * 7)) && (Vida < ((1000 / 10) * 8)))
            format(ss, 50, "~g~Lataria: ~w~IIIIIIII~r~II", Vida);

        if ((Vida >= ((1000 / 10) * 8)) && (Vida < ((1000 / 10) * 9)))
            format(ss, 50, "~g~Lataria: ~w~IIIIIIIII~r~I", Vida);

        if ((Vida >= ((1000 / 10) * 9)) && (Vida <= 1000))
            format(ss, 50, "~g~Lataria: ~w~IIIIIIIIII", Vida);

        if (Vida == 0)
            format(ss, 50, "~g~Lataria: ~r~IIIIIIIIII", Vida);

        TextDrawSetString(APlayerData[playerid][Lataria], ss); // atualizando a textdraw

        GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
        final_speed = floatsqroot(((speed_x * speed_x) + (speed_y * speed_y)) + (speed_z * speed_z)) * 158.179;
        final_speed_int = floatround(final_speed, floatround_round);
        APlayerData[playerid][PlayerSpeed] = final_speed_int;
        format(speed_string, 50, TXT_SpeedometerSpeed, final_speed_int);
        TextDrawSetString(APlayerData[playerid][SpeedometerText], speed_string);
        APlayerData[playerid][StatsMetersDriven] = APlayerData[playerid][StatsMetersDriven] +  (final_speed / 7.2);
        GetVehicleHealth(vehicleid, vehiclehealth);
        SetPlayerHealth(playerid, vehiclehealth / 10.0);
        if ((final_speed_int > 10) && (AVehicleData[vehicleid][Fuel] > 0))
        AVehicleData[vehicleid][Fuel] = AVehicleData[vehicleid][Fuel] - 1;
        if ((AVehicleData[vehicleid][Fuel] > 0) && (AVehicleData[vehicleid][Fuel] < 100000))
            format(FuelStatus, 20, "~w~%s~r~%s", "I", "IIIIIIIII"); // Fuel is between 0% and 10% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 1)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 2)))
            format(FuelStatus, 20, "~w~%s~r~%s", "II", "IIIIIIII"); // Fuel is between 10% and 20% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 2)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 3)))
            format(FuelStatus, 20, "~w~%s~r~%s", "III", "IIIIIII"); // Fuel is between 20% and 30% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 3)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 4)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIII", "IIIIII"); // Fuel is between 30% and 40% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 4)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 5)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIII", "IIIII"); // Fuel is between 40% and 50% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 5)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 6)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIII", "IIII"); // Fuel is between 50% and 60% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 6)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 7)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIIII", "III"); // Fuel is between 60% and 70% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 7)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 8)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIIIII", "II"); // Fuel is between 70% and 80% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 8)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 9)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIIIIII", "I"); // Fuel is between 80% and 90% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 9)) && (AVehicleData[vehicleid][Fuel] <= MaxFuel))
            format(FuelStatus, 20, "~w~%s", "IIIIIIIIII"); // Fuel is between 90% and 100% full (all bars are green)

        if (AVehicleData[vehicleid][Fuel] == 0)
            format(FuelStatus, 20, "~r~%s", "Acabou");

        format(FuelString, 50, TXT_SpeedometerFuel, FuelStatus);
        TextDrawSetString(APlayerData[playerid][FuelGauge], FuelString);
        if (AVehicleData[vehicleid][Fuel] == 0)
        {
            new engine,lights,alarm,doors,bonnet,boot,objective;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
        }
        if (IsVehicleAirVehicle(vehicleid) == 0)
            if (APlayerData[playerid][PlayerClass] != ClassPolice)
                CheckPlayerSpeeding(playerid);
    }
    else
    {
        TextDrawSetString(APlayerData[playerid][SpeedometerText], " ");
        TextDrawSetString(APlayerData[playerid][FuelGauge], " ");
        TextDrawSetString(APlayerData[playerid][Lataria], " ");  //lataria
        APlayerData[playerid][PlayerSpeed] = 0;
    }
}
public RefuelVehicle(playerid)
{
    new RefuelMsg[128];
    new vID = GetPlayerVehicleID(playerid);
    new Amount = MaxFuel - AVehicleData[vID][Fuel];
    new RefuelPrice = (Amount * RefuelMaxPrice) / MaxFuel;
    if (APlayerData[playerid][PlayerMoney] >= RefuelPrice)
    {
        AVehicleData[vID][Fuel] = MaxFuel;
        RewardPlayer(playerid, -RefuelPrice, 0);
        format(RefuelMsg, 128, TXT_RefuelledVehicle, RefuelPrice);
        SendClientMessage(playerid, 0xFFFFFFFF, RefuelMsg);
    }
    else
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_CannotRefuelVehicle);
    TogglePlayerControllable(playerid, 1);

    return 1;
}
CheckPlayerSpeeding(playerid)
{
    new Name[24], Msg[128];
    if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
    {
        for (new CamID; CamID < MAX_CAMERAS; CamID++)
        {
            if (ACameras[CamID][CamSpeed] != 0)
            {
                if (GetPlayerVehicleSeat(playerid) == 0)
                {
                    if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed])
                    {
                        if (IsPlayerInRangeOfPoint(playerid, 50.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
                        {
                            APlayerData[playerid][PlayerCaughtSpeeding] = 20;
                            SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
                            PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
                            GameTextForPlayer(playerid, "~r~Flagrado pelo radar", 6000, 1);
                            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerCaughtSpeeding);
                            GetPlayerName(playerid, Name, sizeof(Name));
                            format(Msg, 128, "{0000FF}[Departamento de Polнcia] O suspeito {FFFFFF}%s {0000FF}foi pкgo em alta velocidade!", Name);
                            Police_SendMessage(Msg);
                            Police_SendMessage("{0000FF}[Objetivo]: {FFFFFF}Perseguir e multar{0000FF}.");
                        }
                    }
                }
            }
        }
    }
    else
        APlayerData[playerid][PlayerCaughtSpeeding]--;
}
stock AntiHack(playerid)
{
    new Float:Armour;
    if (APlayerData[playerid][AutoReportTime] > 0)
    {
        APlayerData[playerid][AutoReportTime]--;
        return 1;
    }
    if (GetPVarInt(playerid, "PVarMoney") != 0)
    {
        APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + GetPVarInt(playerid, "PVarMoney");
        SetPVarInt(playerid, "PVarMoney", 0);
    }
    if (GetPVarInt(playerid, "PVarScore") != 0)
    {
        APlayerData[playerid][PlayerScore] = APlayerData[playerid][PlayerScore] + GetPVarInt(playerid, "PVarScore");
        SetPVarInt(playerid, "PVarScore", 0);
    }
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, APlayerData[playerid][PlayerMoney]);
    SetPlayerScore(playerid, APlayerData[playerid][PlayerScore]);
    Player_PortOutAdminZone(playerid, 106.0, 1805.0, -50.0, 285.0, 1940.0, 40.0, 15.0, 1732.0, 25.0);

    if (APlayerData[playerid][PlayerLevel] <= 1)
    {
        if (Armour > 1.0)
        SendReportToAdmins(playerid, "Health-hack", true);

        if (APlayerData[playerid][PlayerSpeed] > 300)
        SendReportToAdmins(playerid, "Speed-hack", true);

        if (APlayerData[playerid][PlayerLevel] < 3)
        {
            if (GetPlayerSpecialAction(playerid) == 2)
            SendReportToAdmins(playerid, "Jetpack-hack", true);
        }
     }
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        if (APlayerData[playerid][PlayerSpeed] < 10)
        {
            if (GetPlayerInterior(playerid) != APlayerData[playerid][PreviousInt])
            {
                switch (GetPlayerInterior(playerid))
                {
                    case 0, 1, 2, 3:
                    {
                        GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
                        APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
                        return 1;
                    }
                }
            }
            if (IsPlayerInRangeOfPoint(playerid, 7.5, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]))
            {
            }
            else
                if (APlayerData[playerid][PlayerLevel] <= 1)
                SendReportToAdmins(playerid, "Airbreak-hack", true);
        }
    }
    GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
    APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
    return 1;
}
olha ai se eu coloquei a ordem errada pq nao sei oq eu fiz de errado pode me ajuda vcs OGB...
Reply
#2

Quote:
Originally Posted by comanfiss
Посмотреть сообщение
BOA TARDE

fiz tudo q DON fez mais ta acabando a gasolina rбpido de mais olha aii oq eu fiz de errado pq nao vejo nada...
tutorial de Don_Speed

http://forum.sa-mp.com/showthread.ph...PC_Speedometer

PPC_Defines

pawn Код:
Text:Lataria
olha ai como ta meu PPC_Speedometer


pawn Код:
// Forward the function needed to update the speedometer (used by a timer)
forward Speedometer_Update(playerid);
forward RefuelVehicle(playerid);

// This function sets up the speedometer for the given player
Speedometer_Setup(playerid)
{
    //lataria
    APlayerData[playerid][Lataria] = TextDrawCreate(500.000000, 404.000000, " "); // Sem estar escrito nada
    TextDrawFont(APlayerData[playerid][Lataria], 3);
    TextDrawLetterSize(APlayerData[playerid][Lataria], 0.449999, 1.599998);
    TextDrawSetOutline(APlayerData[playerid][Lataria], 1);
    TextDrawSetProportional(APlayerData[playerid][Lataria], 1);

    TextDrawShowForPlayer(playerid, APlayerData[playerid][Lataria]);

    APlayerData[playerid][SpeedometerTimer] = SetTimerEx("Speedometer_Update", 100, true, "i", playerid);

    // Setup the speedometer for the player
    APlayerData[playerid][SpeedometerText] = TextDrawCreate(498.000000, 364.000000, " ");
    APlayerData[playerid][FuelGauge] = TextDrawCreate(499.000000, 382.000000, " ");
    TextDrawFont(APlayerData[playerid][SpeedometerText], 3);
    TextDrawFont(APlayerData[playerid][FuelGauge], 3);
    TextDrawLetterSize(APlayerData[playerid][FuelGauge], 0.449999, 1.599998);
    TextDrawLetterSize(APlayerData[playerid][SpeedometerText], 0.449999, 1.599998);

    TextDrawFont(APlayerData[playerid][SpeedometerText], 3);
    TextDrawLetterSize(APlayerData[playerid][SpeedometerText], 0.449999, 1.599998);
    TextDrawSetOutline(APlayerData[playerid][SpeedometerText], 1);
    TextDrawSetProportional(APlayerData[playerid][SpeedometerText], 1);

    TextDrawFont(APlayerData[playerid][FuelGauge], 3);
    TextDrawLetterSize(APlayerData[playerid][FuelGauge], 0.449999, 1.599998);
    TextDrawSetOutline(APlayerData[playerid][FuelGauge], 1);
    TextDrawSetProportional(APlayerData[playerid][FuelGauge], 1);

    // Enable the TextDraw for this player
    TextDrawShowForPlayer(playerid, APlayerData[playerid][FuelGauge]);
    TextDrawShowForPlayer(playerid, APlayerData[playerid][SpeedometerText]);

    // Start the speedometer timer
    APlayerData[playerid][SpeedometerTimer] = SetTimerEx("Speedometer_Update", 300, true, "i", playerid);

    return 1;
}

// This function cleans up the speedometer for the given player
Speedometer_Cleanup(playerid)
{
    //detroy lataria
    TextDrawDestroy(APlayerData[playerid][Lataria]);
    // Destroy the speedometer textdraw
    TextDrawDestroy(APlayerData[playerid][SpeedometerText]);
    TextDrawDestroy(APlayerData[playerid][FuelGauge]);
    // Kill the speedometer timer
    KillTimer(APlayerData[playerid][SpeedometerTimer]);
    // Set player speed to 0
    APlayerData[playerid][PlayerSpeed] = 0;

    return 1;
}

// This function gets called by a timer which runs every 500ms to display and update the speedometer
public Speedometer_Update(playerid)
{
    // Setup local variables
    new vehicleid, Float:speed_x, Float:speed_y, Float:speed_z, Float:final_speed, speed_string[50], final_speed_int, Float:vehiclehealth;
    new FuelString[50], FuelStatus[50];
    new Msg[128], Name[24];

    // Get the ID of the player's vehicle
    vehicleid = GetPlayerVehicleID(playerid);

    AntiHack(playerid);

    // Check and toggle spectate-mode when needed (when target player entered or exited his vehicle)
    if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
    {
        // Get the target player's ID and name
        new OtherPlayer = APlayerData[playerid][SpectateID];
        GetPlayerName(OtherPlayer, Name, sizeof(Name));

        // Use the same worldid and interiorid as the OtherPlayer
        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(OtherPlayer));
        SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));

        // Check if the player is spectating a player
        if (APlayerData[playerid][SpectateType] == ADMIN_SPEC_TYPE_PLAYER)
        {
            // Check if the target player has entered a vehicle
            if (GetPlayerVehicleSeat(OtherPlayer) != -1)
            {
                // Change spectate mode to vehicle
                PlayerSpectateVehicle(playerid, GetPlayerVehicleID(OtherPlayer));
                APlayerData[playerid][SpectateID] = OtherPlayer;
                APlayerData[playerid][SpectateVehicle] = GetPlayerVehicleID(OtherPlayer);
                APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_VEHICLE;
                format(Msg, 128, "{FFFFFF}[ESPIAR]: {FF0000}%s{FFFFFF} entrou num veiculo, modo de espiar alterado.", Name);
                SendClientMessage(playerid, 0x00FF00, Msg);
            }
        }
        else
        {
            if (GetPlayerVehicleSeat(OtherPlayer) == -1)
            {
                PlayerSpectatePlayer(playerid, OtherPlayer);
                SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
                APlayerData[playerid][SpectateID] = OtherPlayer;
                APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
                format(Msg, 128, "{FFFFFF}[ESPIAR]: {FF0000}%s{FFFFFF} saiu do veiculo, modo de espiar alterado.", Name);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
    }
    if (APlayerData[playerid][PoliceWarnedMe] == true)
    {
        if (GetPlayerWantedLevel(playerid) == 0)
        {
            APlayerData[playerid][PoliceCanJailMe] = false;
            APlayerData[playerid][PoliceWarnedMe] = false;
            APlayerData[playerid][Value_PoliceCanJailMe] = 0;
            KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]);
        }
    }
    if(vehicleid != 0)
    {

        new Float:Vida;// Variavel da vida
        GetVehicleHealth(GetPlayerVehicleID(playerid), Vida); // getando a vida
        /*------------------------------------------------------------------------------
                                            Lataria
        ------------------------------------------------------------------------------*/

        new ss[50];
        if ((Vida > 0) && (Vida < 1000))
            format(ss, 50, "~g~Lataria: ~w~I~r~IIIIIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 1)) && (Vida < ((1000 / 10) * 2)))
            format(ss, 50, "~g~Lataria: ~w~II~r~IIIIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 2)) && (Vida < ((1000 / 10) * 3)))
            format(ss, 50, "~g~Lataria: ~w~III~r~IIIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 3)) && (Vida < ((1000 / 10) * 4)))
            format(ss, 50, "~g~Lataria: ~w~IIII~r~IIIIII", Vida);

        if ((Vida >= ((1000 / 10) * 4)) && (Vida < ((1000 / 10) * 5)))
            format(ss, 50, "~g~Lataria: ~w~IIIII~r~IIIII", Vida);

        if ((Vida >= ((1000 / 10) * 5)) && (Vida < ((1000 / 10) * 6)))
            format(ss, 50, "~g~Lataria: ~w~IIIIII~r~IIII", Vida);

        if ((Vida >= ((1000 / 10) * 6)) && (Vida < ((1000 / 10) * 7)))
            format(ss, 50, "~g~Lataria: ~w~IIIIIII~r~III", Vida);

        if ((Vida >= ((1000 / 10) * 7)) && (Vida < ((1000 / 10) * 8)))
            format(ss, 50, "~g~Lataria: ~w~IIIIIIII~r~II", Vida);

        if ((Vida >= ((1000 / 10) * 8)) && (Vida < ((1000 / 10) * 9)))
            format(ss, 50, "~g~Lataria: ~w~IIIIIIIII~r~I", Vida);

        if ((Vida >= ((1000 / 10) * 9)) && (Vida <= 1000))
            format(ss, 50, "~g~Lataria: ~w~IIIIIIIIII", Vida);

        if (Vida == 0)
            format(ss, 50, "~g~Lataria: ~r~IIIIIIIIII", Vida);

        TextDrawSetString(APlayerData[playerid][Lataria], ss); // atualizando a textdraw

        GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
        final_speed = floatsqroot(((speed_x * speed_x) + (speed_y * speed_y)) + (speed_z * speed_z)) * 158.179;
        final_speed_int = floatround(final_speed, floatround_round);
        APlayerData[playerid][PlayerSpeed] = final_speed_int;
        format(speed_string, 50, TXT_SpeedometerSpeed, final_speed_int);
        TextDrawSetString(APlayerData[playerid][SpeedometerText], speed_string);
        APlayerData[playerid][StatsMetersDriven] = APlayerData[playerid][StatsMetersDriven] +  (final_speed / 7.2);
        GetVehicleHealth(vehicleid, vehiclehealth);
        SetPlayerHealth(playerid, vehiclehealth / 10.0);
        if ((final_speed_int > 10) && (AVehicleData[vehicleid][Fuel] > 0))
        AVehicleData[vehicleid][Fuel] = AVehicleData[vehicleid][Fuel] - 1;
        if ((AVehicleData[vehicleid][Fuel] > 0) && (AVehicleData[vehicleid][Fuel] < 100000))
            format(FuelStatus, 20, "~w~%s~r~%s", "I", "IIIIIIIII"); // Fuel is between 0% and 10% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 1)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 2)))
            format(FuelStatus, 20, "~w~%s~r~%s", "II", "IIIIIIII"); // Fuel is between 10% and 20% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 2)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 3)))
            format(FuelStatus, 20, "~w~%s~r~%s", "III", "IIIIIII"); // Fuel is between 20% and 30% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 3)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 4)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIII", "IIIIII"); // Fuel is between 30% and 40% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 4)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 5)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIII", "IIIII"); // Fuel is between 40% and 50% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 5)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 6)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIII", "IIII"); // Fuel is between 50% and 60% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 6)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 7)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIIII", "III"); // Fuel is between 60% and 70% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 7)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 8)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIIIII", "II"); // Fuel is between 70% and 80% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 8)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 9)))
            format(FuelStatus, 20, "~w~%s~r~%s", "IIIIIIIII", "I"); // Fuel is between 80% and 90% full

        if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 9)) && (AVehicleData[vehicleid][Fuel] <= MaxFuel))
            format(FuelStatus, 20, "~w~%s", "IIIIIIIIII"); // Fuel is between 90% and 100% full (all bars are green)

        if (AVehicleData[vehicleid][Fuel] == 0)
            format(FuelStatus, 20, "~r~%s", "Acabou");

        format(FuelString, 50, TXT_SpeedometerFuel, FuelStatus);
        TextDrawSetString(APlayerData[playerid][FuelGauge], FuelString);
        if (AVehicleData[vehicleid][Fuel] == 0)
        {
            new engine,lights,alarm,doors,bonnet,boot,objective;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
        }
        if (IsVehicleAirVehicle(vehicleid) == 0)
            if (APlayerData[playerid][PlayerClass] != ClassPolice)
                CheckPlayerSpeeding(playerid);
    }
    else
    {
        TextDrawSetString(APlayerData[playerid][SpeedometerText], " ");
        TextDrawSetString(APlayerData[playerid][FuelGauge], " ");
        TextDrawSetString(APlayerData[playerid][Lataria], " ");  //lataria
        APlayerData[playerid][PlayerSpeed] = 0;
    }
}
public RefuelVehicle(playerid)
{
    new RefuelMsg[128];
    new vID = GetPlayerVehicleID(playerid);
    new Amount = MaxFuel - AVehicleData[vID][Fuel];
    new RefuelPrice = (Amount * RefuelMaxPrice) / MaxFuel;
    if (APlayerData[playerid][PlayerMoney] >= RefuelPrice)
    {
        AVehicleData[vID][Fuel] = MaxFuel;
        RewardPlayer(playerid, -RefuelPrice, 0);
        format(RefuelMsg, 128, TXT_RefuelledVehicle, RefuelPrice);
        SendClientMessage(playerid, 0xFFFFFFFF, RefuelMsg);
    }
    else
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_CannotRefuelVehicle);
    TogglePlayerControllable(playerid, 1);

    return 1;
}
CheckPlayerSpeeding(playerid)
{
    new Name[24], Msg[128];
    if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
    {
        for (new CamID; CamID < MAX_CAMERAS; CamID++)
        {
            if (ACameras[CamID][CamSpeed] != 0)
            {
                if (GetPlayerVehicleSeat(playerid) == 0)
                {
                    if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed])
                    {
                        if (IsPlayerInRangeOfPoint(playerid, 50.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
                        {
                            APlayerData[playerid][PlayerCaughtSpeeding] = 20;
                            SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
                            PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
                            GameTextForPlayer(playerid, "~r~Flagrado pelo radar", 6000, 1);
                            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerCaughtSpeeding);
                            GetPlayerName(playerid, Name, sizeof(Name));
                            format(Msg, 128, "{0000FF}[Departamento de Polнcia] O suspeito {FFFFFF}%s {0000FF}foi pкgo em alta velocidade!", Name);
                            Police_SendMessage(Msg);
                            Police_SendMessage("{0000FF}[Objetivo]: {FFFFFF}Perseguir e multar{0000FF}.");
                        }
                    }
                }
            }
        }
    }
    else
        APlayerData[playerid][PlayerCaughtSpeeding]--;
}
stock AntiHack(playerid)
{
    new Float:Armour;
    if (APlayerData[playerid][AutoReportTime] > 0)
    {
        APlayerData[playerid][AutoReportTime]--;
        return 1;
    }
    if (GetPVarInt(playerid, "PVarMoney") != 0)
    {
        APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + GetPVarInt(playerid, "PVarMoney");
        SetPVarInt(playerid, "PVarMoney", 0);
    }
    if (GetPVarInt(playerid, "PVarScore") != 0)
    {
        APlayerData[playerid][PlayerScore] = APlayerData[playerid][PlayerScore] + GetPVarInt(playerid, "PVarScore");
        SetPVarInt(playerid, "PVarScore", 0);
    }
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, APlayerData[playerid][PlayerMoney]);
    SetPlayerScore(playerid, APlayerData[playerid][PlayerScore]);
    Player_PortOutAdminZone(playerid, 106.0, 1805.0, -50.0, 285.0, 1940.0, 40.0, 15.0, 1732.0, 25.0);

    if (APlayerData[playerid][PlayerLevel] <= 1)
    {
        if (Armour > 1.0)
        SendReportToAdmins(playerid, "Health-hack", true);

        if (APlayerData[playerid][PlayerSpeed] > 300)
        SendReportToAdmins(playerid, "Speed-hack", true);

        if (APlayerData[playerid][PlayerLevel] < 3)
        {
            if (GetPlayerSpecialAction(playerid) == 2)
            SendReportToAdmins(playerid, "Jetpack-hack", true);
        }
     }
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        if (APlayerData[playerid][PlayerSpeed] < 10)
        {
            if (GetPlayerInterior(playerid) != APlayerData[playerid][PreviousInt])
            {
                switch (GetPlayerInterior(playerid))
                {
                    case 0, 1, 2, 3:
                    {
                        GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
                        APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
                        return 1;
                    }
                }
            }
            if (IsPlayerInRangeOfPoint(playerid, 7.5, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]))
            {
            }
            else
                if (APlayerData[playerid][PlayerLevel] <= 1)
                SendReportToAdmins(playerid, "Airbreak-hack", true);
        }
    }
    GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
    APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
    return 1;
}
olha ai se eu coloquei a ordem errada pq nao sei oq eu fiz de errado pode me ajuda vcs OGB...
voce pode especificar o bugnгo vou ler tudo isso dai kkkk
Reply
#3

Deve ser a Gasolina de mб qualidade ou a sonda lambda do carro com defeito .
Reply
#4

Vai na PPC_ServerSettings
pawn Код:
new MaxFuel = 30000;
voce coloca um valor maior se achar que ainda esta acabando rapido.
Reply
#5

williamgato

so vc Olhar o TUTORIAL de DON e ver se eu fiz tudo certinho pq a gasolina ta acabando rбpido de mais...

lHesoyaml

o meu ta sim..

pawn Код:
new MaxFuel = 6000;
ai eu coloco assim й?

pawn Код:
new MaxFuel = 30000;
Reply
#6

Sim amigo isso almentara o combustivel e demorara para acabar.
Caso queira add no Skype posso ajudar mais.
Reply
#7

mais de..

pawn Код:
new MaxFuel = 6000;
pra

pawn Код:
new MaxFuel = 30000;
й muito nao tem como colocar rasuavel me dar uma dica pra eu coloca rasuavel
e passa o seu SKYPE ai o meu й
pawn Код:
comanfis
Reply
#8

Isso varia o meu esta 30 mil e acho estar perfeito faзa testes.
Reply
#9

OBG deu certinho aki vlw amigos do FORUm kkkkkkkkkk
Reply
#10

RESOLVIDO deu certo aki descobri o ERRO onde tava e so removi vlw quem ajudo.....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)