is it possible to do? converting etc
#1

is it possible to put a filterscript system into a include.

say for instance i want this filterscript just the gas station bit so the fueling system put into ppc fuel system

So you dont have to honk the horn but instead type /refill
pawn Код:
[COLOR=RED]This is the filterscript[/color]
#define FILTERSCRIPT
//Internal use
#define FUEL_MULTIPLIER 3.0 //Distance * fuel_multiplier
#define MAX_GAS_STATIONS 35
#define GAS_RANGE 3.0
#define REFUEL_TIME 250
#define WEBSITE "www.truckers-life-server.co.nr"
//Keys
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
//Colour codes
#define blue            0x375FFFFF
#define red             0xFF0000AA
#define green           0x33FF33AA
#define yellow          0xFFFF00AA
#define grey            0xC0C0C0AA
#define blue1           0x2641FEAA
#define lightblue       0x33CCFFAA
#define orange          0xFF9900AA
#define black           0x2C2727AA
#define COLOR_GREEN     0x33AA33AA
#define COLOR_PINK      0xFF66FFAA
#define COLOR_BLUE      0x0000BBAA
#define COLOR_PURPLE    0x800080AA
#define COLOR_BLACK     0x000000AA
#define COLOR_WHITE     0xFFFFFFAA
#define COLOR_GREEN1    0x33AA33AA
#define COLOR_BROWN     0xA52A2AAA
#define COLOR_YELLOW    0xFFFF00AA
#define COLOR_GREY      0xAFAFAFAA
#define COLOR_ORANGE    0xFF9900AA

//Includes
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <gvar>
#include <streamer>

//Variables
enum sInfo
{
    Text:Txd,
    Timer
};

new GasStation[MAX_GAS_STATIONS] = {-1, ...};
new Speedo[MAX_PLAYERS][sInfo];
new Text:WWW;
new str[555];

//Functions
forward SpeedUpdate(playerid);
forward ReFill(playerid);

public OnFilterScriptInit()
{
    new time = GetTickCount();
    print("-------------------------------------");
    print(" Ocar Dynamic Gas Station Creator");
    print(" Ocar Special Edition");
    print("-------------------------------------");
    for(new i; i < MAX_VEHICLES; i++)
    {
        SetGVarFloat("Fuel", 110.0, i);
    }
    new File:gasst = fopen("gasstations.lwd", io_readwrite);
    new count, Float:X, Float:Y, Float:Z, errors;
    while(fread(gasst, str))
    {
        if(count >= MAX_GAS_STATIONS)
        {
            errors++;
            printf("[Ocar] ERROR: Current amount of gas stations exceeds the value defined in MAX_GAS_STATIONS [%d/%d]", count, MAX_GAS_STATIONS);
        }
        else if(!sscanf(str, "fff", X, Y, Z))
        {
            CreateDynamicPickup(1239, 1, X, Y, Z, -1, -1, -1);
            CreateDynamic3DTextLabel("{00ff00}Park here and type {ff0000}/REFILL", 0xffffffff, X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0);
            CreateDynamicMapIcon(X, Y, Z, 56, 0, -1, -1, -1, 300.0);
            GasStation[count] = CreateDynamicRectangle(X-GAS_RANGE, Y-GAS_RANGE, X+GAS_RANGE, Y+GAS_RANGE, -1, 0, -1);
        }
        else
        {
            errors++;
            printf("[Ocar] Warning: Wrong syntax found in line %d of file 'gasstations.lwd'!", count+1);
        }
        count++;
    }
    fclose(gasst);
    printf("Ocar] %d gas stations loaded!", count-errors);
    WWW = TextDrawCreate(612.0,9.0,WEBSITE);
    TextDrawUseBox(WWW, 0);
    TextDrawFont(WWW, 3);
    TextDrawSetShadow(WWW, 1);
    TextDrawSetOutline(WWW, 2);
    TextDrawBackgroundColor(WWW, 0x000000FF);
    TextDrawColor(WWW, 0xFFFFFFFF);
    TextDrawAlignment(WWW, 3);
    TextDrawLetterSize(WWW, 0.3, 1.0);
    for(new i; i < MAX_PLAYERS; i++)
    {
        TextDrawShowForPlayer(i, WWW);
        Speedo[i][Timer] = SetTimerEx("SpeedUpdate", 250, true, "d", i);
        Speedo[i][Txd] = TextDrawCreate(520, 395, "~r~Loading...");
        TextDrawFont(Speedo[i][Txd], 1);
        TextDrawLetterSize(Speedo[i][Txd], 0.375, 1.5);
        TextDrawColor(Speedo[i][Txd], 0xFFFFFFFF);
        TextDrawSetOutline(Speedo[i][Txd], 1);
        TextDrawSetShadow(Speedo[i][Txd], 1);
        TextDrawHideForPlayer(i, Speedo[i][Txd]);
    }
    printf("[Ocar] OnFilterScriptInit completed in %d ms with %d errors!", GetTickCount()-time, errors);
    return 1;
}

