Editable files

Language Files

config.langs.en = {
    blip = "Second Hand Vehicle Dealer",
    openSellMenu = "Second Hand Vehicle Dealer",
    noClosestVehicle = "There are no vehicles nearby",
    menuLabel = "Plate: %s",
    menuLabelCantSale = "Plate: %s (Can't be sold)",
    menuHeader = "Sell your car",
    menuPrice = "Set a Price",
    wrongPrice = "%s is not a number!Can't be set as Price",
    space = "Space",
    notYour = "This Vehicle doesn't belong to you",
    inspectCar = "Inspect Vehicle",
    allSlotFull = "All Vehicle slots are full, try again later!",
    noMoney = "You need $%s to buy this Vehicle",
    allReadyAdded = "This Vehicle is already added for sale",
    uCantSell = "You can't sell this Vehicle",
    testDriveStarted = "Test drive for %s sec started",
    removeVehicle = "Remove Vehicle from Sale",
    areUSureRemove = "Are you sure you want to Remove the Vehicle?",
    areUSureYes = "Yes",
    areUSureNo = "No",
    noSellVehicle = "You have no vehicle on Sale!",
    sellVehicle = "Sell Vehicle",
    mySellVehicles = "My Vehicles for Sale",

    automobile = "Car",
    bike = "Motorcycle/Bike",
    boat = "Boat",
    heli = "Helicopter",
    plane = "Plane",
    submarine = "Submarine",
    trailer = "Trailer",
    train = "Train",

    testdrive = "Test Drive",
    buy = "Buy",
    secondHandHeader = "Second Hand Vehicles",
    secondHandHeaderDesc = "We are pleased to serve you with our high-quality second-hand vehicles. You can buy or sell your vehicles with affordable prices and bank payment options. For more details, please review the catalog.",
    esc = "ESC to close",
    all = "All",
    cancel = "Cancel",
    yes = "Yes",
    testDriveDesc = "Do you want to pay {1} Dolar for the {0} Sec Test Drive?",
    buyDesc = "Do you want to buy the Vehicle for  {0} + {1}$ ?",
    testDriveSecond = "%s Sec",
    searchInput = "Search...",
    tax = "Tax",
    nullNumber = "Unknown",
    MaxSpeed = "Max Speed",
    maxBraking = "Max Brake",
    acceleration = "Speed",

    engineLevel = "Engine Level",
    brakeLevel = "Brake Level",
    transmissionLevel = "Transmission Level",
    suspensionLevel = "Suspension Level",
    armorLevel = "Armor Level",
    turboInstalled = "Has Turbo",
    turboNoInstalled = "No Turbo"
}

client/editable.lua

function carSpawned(vehicle)
    TriggerEvent("x-hotwire:give-keys", vehicle)
end

function teleportPlayer(coords)
    SetEntityCoords(PlayerPedId(), coords)
end

server/editable.lua

function isPlayerVehicle(src, plate)
    if config.test then return true end
    local xPlayer = tgiCore.getPlayer(src)
    local cid = tgiCore.getCid(xPlayer)
    if config.framework == "qb" then
        local row = singleSync('SELECT `citizenid` FROM `player_vehicles` WHERE `citizenid` = ? AND `plate` = ? LIMIT 1', { cid, plate })
        if not row then
            return false, lang.notYour
        end
        return true
    elseif config.framework == "esx" then
        local row = singleSync('SELECT `owner` FROM `owned_vehicles` WHERE `owner` = ? AND `plate` = ? LIMIT 1', { cid, plate })
        if not row then
            return false, lang.notYour
        end
        return true
    end
end

function editPlayerVehicle(cid, plate)
    if config.framework == "qb" then
        update("UPDATE player_vehicles SET citizenid = ? WHERE plate = ?", { cid, plate })
    elseif config.framework == "esx" then
        update("UPDATE owned_vehicles SET owner = ? WHERE plate = ?", { cid, plate })
    end
end

function getPlayerNumber(xPlayer)
    if GetResourceState("tgiann-phone") ~= "missing" then
        local userData = singleSync('SELECT number FROM tgiann_phone_players WHERE citizenid = ?', { tgiCore.getCid(xPlayer) })
        return userData.number or lang.nullNumber
    end

    if config.framework == "qb" then
        return xPlayer.PlayerData.charinfo.phone or lang.nullNumber
    elseif config.framework == "esx" then
        local userData = singleSync('SELECT phone_number FROM users WHERE citizenid = ?', { tgiCore.getCid(xPlayer) })
        return userData.phone_number or lang.nullNumber
    end
end

function addMoney(row) -- offline give money
    if config.framework == "qb" then
        single("SELECT money FROM players WHERE citizenid = ?", { row.owner }, function(result)
            if result then
                local moneyData = json.decode(result.money)
                moneyData.bank = moneyData.bank + row.price
                update("UPDATE players SET money = ? WHERE citizenid = ?", { json.encode(moneyData), row.owner })
            end
        end)
    elseif config.framework == "esx" then
        single("SELECT accounts FROM players WHERE identifier = ?", { row.owner }, function(result)
            if result then
                local moneyData = json.decode(result.accounts)
                moneyData.bank = moneyData.bank + row.price
                update("UPDATE players SET accounts = ? WHERE identifier = ?", { json.encode(moneyData), row.owner })
            end
        end)
    end
end

Last updated