Jump to content

HELP!! Showroom problem


camera88

Recommended Posts

SCRIPT ERROR: @vrp_showroom/server.lua:68: attempt to perform arithmetic on a nil value
[ script:vrp_showroom] > getNameAndTypeOfCar (@vrp_showroom/server.lua:68)
[ script:vrp_showroom] > ref (@vrp_showroom/server.lua:116)
[ script:vrp_showroom] > <unknown> (@oxmysql/dist/build.js:21745)
[ script:vrp_showroom] > runMicrotasks (<anonymous>:0)
[ script:vrp_showroom] > processTicksAndRejections (node:internal/process/task_queues:96)
[ script:vrp_showroom] > async rawQuery (@oxmysql/dist/build.js:21735)

 

Help me Please solve problem?

 

 

 

local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")

vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","sx_dealership")
vRPCds = Tunnel.getInterface("sx_dealership","sx_dealership")
vRPds = {}
Tunnel.bindInterface("sx_dealership",vRPds)
Proxy.addInterface("sx_dealership",vRPds)

local prefix = {
    ["AB"] = "Alba",
    ["AR"] = "Arad",
    ["AG"] = "Arges",
    ["BC"] = "Bacau",
    ["BH"] = "Bihor",
    ["BN"] = "Bistrita-Nasaud",
    ["BT"] = "Botosani",
    ["BR"] = "Braila",
    ["BV"] = "Brasov",
    ["BZ"] = "Buzau",
    ["CL"] = "Calarasi",
    ["CS"] = "Caras-Severin",
    ["CJ"] = "Cluj",
    ["CT"] = "Constanta",
    ["CV"] = "Covasna",
    ["DB"] = "Dambovita",
    ["DJ"] = "Dolj",
    ["GL"] = "Galati",
    ["GR"] = "Giurgiu",
    ["GJ"] = "Gorj",
    ["HR"] = "Harghita",
    ["HD"] = "Hunedoara",
    ["IL"] = "Ialomita",
    ["IS"] = "Iasi",
    ["IF"] = "Ilfov",
    ["MM"] = "Maramures",
    ["MH"] = "Mehedinti",
    ["MS"] = "Mures",
    ["NT"] = "Neamt",
    ["OT"] = "Olt",
    ["PH"] = "Prahova",
    ["SJ"] = "Salaj",
    ["SM"] = "Satu Mare",
    ["SB"] = "Sibiu",
    ["SV"] = "Suceava",
    ["TR"] = "Teleorman",
    ["TM"] = "Timis",
    ["TL"] = "Tulcea",
    ["VL"] = "Valcea",
    ["VS"] = "Vaslui",
    ["VN"] = "Vrancea",
    ["B"] = "Bucuresti"
}

local culori = {
    danger = 12263716,
    warning = 15773006,
    success = 2276147,
    info =     6013150
}

local function discordLog(url, embed)
    PerformHttpRequest(url, function(err, text, headers) end, 'POST', json.encode({embeds = embed}), { ['Content-Type'] = 'application/json' })
end

local getNameAndTypeOfCar = function(carModel)
    local carName = carModel:sub(1,carModel:find(" ")-1)
    local extractModel = string.gsub(carModel, carName, " ")
    local carType = extractModel:gsub("%s+", "")
    return carName,carType
end

function numWithCommas(n)
    return tostring(math.floor(n)):reverse():gsub("(%d%d%d)","%1,")
                                  :gsub(",(%-?)$","%1"):reverse()
  end

function vRPds.checkMoneyForTesting(price)
    local user_id = vRP.getUserId({source})
    if user_id ~= nil then
        local money = vRP.getMoney({user_id})
        testPrice = 0
        if price > 0 then
            if vRP.tryPayment({user_id,testPrice}) then 
                return true
            else
                return false
            end
        else
            return false
        end
    end
end

function vRPds.checkMoneyForBuyingVehicle(showroomID,selectedVehicle, categorie)
    local user_id = vRP.getUserId({source})
    local player = vRP.getUserSource({user_id})
    if user_id ~= nil then
        local vehID = math.random(1,9999)
        cityPrefix = {}
        for i, v in pairs(prefix) do
            table.insert(cityPrefix, i)
        end
        thePlate = cityPrefix[math.random(#cityPrefix)].." "..vehID
        for k,v in pairs(config.dealerships[showroomID].vehicles[categorie]) do 
            if v.vehID == selectedVehicle then
                model = v.spawncode
                numeMasina = k
                if vRP.tryPayment({user_id,v.price}) then
                    exports["oxmysql"]:query("SELECT vehicle FROM vrp_user_vehicles WHERE user_id = @user_id AND vehicle = @vehicle", {['@user_id'] = user_id, ['@vehicle'] = model}, function (haveCar)
                        if #haveCar > 0 then
                            vRPclient.notify(player,{"You already own this vehicle."})
                        else
                            print(numeMasina)
                            local marcaMasina,modelMasina = getNameAndTypeOfCar(numeMasina)
                            exports["oxmysql"]:query("INSERT IGNORE INTO vrp_user_vehicles(user_id,vehicle,upgrades,vehicle_plate,numeMasina,marcaMasina,modelMasina,price,garage) VALUES(@user_id,@vehicle,@upgrades,@vehicle_plate,@numeMasina,@marcaMasina,@modelMasina,@price,@garage)", {
                                ['@user_id'] = user_id,
                                ['@vehicle'] = model,
                                ['@upgrades'] = json.encode(tuning),
                                ['@vehicle_plate'] = thePlate,
                                ['@numeMasina'] = numeMasina,
                                ['@marcaMasina'] = marcaMasina,
                                ['@modelMasina'] = modelMasina,
                                ['@price'] = v.price,
                                ['@garage'] = "Civil"
                            })
                            vRPclient.notify(player, {"Ai platit ~g~$"..v.price.."~w~ pentru "..k.."!\nDu-te la un garaj pentru a-l scoate!"})
                        
                        end
                    end)
                    return true 
                else
                    vRPclient.notify(player,{"You don't have enough money to buy this vehicle."})
                    return false
                end
            end
        end
    end
end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...