stock IsPlayerInGasStation(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    for(new i; i < MAX_GAS_STATIONS; i++)
    {
        if(IsValidDynamicArea(GasStation[i]) && IsPlayerInDynamicArea(playerid, GasStation[i]))
        {
            return 1;
        }
    }
    return 0;
}

CMD:creategasstation(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "ERROR: You don't have permission to use this command!");
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    for(new i; i < MAX_GAS_STATIONS; i++)
    {
        if(GasStation[i] == -1)
        {
            CreateDynamicPickup(1239, 1, X, Y, Z, -1, -1, -1);
            CreateDynamic3DTextLabel("{00ff00}Park here and type {ff0000}/REFILL", 0xffffffff, X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0);
            CreateDynamicMapIcon(X, Y, Z, 56, 0, -1, -1, -1, 300.0);
            Streamer_Update(playerid);
            new File:gasst = fopen("gasstations.lwd", io_append);
            fseek(gasst, 0, seek_end);
            format(str, sizeof(str), "%.4f %.4f %.4f\r\n", X, Y, Z);
            fwrite(gasst, str);
            fclose(gasst);
            GasStation[i] = CreateDynamicRectangle(X-GAS_RANGE, Y-GAS_RANGE, X+GAS_RANGE, Y+GAS_RANGE, -1, 0, -1);
            SendClientMessage(playerid, blue, "Gas station created successfully!");
            return 1;
        }
    }
    SendClientMessage(playerid, red, "ERROR: No gas station slots left! {ffff00}Open OCar script and change MAX_GAS_STATIONS value!");
    return 1;
}

CMD:refill(playerid, params[])
{
    #pragma unused params
    if(GetPlayerVehicleID(playerid) == 0 || GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, red, "ERROR: You are not driving a vehicle");
    if(IsPlayerInGasStation(playerid))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(GetPVarInt(playerid, "Refueling") == 1) return SendClientMessage(playerid, red, "ERROR: You are already refueling your vehicle");
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessage(playerid,red,"ERROR: This vehicle doesn't needs fuel!");
        if(GetGVarFloat("Fuel", vehicleid) >= 100) return SendClientMessage(playerid, red, "ERROR: Your gas tank is full!");
        SetPVarInt(playerid, "Refueling", 1);
        SetVehicleParamsEx(vehicleid, 0, 0, -1, -1, -1, -1, -1);
        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, blue, "Now refueling...");
        GameTextForPlayer(playerid, "~r~HOLD ~y~~k~~TOGGLE_SUBMISSIONS~ ~r~to refuel your vehicle!~n~~g~USE ~w~~k~~VEHICLE_HANDBRAKE~ ~g~to exit refuel mode!", 10000, 4);
        SetPVarInt(playerid, "RefuelCount", 0);
       
    }
    else return SendClientMessage(playerid, red, "ERROR: You aren't on a gas station!");
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPVarInt(playerid, "Refueling") != 0)
    {
        if(PRESSED(KEY_SUBMISSION))
        {
            SetPVarInt(playerid, "RefuelTimer", SetTimerEx("ReFill", REFUEL_TIME, true, "i", playerid));
            SetPVarInt(playerid, "RefuelingEx", 1);
        }
        if(RELEASED(KEY_SUBMISSION))
        {
            if(GetPVarInt(playerid, "RefuelingEx"))
            {
                KillTimer(GetPVarInt(playerid, "RefuelTimer"));
                SetPVarInt(playerid, "RefuelingEx", 0);
            }
        }
        if(PRESSED(KEY_HANDBRAKE))
        {
            StopRefueling(playerid);
        }
    }
    return 1;
}

