create a qbcore caddy rental script using the E key with a marker and caddy spawn at…
- User
create a qbcore caddy rental script using the E key with a marker and caddy spawn at coordinates (x = -1344.56, y = 128.02, z = 56.24)
- Assistant
- User
convert to qbcore Citizen.CreateThread(function() marker = CreateMarker(markerData) end)
- Assistant
- User
fix QBCore.Functions.CreateUseableItem("caddy_rental", function(source) local Player = QBCore.Functions.GetPlayer(source) local price = 100 -- Adjust the price as needed
if Player.Functions.RemoveMoney("cash", price) then TriggerClientEvent('caddy_rental:spawnCaddy', source) else TriggerClientEvent('QBCore:Notify', source, 'You don\'t have enough money to rent a caddy.', 'error') endend)
- Assistant
Here's the fixed code for creating a useable item "caddy_rental" with QBcore:
QBCore.Functions.CreateUseableItem("caddy_rental", function(source) local player = QBCore.Functions.GetPlayer(source) local price = 100 -- Adjust the price as needed if player.PlayerData.money["cash"] >= price then player.Functions.RemoveMoney("cash", price) TriggerClientEvent('caddyRental:rentCaddy', source) else TriggerClientEvent('QBCore:Notify', source, 'You don\'t have enough money to rent a caddy.', 'error') end end)Make sure to replace all instances of
caddy_rentalwith the appropriate item name. Also, ensure that you have theQBCore:Notifyevent implemented on the client-side to display the notification messages.Let me know if you need further assistance!