Hello there fellas.

I grabbed the open supply of This Release and rewrote it to match QBCore framework.

All prizes should be configured by hand and a few customized code have to be added into the qb-vehicleshop (look under for this code).

The automobile spawned contained in the on line casino and outlined within the luckywheel-script is the automobile qb-vehicleshop offers out if you win a automobile.

Add to: qb-vehicleshopclient.lua

RegisterNetEvent('qb-vehicleshop:consumer:winCar', perform (carname)
	native car = QBCore.Capabilities.GetClosestVehicle(vector3(935.01, 42.80, 72.43))
	native showCar = carname
	TriggerServerEvent('qb-vehicleshop:server:luckywheelWin', car, showCar)
finish)

RegisterNetEvent('qb-vehicleshop:consumer:winLuckyWheelVehicle', perform(car, plate)
    QBCore.Capabilities.SpawnVehicle(carmodel, perform(veh)
        TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1)
        exports['LegacyFuel']:SetFuel(veh, 100)
        SetVehicleNumberPlateText(veh, plate)
        SetEntityHeading(veh, Config.LuckyWheel.w)
        SetEntityAsMissionEntity(veh, true, true)
        TriggerEvent("vehiclekeys:consumer:SetOwner", QBCore.Capabilities.GetPlate(veh))
        TriggerServerEvent("qb-vehicletuning:server:SaveVehicleProps", QBCore.Capabilities.GetVehicleProperties(veh))
    finish, Config.LuckyWheel, true)
finish)

Add to: qb-vehicleshopserver.lua

-- Win automobile at luckywheel
RegisterNetEvent('qb-vehicleshop:server:luckywheelWin', perform(information, carname)
    native src = supply
    native Participant = QBCore.Capabilities.GetPlayer(src)
	native PlayerData = Participant.PlayerData
	native car = information
	native showCar = carname
	
	
    native plate = GeneratePlate()
    MySQL.Async.insert('INSERT INTO player_vehicles (license, citizenid, car, hash, mods, plate, state, storage) VALUES (?, ?, ?, ?, ?, ?, ?, ?)', {
        PlayerData.license,
        PlayerData.citizenid,
        carname,
        GetHashKey(car),
        '{}',
        plate,
        1,
		'casinovalet'
    })
    TriggerClientEvent('qb-vehicleshop:consumer:winLuckyWheelVehicle', src, car, plate)
    TriggerClientEvent('QBCore:Notify', src, 'Congratulations! Your car could be claimed on the valet close to the doorway.', 'success')
finish)

Finest regards, Revoxxi.



Looking for paid scripts? Click here