stock StopRefueling(playerid)
{
    GivePlayerMoney(playerid, -GetPVarInt(playerid, "RefuelCount"));
    new refuelmsg[128];
    format(refuelmsg, sizeof(refuelmsg), "Vehicle refueled for {ff0000}$%d", GetPVarInt(playerid, "RefuelCount"));
    SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1, 1, -1, -1, -1, -1, -1);
    if(GetPVarInt(playerid, "RefuelingEx") != 0) KillTimer(GetPVarInt(playerid, "RefuelTimer"));
    SetPVarInt(playerid, "Refueling", 0);
    SetPVarInt(playerid, "RefuelingEx", 0);
    return SendClientMessage(playerid,blue, refuelmsg);
}

public ReFill(playerid)
{
    new vid = GetPlayerVehicleID(playerid);
    if(GetPlayerMoney(playerid) <= GetPVarInt(playerid, "RefuelCount"))
    {
        SendClientMessage(playerid, red, "ERROR: You don't have enough money for more fuel!");
        return StopRefueling(playerid);
    }
    SetVehicleParamsEx(vid, 0, 0, -1, -1, -1, -1, -1);
    SetGVarFloat("Fuel", GetGVarFloat("Fuel", vid)+1.0, vid);
    SetPVarInt(playerid, "RefuelCount", GetPVarInt(playerid, "RefuelCount")+10);
    if(GetGVarFloat("Fuel", vid) >= 100.0)
    {
        StopRefueling(playerid);
        return SetGVarFloat("Fuel", 110.0, vid);
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    SetGVarFloat("Fuel", 110.0, vehicleid);
    return 1;
}

public OnFilterScriptExit()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        TextDrawHideForPlayer(i, Speedo[i][Txd]);
        KillTimer(Speedo[i][Timer]);
        TextDrawDestroy(Speedo[i][Txd]);
    }
    return 1;
}

Float:GetVehicleSpeed(vehicleid)
{
    new
        Float:vX,
        Float:vY,
        Float:vZ;
    GetVehicleVelocity(vehicleid, vX, vY, vZ);
    return floatsqroot(vX*vX + vY*vY + vZ*vZ);
}

public SpeedUpdate(playerid)
{
    if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid)) return 0;
    TextDrawShowForPlayer(playerid, WWW);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vid = GetPlayerVehicleID(playerid), Float:vhealth, Float:Speed = (GetVehicleSpeed(vid)*165), fstr[40];
        GetVehicleHealth(vid, vhealth);
        new Float:vFuel = GetGVarFloat("Fuel", vid), pos;
        vFuel = floatsub(vFuel, (floatmul(FUEL_MULTIPLIER, floatdiv(floatdiv(floatdiv(Speed, 60), 60), 4))));
        format(str, sizeof(str), "%.0f", vFuel);
        strmid(fstr, str, 0, strlen(str)-1);
        sscanf(fstr, "d", pos);
        pos++;
        fstr= "IIIIIIIIII";
        if(GetPVarInt(playerid, "Refueling") != 0)
        {
            if(GetPVarInt(playerid, "RefuelingEx"))
            {
                if(pos < 1) fstr = "~w~IIIIIIIIII";
                else
                {
                    switch(pos)
                    {
                        case 1: fstr = "~p~I~w~IIIIIIIII";
                        case 2: fstr = "~p~II~w~IIIIIIII";
                        case 3: fstr = "~p~III~w~IIIIIII";
                        case 4: fstr = "~p~IIII~w~IIIIII";
                        case 5: fstr = "~p~IIIII~w~IIIII";
                        case 6: fstr = "~p~IIIIII~w~IIII";
                        case 7: fstr = "~p~IIIIIII~w~III";
                        case 8: fstr = "~p~IIIIIIII~w~II";
                        case 9: fstr = "~p~IIIIIIIII~w~I";
                        case 10: fstr = "~p~IIIIIIIIII~w~";
                        default: fstr = "~p~IIIIIIIIII~w~";
                    }
                }
            }
            else
            {
                format(fstr, sizeof(str), "~b~~h~~h~%s", fstr);
            }
        }
        else
        {
            if(pos < 1) fstr = "~r~IIIIIIIIII";
            else
            {
                switch(pos)
                {
                    case 1: fstr = "~g~I~r~IIIIIIIII";
                    case 2: fstr = "~g~II~r~IIIIIIII";
                    case 3: fstr = "~g~III~r~IIIIIII";
                    case 4: fstr = "~g~IIII~r~IIIIII";
                    case 5: fstr = "~g~IIIII~r~IIIII";
                    case 6: fstr = "~g~IIIIII~r~IIII";
                    case 7: fstr = "~g~IIIIIII~r~III";
                    case 8: fstr = "~g~IIIIIIII~r~II";
                    case 9: fstr = "~g~IIIIIIIII~r~I";
                    case 10: fstr = "~g~IIIIIIIIII~r~";
                    default: fstr = "~g~IIIIIIIIII~r~";
                }
            }
            if(vFuel <= 0.0)
            {
                vFuel = 0.0;
                SetVehicleParamsEx(vid, 0, 0, -1, -1, -1, -1, -1);
                if(!GetPVarInt(playerid, "OP:FuelAdvise"))
                {
                    SetPVarInt(playerid, "OP:FuelAdvise", 1);
                    SendClientMessage(playerid, 0xFF0000FF, "Your vehicle ran out of fuel! {33FF00}Call /assistance for help!");
                }
            }
            else
            {
                SetVehicleParamsEx(vid, 1, 1, -1, -1, -1, -1, -1);
                SetPVarInt(playerid, "OP:FuelAdvise", 0);
            }
            if(vhealth <= 350 && !GetPVarInt(playerid, "OP:Repaired"))
            {
                SetVehicleHealth(vid, 350.0);
                SetVehicleParamsEx(vid, 0, 0, -1, -1, -1, -1, -1);
                if(!GetPVarInt(playerid, "OP:HealthAdvise"))
                {
                    SetPVarInt(playerid, "OP:HealthAdvise", 1);
                    SendClientMessage(playerid, 0xFF0000FF, "Your vehicle broke! {33FF00}Call /assistance for help!");
                }
            }
            else if(vFuel > 0.0)
            {
                SetVehicleParamsEx(vid, 1, 1, -1, -1, -1, -1, -1);
                SetPVarInt(playerid, "OP:HealthAdvise", 0);
            }
        }
        SetGVarFloat("Fuel", vFuel, vid);
        format(str, sizeof(str), "~b~SPEED: ~w~%.0f km/h~n~~r~FUEL: %s", Speed, fstr);
        TextDrawSetString(Speedo[playerid][Txd], str);
        TextDrawShowForPlayer(playerid, Speedo[playerid][Txd]);
    }
    else
    {
        if(GetPVarInt(playerid, "Refueling") != 0)
        {
            StopRefueling(playerid);
        }
        TextDrawHideForPlayer(playerid, Speedo[playerid][Txd]);
    }
    return 1;
}

CMD:debug(playerid, params[])
{
    new Float:fuel;
    if(!sscanf(params, "f", fuel))
    {
        SetGVarFloat("Fuel", fuel, GetPlayerVehicleID(playerid));
        GivePlayerMoney(playerid, 9999);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(GetPVarInt(playerid, "Refueling") != 0)
    {
        StopRefueling(playerid);
    }
    return 1;
}












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)
{
    // Setup the speedometer for the player
    APlayerData[playerid][SpeedometerText] = TextDrawCreate(500.0, 395.0, " ");
    APlayerData[playerid][FuelGauge] = TextDrawCreate(500.0, 410.0, " ");
    // Enable the TextDraw for this player
    TextDrawShowForPlayer(playerid, APlayerData[playerid][SpeedometerText]);
    TextDrawShowForPlayer(playerid, APlayerData[playerid][FuelGauge]);

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

    return 1;
}

// This function cleans up the speedometer for the given player
Speedometer_Cleanup(playerid)
{
    // 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[20];
    new Msg[128], Name[24];

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

    //******************************************************************************************************************************
    // Anti-hack stuff
    //******************************************************************************************************************************

    AntiHack(playerid);

    //******************************************************************************************************************************
    // End of anti-hack stuff
    //******************************************************************************************************************************

    // 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, "{00FF00}Player {FFFF00}%s{00FF00} has entered a vehicle, changing spectate mode to match", Name);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
        else // The player is spectating a vehicle
        {
            // Check if the target player has exited a vehicle
            if (GetPlayerVehicleSeat(OtherPlayer) == -1)
            {
                // Change spectate mode to player
                PlayerSpectatePlayer(playerid, OtherPlayer);
                SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
                APlayerData[playerid][SpectateID] = OtherPlayer;
                APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
                format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} has exited a vehicle, changing spectate mode to match", Name);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
    }

    // When the player got a wanted level and a police player warned him to stop, a timer is started and a variable is set to "true"
    // Check if this variable has been set
    if (APlayerData[playerid][PoliceWarnedMe] == true)
    {
        // Check if the player has no wanted level anymore (after finishing a overloaded mission, player got fined, ...)
        if (GetPlayerWantedLevel(playerid) == 0)
        {
            APlayerData[playerid][PoliceCanJailMe] = false; // Clear the variable
            APlayerData[playerid][PoliceWarnedMe] = false; // Clear the variable
            APlayerData[playerid][Value_PoliceCanJailMe] = 0; // Clear the remaining time for the timer
            KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]); // Kill the timer
        }
    }

    // If the player is inside a vehicle
    if(vehicleid != 0)
    {
        // Get the vehicles velocity
        GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
        // Calculate the speed (in kph)
        final_speed = floatsqroot(((speed_x * speed_x) + (speed_y * speed_y)) + (speed_z * speed_z)) * 158.179;
        // Convert the float value to an int value
        final_speed_int = floatround(final_speed, floatround_round);
        // Also save the speed for the player
        APlayerData[playerid][PlayerSpeed] = final_speed_int;
        // Setup the string to display for the player and display it
        format(speed_string, 50, TXT_SpeedometerSpeed, final_speed_int);
        TextDrawSetString(APlayerData[playerid][SpeedometerText], speed_string);

        // Add the speed to the stats (this will be the meters driven in total)
        APlayerData[playerid][StatsMetersDriven] = APlayerData[playerid][StatsMetersDriven] + (final_speed / 7.2);

        // Also display the vehicle's health through the player-health bar
        GetVehicleHealth(vehicleid, vehiclehealth);
        SetPlayerHealth(playerid, vehiclehealth / 10.0);

        // Check if the speed is above 10kph and the fuel of the vehicle isn't empty yet
        if ((final_speed_int > 10) && (AVehicleData[vehicleid][Fuel] > 0))
            AVehicleData[vehicleid][Fuel] = AVehicleData[vehicleid][Fuel] - 1; // Decrease the fuel for this vehicle every time the timer is run

        // Construct the fuelgauge
        if ((AVehicleData[vehicleid][Fuel] > 0) && (AVehicleData[vehicleid][Fuel] < 100000))
            format(FuelStatus, 20, "~g~%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, "~g~%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, "~g~%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, "~g~%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, "~g~%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, "~g~%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, "~g~%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, "~g~%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, "~g~%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, "~g~%s", "IIIIIIIIII"); // Fuel is between 90% and 100% full (all bars are green)

        if (AVehicleData[vehicleid][Fuel] == 0)
            format(FuelStatus, 20, "~r~%s", "EMPTY"); // Fuel is empty (all bars are red)
           

        // Format the final fuel-gauge readout
        format(FuelString, 50, TXT_SpeedometerFuel, FuelStatus);
        // Display the fuel-gauge
        TextDrawSetString(APlayerData[playerid][FuelGauge], FuelString);

        // Check if the vehicle is out of fuel
        if (AVehicleData[vehicleid][Fuel] == 0)
        {
            // Stop the engine and turn off the lights
            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);
        }

        // Check if the player is not in any plane or helicopter (those cannot be caught by speedcamera's)
        if (IsVehicleAirVehicle(vehicleid) == 0)
            if (APlayerData[playerid][PlayerClass] != ClassPolice) // Check if the player isn't speeding (cops won't get caught)
                CheckPlayerSpeeding(playerid);
    }
    else
    {
        // If the player is not inside a vehicle, display an empty string (looks like the speedometer is gone)
        TextDrawSetString(APlayerData[playerid][SpeedometerText], " ");
        TextDrawSetString(APlayerData[playerid][FuelGauge], " ");
        // Set the speed of the player to 0
        APlayerData[playerid][PlayerSpeed] = 0;
    }
}



