Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SHOWROOM
- RegisterServerEvent('veh_SR:CheckMoneyForVeh')
- AddEventHandler('veh_SR:CheckMoneyForVeh', function(vehicle, price ,veh_type)
- local user_id = vRP.getUserId(player)
- local player = vRP.getUserSource({user_id})
- MySQL.query("vRP/get_vehicle", {user_id = user_id, vehicle = vehicle}, function(pvehicle, affected)
- if #pvehicle > 0 then
- vRPclient.notify(player,{"~r~Vehicle already owned."})
- elseif vRP.hasPermission({user_id,"showroom.compra"}) then
- if vRP.tryFullPayment({user_id,price}) then
- vRP.getUserIdentity({user_id, function(identity)
- MySQL.query("vRP/add_custom_vehicle", {user_id = user_id, vehicle = vehicle, vehicle_plate = "P "..identity.registration, veh_type = veh_type})
- end})
- TriggerClientEvent('veh_SR:CloseMenu', player, vehicle, veh_type)
- vRPclient.notify(player,{"Paid ~r~"..price.."$."})
- else
- vRPclient.notify(player,{"~r~Non hai abbastanza soldi."})
- end
- else
- vRPclient.notify(player,{"~r~Non hai il permesso."})
- end
- end)
- end)
- RegisterServerEvent('veh_SR:CheckMoneyForBasicVeh')
- AddEventHandler('veh_SR:CheckMoneyForBasicVeh', function(user_id, vehicle, price ,veh_type)
- local player = vRP.getUserSource({user_id})
- MySQL.query("vRP/get_vehicle", {user_id = user_id, vehicle = vehicle}, function(pvehicle, affected)
- if #pvehicle > 0 then
- vRPclient.notify(player,{"~r~Vehicle already owned."})
- vRP.giveMoney({user_id,price})
- elseif vRP.hasPermission({user_id,"showroom.compra"}) then
- vRPclient.notify(player,{"Paid ~r~"..price.."$."})
- vRP.getUserIdentity({user_id, function(identity)
- MySQL.query("vRP/add_custom_vehicle", {user_id = user_id, vehicle = vehicle, vehicle_plate = "P "..identity.registration, veh_type = veh_type})
- end})
- Gclient.spawnBoughtVehicle(player,{veh_type, vehicle})
- else
- vRPclient.notify(player,{"~r~Non hai il permesso."})
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement