Guest User

Untitled

a guest
Jun 7th, 2015
229
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Taxi = {}
  2.  
  3. function Taxi.init()
  4. Taxi.taxiGUI = Libs["taxiGUI"]
  5.  
  6. --MENU
  7. Taxi.taxiGUI.addButton("Cavalcade", spawnVehicle,"cavalcade2", 0,0.45,0.055,0.05)
  8. Taxi.taxiGUI.addButton("Granger", spawnVehicle,"granger", 0,0.45,0.055,0.05)
  9. Taxi.taxiGUI.addButton("Alpha", spawnVehicle,"alpha", 0,0.45,0.055,0.05)
  10. Taxi.taxiGUI.addButton("Limo", spawnVehicle,"stretch", 0,0.45,0.055,0.05)
  11. Taxi.taxiGUI.addButton("Exemplar", spawnVehicle,"exemplar", 0,0.45,0.055,0.05)
  12.  
  13. Taxi.taxiGUI.hidden = true
  14. end
  15.  
  16. function Taxi.tick()
  17. local playerPed = PLAYER.PLAYER_PED_ID()
  18. local player = PLAYER.GET_PLAYER_PED(playerPed)
  19. Taxi.taxiGUI.tick()
  20.  
  21. --TOGGLE MENU
  22. if(get_key_pressed(46)) then
  23. if Taxi.taxiGUI.hidden == true then
  24. Taxi.taxiGUI.hidden = false
  25. else
  26. Taxi.taxiGUI.hidden = true
  27. end
  28. wait(200)
  29. end
  30. if(get_key_pressed(46)) then
  31. Taxi.taxiGUI.hidden = true
  32. end
  33. end
  34.  
  35. --SPAWN VEHICLES
  36. function spawnVehicle(modelString)
  37. local playerPed = PLAYER.PLAYER_PED_ID()
  38. local player = PLAYER.GET_PLAYER_PED(playerPed)
  39. local playerpos = ENTITY.GET_ENTITY_COORDS(player, true)
  40.  
  41. STREAMING.REQUEST_MODEL(modelString)
  42.  
  43.  
  44. while not STREAMING.HAS_MODEL_LOADED(modelString) do
  45. WAIT(0)
  46. end
  47. local lookDir = ENTITY.GET_ENTITY_HEADING(PLAYER.PLAYER_PED_ID())
  48. local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER.PLAYER_PED_ID(), 0.0, 5.0, 0.0)
  49. local veh = VEHICLE.CREATE_VEHICLE(modelString, coords.x, coords.y, coords.z, lookDir, 1, 0)
  50.  
  51. VEHICLE.SET_VEHICLE_ON_GROUND_PROPERLY(veh)
  52.  
  53. VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT(veh, "")
  54. VEHICLE.SET_VEHICLE_COLOURS(veh, 0, 0)
  55. VEHICLE.SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh, 0, 0, 0)
  56. VEHICLE.SET_VEHICLE_MOD_KIT(veh, 0)
  57. VEHICLE.SET_VEHICLE_WHEEL_TYPE(veh, 120)
  58. VEHICLE.SET_VEHICLE_WINDOW_TINT(veh, 1)
  59. VEHICLE.SET_VEHICLE_IS_STOLEN(veh, false)
  60. VEHICLE.SET_VEHICLE_IS_WANTED(veh, false)
  61. VEHICLE.SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER(veh, true)
  62. VEHICLE.SET_VEHICLE_NEEDS_TO_BE_HOTWIRED(veh, false)
  63. VEHICLE.SET_CAN_RESPRAY_VEHICLE(veh, true)
  64. VEHICLE.SET_VEHICLE_TYRES_CAN_BURST(veh, false)
  65. VEHICLE.SET_VEHICLE_WHEELS_CAN_BREAK(veh, false)
  66.  
  67. STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(modelString)
  68.  
  69. ENTITY.SET_VEHICLE_AS_NO_LONGER_NEEDED(veh)
  70. end
  71.  
  72. return Taxi
RAW Paste Data