// This timer-function is called when a player picks up a refuelpickup
public RefuelVehicle(playerid)
{
    new RefuelMsg[128];
    // Get the vehicle-id of the player's vehicle
    new vID = GetPlayerVehicleID(playerid);
    // Calculate the amount of fuel that needs to be refuelled
    new Amount = MaxFuel - AVehicleData[vID][Fuel];
    // Calculate the price to refuel
    new RefuelPrice = (Amount * RefuelMaxPrice) / MaxFuel;

    // Check if the player has enough cash
    if (APlayerData[playerid][PlayerMoney] >= RefuelPrice)
    {
        // Refuel the vehicle
        AVehicleData[vID][Fuel] = MaxFuel;
        // Withdraw the money from the player
        RewardPlayer(playerid, -RefuelPrice, 0);
        // Let the player know he refuelled his vehicle
        format(RefuelMsg, 128, TXT_RefuelledVehicle, RefuelPrice);
        SendClientMessage(playerid, 0xFFFFFFFF, RefuelMsg);
    }
    else
        SendClientMessage(playerid, 0xFFFFFFFF, TXT_CannotRefuelVehicle);

    // Allow the player to move again
    TogglePlayerControllable(playerid, 1);

    return 1;
}



// This function checks if the player is speeding near a speedcamera
CheckPlayerSpeeding(playerid)
{
    // Setup local variables
    new Name[24], Msg[128];

    // Check if the player hasn't been caught speeding recently
    if (APlayerData[playerid][PlayerCaughtSpeeding] == 0)
    {
        // Loop through all speedcameras
        for (new CamID; CamID < MAX_CAMERAS; CamID++)
        {
            // Check if this camera has been created
            if (ACameras[CamID][CamSpeed] != 0)
            {
                // Check if the player is the driver of the vehicle
                if (GetPlayerVehicleSeat(playerid) == 0)
                {
                    // Check if the player's speed is greater than the speed allowed by this camera (no need to process a distance-check if not speeding)
                    if (APlayerData[playerid][PlayerSpeed] > ACameras[CamID][CamSpeed])
                    {
                        // Check if the player is near the camera
                        if (IsPlayerInRangeOfPoint(playerid, 50.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
                        {
                            // Prevent the player being caught multiple times by the same speed-camera
                            APlayerData[playerid][PlayerCaughtSpeeding] = 20;
                            // Increase the wanted-level of this player by 1 star
                            SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
                            PlayerPlaySound(playerid, 1132, 0.0, 0.0, 10.0);

                            // Let the player know he's been caught speeding
                            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerCaughtSpeeding);

                            // Get the name of the player
                            GetPlayerName(playerid, Name, sizeof(Name));
                            // Also inform all police players that this player is caught speeding
                            format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} is caught {ff0000}speeding, {00ff00}pursue and fine him", Name);
                            PlayCrimeReportForPlayer(playerid,0,3);
                            Police_SendMessage(Msg);
                        }
                    }
                }
            }
        }
    }
    else // If the player has been caught before, reduce the value until it's 0 again, then he can be caught again
        APlayerData[playerid][PlayerCaughtSpeeding]--;
}



