Advertisement
Guest User

Untitled

a guest
May 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. -- SHOWROOM
  2. RegisterServerEvent('veh_SR:CheckMoneyForVeh')
  3. AddEventHandler('veh_SR:CheckMoneyForVeh', function(vehicle, price ,veh_type)
  4. local user_id = vRP.getUserId(player)
  5. local player = vRP.getUserSource({user_id})
  6. MySQL.query("vRP/get_vehicle", {user_id = user_id, vehicle = vehicle}, function(pvehicle, affected)
  7. if #pvehicle > 0 then
  8. vRPclient.notify(player,{"~r~Vehicle already owned."})
  9. elseif vRP.hasPermission({user_id,"showroom.compra"}) then
  10. if vRP.tryFullPayment({user_id,price}) then
  11. vRP.getUserIdentity({user_id, function(identity)
  12. MySQL.query("vRP/add_custom_vehicle", {user_id = user_id, vehicle = vehicle, vehicle_plate = "P "..identity.registration, veh_type = veh_type})
  13. end})
  14.  
  15. TriggerClientEvent('veh_SR:CloseMenu', player, vehicle, veh_type)
  16. vRPclient.notify(player,{"Paid ~r~"..price.."$."})
  17. else
  18. vRPclient.notify(player,{"~r~Non hai abbastanza soldi."})
  19. end
  20. else
  21. vRPclient.notify(player,{"~r~Non hai il permesso."})
  22. end
  23. end)
  24. end)
  25.  
  26. RegisterServerEvent('veh_SR:CheckMoneyForBasicVeh')
  27. AddEventHandler('veh_SR:CheckMoneyForBasicVeh', function(user_id, vehicle, price ,veh_type)
  28. local player = vRP.getUserSource({user_id})
  29. MySQL.query("vRP/get_vehicle", {user_id = user_id, vehicle = vehicle}, function(pvehicle, affected)
  30. if #pvehicle > 0 then
  31. vRPclient.notify(player,{"~r~Vehicle already owned."})
  32. vRP.giveMoney({user_id,price})
  33. elseif vRP.hasPermission({user_id,"showroom.compra"}) then
  34. vRPclient.notify(player,{"Paid ~r~"..price.."$."})
  35. vRP.getUserIdentity({user_id, function(identity)
  36. MySQL.query("vRP/add_custom_vehicle", {user_id = user_id, vehicle = vehicle, vehicle_plate = "P "..identity.registration, veh_type = veh_type})
  37. end})
  38. Gclient.spawnBoughtVehicle(player,{veh_type, vehicle})
  39. else
  40. vRPclient.notify(player,{"~r~Non hai il permesso."})
  41. end
  42. end)
  43. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement