Security HUD
System Watchdog
×
Threads Scanned
-- / --
SYS. LOAD --%
AI SHIELD ACTIVE
DMCA Policy
×

📋 DMCA Compliance

This platform and community fully complies with the Digital Millennium Copyright Act (DMCA) and international copyright laws. We take all copyright protection seriously.

🛡️ Copyright Protection

If you believe a posted item belongs to you or violates your copyright, you may file a DMCA takedown request through our official channels. Upon receiving a valid claim, the infringing content will be removed within 24 hours.

What's new
×
Fiveguard

Question HELP WITH TRUCK SIMULATOR ERROR

kaz189

Gold Elite
Joined
Aug 23, 2021
Messages
111
Reaction score
627
Points
316
Location
New Zealand
Hey guys,

Just needing help with this error on my trucking job. Every time i go to get a job in the truck simulator job it throws the error below. The menu and everything else works fine its just getting a quick job to work and then when i spawn a truck its locked. I cant get in even thou i am the owner.

This is the error:


Desktop Screenshot 2022.04.14 - 14.55.47.97 (2).png

Here is the line its refurring too:
Desktop Screenshot 2022.04.14 - 16.39.08.32_LI.jpg


Here is the sql:

CREATE TABLE IF NOT EXISTS `trucker_available_contracts` (
`contract_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`contract_type` BIT(1) NOT NULL DEFAULT b'0',
`contract_name` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',
`coords_index` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
`price_per_km` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`cargo_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`fragile` BIT(1) NOT NULL DEFAULT b'0',
`valuable` BIT(1) NOT NULL DEFAULT b'0',
`fast` BIT(1) NOT NULL DEFAULT b'0',
`truck` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
`trailer` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`contract_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE IF NOT EXISTS `trucker_drivers` (
`driver_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` VARCHAR(50) NULL DEFAULT NULL,
`name` VARCHAR(50) NOT NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',
`product_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`distance` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`valuable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`fragile` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`fast` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`price` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`price_per_km` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`img` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`driver_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE IF NOT EXISTS `trucker_loans` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` VARCHAR(50) NOT NULL,
`loan` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`remaining_amount` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`day_cost` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`taxes_on_day` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`timer` INT(10) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE IF NOT EXISTS `trucker_trucks` (
`truck_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` VARCHAR(50) NOT NULL,
`truck_name` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_general_ci',
`driver` INT(10) UNSIGNED NULL DEFAULT NULL,
`body` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1000',
`engine` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1000',
`transmission` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1000',
`wheels` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1000',
PRIMARY KEY (`truck_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
CREATE TABLE IF NOT EXISTS `trucker_users` (
`user_id` VARCHAR(50) NOT NULL,
`money` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`total_earned` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`finished_deliveries` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`exp` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`traveled_distance` DOUBLE UNSIGNED NOT NULL DEFAULT '0',
`skill_points` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`product_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`distance` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`valuable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`fragile` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`fast` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`loan_notify` BIT(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`user_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;


Thank you so much for your help guys. Really do appreciate it.
 
Last edited:

snitchers

Developer
Joined
Oct 12, 2021
Messages
72
Solutions
4
Reaction score
1,657
Points
306
Location
Netherlands
*bump please help
Try this one:


Code:
RegisterServerEvent("truck_logistics:startContract")
AddEventHandler("truck_logistics:startContract",function(data)
    local id = data.id
    local distance = data.distance
    local reward = data.reward
    print("id: " .. id)
    local source = source
    if debug_cooldown[source] == nil then
        debug_cooldown[source] = true
        local xPlayer = QBCore.Functions.GetPlayer(source)
        local user_id = xPlayer.PlayerData.citizenid
        if user_id then
            local query = exports.oxmysql:execute("SELECT * FROM `trucker_available_contracts` WHERE contract_id = @id",{['@id'] = id}, function(query)
                if query and query[1] then
                    query_users = exports.oxmysql:execute("SELECT * FROM `trucker_users` WHERE user_id = @user_id", {['@user_id'] = user_id}, function(query_users)
                        if query_users and query_users[1] then
                            if tonumber(query_users[1].product_type) >= tonumber(query[1].cargo_type) then
                                print("query_users: " ..tonumber(query_users[1].fragile))
                                print("query: "..tonumber(query[1].fragile))
                                if tonumber(query_users[1].fragile) >= tonumber(query[1].fragile) then
                                    if tonumber(query_users[1].valuable) >= tonumber(query[1].valuable) then
                                        if tonumber(query_users[1].fast) >= tonumber(query[1].fast) then
                                            if Config.habilidade_distancia[tonumber(query_users[1].distance)] >= tonumber(distance) then
                                                if tonumber(query[1].contract_type) == 0 then
                                                    -- Inicia o trabalho
                                                    TriggerClientEvent("truck_logistics:startContract",source,query[1],distance,reward,{})
                                                else
                                                    -- Checa se tem caminhão
                                                    query_truck = exports.oxmysql:execute("SELECT * FROM `trucker_trucks` WHERE driver = 0 AND user_id = @user_id", {['@user_id'] = user_id}, function(query_truck)
                                                        if query_truck and query_truck[1] then
                                                            TriggerClientEvent("truck_logistics:startContract",source,query[1],distance,reward,query_truck[1])
                                                        else
                                                            TriggerClientEvent("QBCore:Notify",source, Lang[Config.lang]['own_truck'], "error")
                                                        end
                                                    end)
                                                end
                                            else
                                                TriggerClientEvent("QBCore:Notify",source, Lang[Config.lang]['no_skill_1'], "error")
                                            end
                                        else
                                            TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_2'], "error")
                                        end
                                    else
                                        TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_3'], "error")
                                    end
                                else
                                    TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_4'], "error")
                                end
                            else
                                TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_5'], "error")
                            end
                        end
                    end)
                else
                    TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['job_already_started'], "error")
                end
            end)
        end
        debug_cooldown[source] = nil
    end
end)
 

kaz189

Gold Elite
Joined
Aug 23, 2021
Messages
111
Reaction score
627
Points
316
Location
New Zealand
Try this one:


Code:
RegisterServerEvent("truck_logistics:startContract")
AddEventHandler("truck_logistics:startContract",function(data)
    local id = data.id
    local distance = data.distance
    local reward = data.reward
    print("id: " .. id)
    local source = source
    if debug_cooldown[source] == nil then
        debug_cooldown[source] = true
        local xPlayer = QBCore.Functions.GetPlayer(source)
        local user_id = xPlayer.PlayerData.citizenid
        if user_id then
            local query = exports.oxmysql:execute("SELECT * FROM `trucker_available_contracts` WHERE contract_id = @id",{['@id'] = id}, function(query)
                if query and query[1] then
                    query_users = exports.oxmysql:execute("SELECT * FROM `trucker_users` WHERE user_id = @user_id", {['@user_id'] = user_id}, function(query_users)
                        if query_users and query_users[1] then
                            if tonumber(query_users[1].product_type) >= tonumber(query[1].cargo_type) then
                                print("query_users: " ..tonumber(query_users[1].fragile))
                                print("query: "..tonumber(query[1].fragile))
                                if tonumber(query_users[1].fragile) >= tonumber(query[1].fragile) then
                                    if tonumber(query_users[1].valuable) >= tonumber(query[1].valuable) then
                                        if tonumber(query_users[1].fast) >= tonumber(query[1].fast) then
                                            if Config.habilidade_distancia[tonumber(query_users[1].distance)] >= tonumber(distance) then
                                                if tonumber(query[1].contract_type) == 0 then
                                                    -- Inicia o trabalho
                                                    TriggerClientEvent("truck_logistics:startContract",source,query[1],distance,reward,{})
                                                else
                                                    -- Checa se tem caminhão
                                                    query_truck = exports.oxmysql:execute("SELECT * FROM `trucker_trucks` WHERE driver = 0 AND user_id = @user_id", {['@user_id'] = user_id}, function(query_truck)
                                                        if query_truck and query_truck[1] then
                                                            TriggerClientEvent("truck_logistics:startContract",source,query[1],distance,reward,query_truck[1])
                                                        else
                                                            TriggerClientEvent("QBCore:Notify",source, Lang[Config.lang]['own_truck'], "error")
                                                        end
                                                    end)
                                                end
                                            else
                                                TriggerClientEvent("QBCore:Notify",source, Lang[Config.lang]['no_skill_1'], "error")
                                            end
                                        else
                                            TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_2'], "error")
                                        end
                                    else
                                        TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_3'], "error")
                                    end
                                else
                                    TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_4'], "error")
                                end
                            else
                                TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_5'], "error")
                            end
                        end
                    end)
                else
                    TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['job_already_started'], "error")
                end
            end)
        end
        debug_cooldown[source] = nil
    end
end)
Will do thank u.
 

kaz189

Gold Elite
Joined
Aug 23, 2021
Messages
111
Reaction score
627
Points
316
Location
New Zealand
Try this one:


Code:
RegisterServerEvent("truck_logistics:startContract")
AddEventHandler("truck_logistics:startContract",function(data)
    local id = data.id
    local distance = data.distance
    local reward = data.reward
    print("id: " .. id)
    local source = source
    if debug_cooldown[source] == nil then
        debug_cooldown[source] = true
        local xPlayer = QBCore.Functions.GetPlayer(source)
        local user_id = xPlayer.PlayerData.citizenid
        if user_id then
            local query = exports.oxmysql:execute("SELECT * FROM `trucker_available_contracts` WHERE contract_id = @id",{['@id'] = id}, function(query)
                if query and query[1] then
                    query_users = exports.oxmysql:execute("SELECT * FROM `trucker_users` WHERE user_id = @user_id", {['@user_id'] = user_id}, function(query_users)
                        if query_users and query_users[1] then
                            if tonumber(query_users[1].product_type) >= tonumber(query[1].cargo_type) then
                                print("query_users: " ..tonumber(query_users[1].fragile))
                                print("query: "..tonumber(query[1].fragile))
                                if tonumber(query_users[1].fragile) >= tonumber(query[1].fragile) then
                                    if tonumber(query_users[1].valuable) >= tonumber(query[1].valuable) then
                                        if tonumber(query_users[1].fast) >= tonumber(query[1].fast) then
                                            if Config.habilidade_distancia[tonumber(query_users[1].distance)] >= tonumber(distance) then
                                                if tonumber(query[1].contract_type) == 0 then
                                                    -- Inicia o trabalho
                                                    TriggerClientEvent("truck_logistics:startContract",source,query[1],distance,reward,{})
                                                else
                                                    -- Checa se tem caminhão
                                                    query_truck = exports.oxmysql:execute("SELECT * FROM `trucker_trucks` WHERE driver = 0 AND user_id = @user_id", {['@user_id'] = user_id}, function(query_truck)
                                                        if query_truck and query_truck[1] then
                                                            TriggerClientEvent("truck_logistics:startContract",source,query[1],distance,reward,query_truck[1])
                                                        else
                                                            TriggerClientEvent("QBCore:Notify",source, Lang[Config.lang]['own_truck'], "error")
                                                        end
                                                    end)
                                                end
                                            else
                                                TriggerClientEvent("QBCore:Notify",source, Lang[Config.lang]['no_skill_1'], "error")
                                            end
                                        else
                                            TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_2'], "error")
                                        end
                                    else
                                        TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_3'], "error")
                                    end
                                else
                                    TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_4'], "error")
                                end
                            else
                                TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['no_skill_5'], "error")
                            end
                        end
                    end)
                else
                    TriggerClientEvent("QBCore:Notify",source,Lang[Config.lang]['job_already_started'], "error")
                end
            end)
        end
        debug_cooldown[source] = nil
    end
end)
Imaffraid that didnt work :( but thank you anyways
 

MaxHero

Gold Elite
Joined
Jul 10, 2021
Messages
209
Solutions
5
Reaction score
292
Points
316
Location
Türkiye
:oops: QBcore ---> i have similar problem ...anyone help us ?⁉️



[script:truck_logisti] SCRIPT ERROR: @truck_logistics/server.lua:581: attempt to compare number with string
[script:truck_logisti] > ref (@truck_logistics/server.lua:581)
[script:truck_logisti] > <unknown> (@oxmysql/dist/build.js:22252)
[script:truck_logisti] > runMicrotasks (<anonymous>:0)
[script:truck_logisti] > processTicksAndRejections (node:internal/process/task_queues:96)

server.lua 581 :



RegisterServerEvent("truck_logistics:finishJob")
AddEventHandler("truck_logistics:finishJob",function(data,distance,reward,truck_data,truck_engine,truck_body,trailer_body)
local source = source
local xPlayer = QBCore.Functions.GetPlayer(source)
local citizenid = xPlayer.PlayerData.citizenid
--local CitizenId = Player.PlayerData.citizenid
if citizenid then
trailer_body = trailer_body/1000
local exp_amount = reward*(Config.exp/100)
local bonus = 0
local bonus_exp = 0
local level = getPlayerLevel(citizenid)
local sql = exports['oxmysql']:execute("SELECT * FROM `trucker_users` WHERE citizenid = @citizenid", {['@citizenid'] = citizenid}, function(result)
local query = result[1] -- 581
if type(tonumber(data.fragile)) > 0 then
bonus = bonus + reward*(Config.bonus['fragile']['dinheiro'][query.fragile]/100)
bonus_exp = bonus_exp + exp_amount*(Config.bonus['fragile']['exp'][query.fragile]/100)
end
if type(tonumber(data.valuable)) > 0 then
bonus = bonus + reward*(Config.bonus['valuable']['dinheiro'][query.valuable]/100)
bonus_exp = bonus_exp + exp_amount*(Config.bonus['valuable']['exp'][query.valuable]/100)
end
if type(tonumber(data.fast)) > 0 then
bonus = bonus + reward*(Config.bonus['fast']['dinheiro'][query.fast]/100)
bonus_exp = bonus_exp + exp_amount*(Config.bonus['fast']['exp'][query.fast]/100)
end
if distance > Config.habilidade_distancia[0] then
if Config.bonus['distance']['dinheiro'][query.distance] then
bonus = bonus + reward*(Config.bonus['distance']['dinheiro'][query.distance]/100)
bonus_exp = bonus_exp + exp_amount*(Config.bonus['distance']['exp'][query.distance]/100)
end
end
end)
 
Last edited:

darkfame

Silver Elite
Joined
Aug 8, 2023
Messages
98
Reaction score
24
Points
156
Location
Argentina
trucker_users (SERVER.LUA)
if tonumber(query_users[1].fragile) >= tonumber(query[1].fragile) then


CREATE TABLE IF NOT EXISTS `trucker_users` (
`fragile` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`user_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
 

darkfame

Silver Elite
Joined
Aug 8, 2023
Messages
98
Reaction score
24
Points
156
Location
Argentina
SOLUTION

if tonumber(query_users[1].product_type) >= tonumber(query[1].cargo_type) then
if tonumber(query_users[1].fragile) >= tonumber(query_users[1].fragile) then
if tonumber(query_users[1].valuable) >= tonumber(query_users[1].valuable) then
 
Top