// This function processes anti-hack stuff
stock AntiHack(playerid)
{
    // Setup local variables
    new Float:Armour;

    // Skip checking for hacks used by the player if he was reported by the Anti-Hack system already
    if (APlayerData[playerid][AutoReportTime] > 0)
    {
        // Reduce the time so the player can be reported again soon if he doesn't stop using hacks
        APlayerData[playerid][AutoReportTime]--;
        // Exit the function, this skips the hack-checks until the AutoReportTime has reached 0
        // Otherwise the player is reported every half a second until he stops using hacks
        return 1;
    }



    // Check if a filterscript gave some money (or took it) to the player
    if (GetPVarInt(playerid, "PVarMoney") != 0)
    {
        // Add the money to the players account
        APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + GetPVarInt(playerid, "PVarMoney");
        // Clear the PVar
        SetPVarInt(playerid, "PVarMoney", 0);
    }
    if (GetPVarInt(playerid, "PVarScore") != 0)
    {
        // Add the money to the players account
        APlayerData[playerid][PlayerScore] = APlayerData[playerid][PlayerScore] + GetPVarInt(playerid, "PVarScore");
        // Clear the PVar
        SetPVarInt(playerid, "PVarScore", 0);
    }

    // Reset the player's money and set it to the stored value in the player's account (do the same for scorepoints)
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, APlayerData[playerid][PlayerMoney]);
    SetPlayerScore(playerid, APlayerData[playerid][PlayerScore]);

    // Limit the cash that the player can have
    if (APlayerData[playerid][PlayerMoney] > 999000000)
        APlayerData[playerid][PlayerMoney] = 999000000;

    // Limit the cash that the player can have below 0
    if (APlayerData[playerid][PlayerMoney] < -1000000)
        APlayerData[playerid][PlayerMoney] = -1000000;

    // Port anyone out of the area who is not an admin and inside the area 69
    Player_PortOutAdminZone(playerid, 2287.6995, 602.9114, 10.8203, 2300.0247, 524.9927, 1.7944, 15.0, 1732.0, 25.0);

    // Weapon hacks are also neutralized here, except for police players (if they are allowed to have weapons)
    if ((PoliceGetsWeapons == true) && (APlayerData[playerid][PlayerClass] == ClassPolice))
    {
        // Do nothing
    }
    //else
        //ResetPlayerWeapons(playerid); // Remove all weapons from the player

    // Check if the player got any armour (= health-hack)
    GetPlayerArmour(playerid, Armour);
    // Send an automated report to the admins so they're informed about it and can take action
    if (Armour > 1.0)
        SendReportToAdmins(playerid, "Armour Hack", true);

    // Check if the speed is higher than 300 (kick player if it is)
    // Send an automated report to the admins so they're informed about it and can take action
    if (APlayerData[playerid][PlayerSpeed] > 300)
        SendReportToAdmins(playerid, "Speed hack", true);

    // Check if the player is not allowed to have a jetpack (admins lvl 3 and higher can use /fly, so they will be excluded)
    if (APlayerData[playerid][PlayerLevel] < 3)
    {
        // Check if the player is using a jetpack
        // Send an automated report to the admins so they're informed about it and can take action
        if (GetPlayerSpecialAction(playerid) == 2)
            SendReportToAdmins(playerid, "Jetpack hack", true);
    }

    // Detect airbreak hack
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        // Check if the player is nearly standing still
        if (APlayerData[playerid][PlayerSpeed] < 10)
        {
            // Check if the player switched interior-id's
            if (GetPlayerInterior(playerid) != APlayerData[playerid][PreviousInt])
            {
                // Check if the new interior is the normal world or any mod-shop
                switch (GetPlayerInterior(playerid))
                {
                    case 0, 1, 2, 3: // Check interiors 0, 1, 2 and 3 (normal world and all mod-shops)
                    {
                        // Store the player's current location and interior-id for the next iteration
                        GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
                        APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
                        // Exit the function
                        return 1;
                    }
                }
            }

            // Check if the player is still near the same place he was half a second ago
            if (IsPlayerInRangeOfPoint(playerid, 7.5, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]))
            {
            }
            else // Send an automated report to the admins so they're informed about it and can take action
                SendReportToAdmins(playerid, "Airbreak-hack", true);
        }
    }
    // Store the player's current location and interior-id for the next iteration
    GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
    APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);

    return 1;
}
This is the include i want changing
Reply
#2

yes
youll need to hook the callbacks though,
lookup ALS or y_hooks for that part!
but yes very possible and is something i have done a few times in the past.
Reply
#3

i dont no how to do it what soever lol
Reply
#4

what dont you know?

you clearly developed some filterscripts so you do know how to code,
all you need to learn is the ALS code or how to use y_hooks
abd move all your code into an include,
then replace your callbacks with a hooked version,


just some reading, not hard!
Reply
#5

Yeah i have made some fs , But ive had help. and i dont get this type of thing at all i keep getting errors
Reply
#6

well post your errors so we can help you!

otherwise put a request in the "Script Request Thread"

if you want it done for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)