PaperDimentio

IV Style Exit Vehicle

Jun 10th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.44 KB | None | 0 0
  1. -- Alternate Exit Vehicle Script
  2. -- by the Driver
  3. -- Created for PapiDimmi and re-uploaded for OlympiaNGOD3
  4.  
  5. key = {}
  6.  
  7. key.ctrl = 17 -- "Control" modifier used with the keys below (eg. Ctrl+A for left turn signal)
  8. key.defaultkey = 70 -- "F"
  9. key.exitoffkey = 71 -- "G"
  10.  
  11. -- KEY CODES:
  12. ------------------------------------
  13. -- Keys.None = 0
  14. -- Keys.LButton = 1
  15. -- Keys.RButton = 2
  16. -- Keys.Cancel = 3
  17. -- Keys.MButton = 4
  18. -- Keys.XButton1 = 5
  19. -- Keys.XButton2 = 6
  20. -- Keys.Back = 8
  21. -- Keys.Tab = 9
  22. -- Keys.LineFeed = 10
  23. -- Keys.Clear = 12
  24. -- Keys.Return = 13
  25. -- Keys.ShiftKey = 16
  26. -- Keys.ControlKey = 17
  27. -- Keys.Menu = 18
  28. -- Keys.Pause = 19
  29. -- Keys.Capital = 20
  30. -- Keys.KanaMode = 21
  31. -- Keys.JunjaMode = 23
  32. -- Keys.FinalMode = 24
  33. -- Keys.HanjaMode = 25
  34. -- Keys.Escape = 27
  35. -- Keys.IMEConvert = 28
  36. -- Keys.IMENonconvert = 29
  37. -- Keys.IMEAceept = 30
  38. -- Keys.IMEModeChange = 31
  39. -- Keys.Space = 32
  40. -- Keys.PageUp = 33
  41. -- Keys.Next = 34
  42. -- Keys.End = 35
  43. -- Keys.Home = 36
  44. -- Keys.Left = 37
  45. -- Keys.Up = 38
  46. -- Keys.Right = 39
  47. -- Keys.Down = 40
  48. -- Keys.Select = 41
  49. -- Keys.Print = 42
  50. -- Keys.Execute = 43
  51. -- Keys.PrintScreen = 44
  52. -- Keys.Insert = 45
  53. -- Keys.Delete = 46
  54. -- Keys.Help = 47
  55. -- Keys.D0 = 48
  56. -- Keys.D1 = 49
  57. -- Keys.D2 = 50
  58. -- Keys.D3 = 51
  59. -- Keys.D4 = 52
  60. -- Keys.D5 = 53
  61. -- Keys.D6 = 54
  62. -- Keys.D7 = 55
  63. -- Keys.D8 = 56
  64. -- Keys.D9 = 57
  65. -- Keys.A = 65
  66. -- Keys.B = 66
  67. -- Keys.C = 67
  68. -- Keys.D = 68
  69. -- Keys.E = 69
  70. -- Keys.F = 70
  71. -- Keys.G = 71
  72. -- Keys.H = 72
  73. -- Keys.I = 73
  74. -- Keys.J = 74
  75. -- Keys.K = 75
  76. -- Keys.L = 76
  77. -- Keys.M = 77
  78. -- Keys.N = 78
  79. -- Keys.O = 79
  80. -- Keys.P = 80
  81. -- Keys.Q = 81
  82. -- Keys.R = 82
  83. -- Keys.S = 83
  84. -- Keys.T = 84
  85. -- Keys.U = 85
  86. -- Keys.V = 86
  87. -- Keys.W = 87
  88. -- Keys.X = 88
  89. -- Keys.Y = 89
  90. -- Keys.Z = 90
  91. -- Keys.LWin = 91
  92. -- Keys.RWin = 92
  93. -- Keys.Apps = 93
  94. -- Keys.Sleep = 95
  95. -- Keys.NumPad0 = 96
  96. -- Keys.NumPad1 = 97
  97. -- Keys.NumPad2 = 98
  98. -- Keys.NumPad3 = 99
  99. -- Keys.NumPad4 = 100
  100. -- Keys.NumPad5 = 101
  101. -- Keys.NumPad6 = 102
  102. -- Keys.NumPad7 = 103
  103. -- Keys.NumPad8 = 104
  104. -- Keys.NumPad9 = 105
  105. -- Keys.Multiply = 106
  106. -- Keys.Add = 107
  107. -- Keys.Separator = 108
  108. -- Keys.Subtract = 109
  109. -- Keys.Decimal = 110
  110. -- Keys.Divide = 111
  111. -- Keys.F1 = 112
  112. -- Keys.F2 = 113
  113. -- Keys.F3 = 114
  114. -- Keys.F4 = 115
  115. -- Keys.F5 = 116
  116. -- Keys.F6 = 117
  117. -- Keys.F7 = 118
  118. -- Keys.F8 = 119
  119. -- Keys.F9 = 120
  120. -- Keys.F10 = 121
  121. -- Keys.F11 = 122
  122. -- Keys.F12 = 123
  123. -- Keys.F13 = 124
  124. -- Keys.F14 = 125
  125. -- Keys.F15 = 126
  126. -- Keys.F16 = 127
  127. -- Keys.F17 = 128
  128. -- Keys.F18 = 129
  129. -- Keys.F19 = 130
  130. -- Keys.F20 = 131
  131. -- Keys.F21 = 132
  132. -- Keys.F22 = 133
  133. -- Keys.F23 = 134
  134. -- Keys.F24 = 135
  135. -- Keys.NumLock = 144
  136. -- Keys.Scroll = 145
  137. -- Keys.LShiftKey = 160
  138. -- Keys.RShiftKey = 161
  139. -- Keys.LControlKey = 162
  140. -- Keys.RControlKey = 163
  141. -- Keys.LMenu = 164
  142. -- Keys.RMenu = 165
  143. -- Keys.BrowserBack = 166
  144. -- Keys.BrowserForward = 167
  145. -- Keys.BrowserRefresh = 168
  146. -- Keys.BrowserStop = 169
  147. -- Keys.BrowserSearch = 170
  148. -- Keys.BrowserFavorites = 171
  149. -- Keys.BrowserHome = 172
  150. -- Keys.VolumeMute = 173
  151. -- Keys.VolumeDown = 174
  152. -- Keys.VolumeUp = 175
  153. -- Keys.MediaNextTrack = 176
  154. -- Keys.MediaPreviousTrack = 177
  155. -- Keys.MediaStop = 178
  156. -- Keys.MediaPlayPause = 179
  157. -- Keys.LaunchMail = 180
  158. -- Keys.SelectMedia = 181
  159. -- Keys.LaunchApplication1 = 182
  160. -- Keys.LaunchApplication2 = 183
  161. -- Keys.Oem1 = 186
  162. -- Keys.Oemplus = 187
  163. -- Keys.Oemcomma = 188
  164. -- Keys.OemMinus = 189
  165. -- Keys.OemPeriod = 190
  166. -- Keys.OemQuestion = 191
  167. -- Keys.Oemtilde = 192
  168. -- Keys.OemOpenBrackets = 219
  169. -- Keys.Oem5 = 220
  170. -- Keys.Oem6 = 221
  171. -- Keys.Oem7 = 222
  172. -- Keys.Oem8 = 223
  173. -- Keys.OemBackslash = 226
  174. -- Keys.ProcessKey = 229
  175. -- Keys.Packet = 231
  176. -- Keys.Attn = 246
  177. -- Keys.Crsel = 247
  178. -- Keys.Exsel = 248
  179. -- Keys.EraseEof = 249
  180. -- Keys.Play = 250
  181. -- Keys.Zoom = 251
  182. -- Keys.NoName = 252
  183. -- Keys.Pa1 = 253
  184. -- Keys.OemClear = 254
  185. -- Keys.KeyCode = 65535
  186. -- Keys.Shift = 65536
  187. -- Keys.Control = 131072
  188. -- Keys.Alt = 262144
  189. -- Keys.Modifiers = -65536
  190. ------------------------------------
  191.  
  192. local lve = {}
  193.  
  194. local tickt = 0
  195. local loop = false
  196.  
  197. function lve.tick()
  198. playerPed = PLAYER.PLAYER_PED_ID()
  199. player = PLAYER.GET_PLAYER_PED(playerPed)
  200. playerVehicle = PED.GET_VEHICLE_PED_IS_USING(playerPed)
  201. isPlayerDriving = (VEHICLE.GET_PED_IN_VEHICLE_SEAT(playerVehicle, -1) == playerPed)
  202.  
  203.  
  204.  
  205. if (loop and tickt < 500) then
  206. if (isPlayerDriving) then
  207. lve.leaveVehicle()
  208. end
  209. tickt = tickt + 1
  210. return 0
  211. else
  212. loop = false
  213. tickt = 0
  214. end
  215.  
  216. -- "F" to leave vehicle with engine on, "CTRL" + "F" to leave with engine off
  217. if(get_key_pressed(key.ctrl)) then
  218. if (CONTROLS.IS_CONTROL_PRESSED(2,75) and isPlayerDriving) then
  219. lve.leaveVehicleEngineOff()
  220. end
  221. elseif (get_key_pressed(key.exitoffkey) and isPlayerDriving) then
  222. AI.TASK_LEAVE_VEHICLE(playerPed, playerVehicle, 8)
  223. lve.leaveVehicleEngineOff()
  224. elseif ((CONTROLS.IS_CONTROL_PRESSED(2,75) or get_key_pressed(key.defaultkey)) and isPlayerDriving) then
  225. loop = true
  226. return 0
  227. end
  228. end
  229.  
  230. function lve.leaveVehicle()
  231. VEHICLE.SET_VEHICLE_ENGINE_ON(playerVehicle, true, true)
  232. end
  233.  
  234. function lve.leaveVehicleEngineOff()
  235. VEHICLE.SET_VEHICLE_ENGINE_ON(playerVehicle, false, true)
  236. end
  237.  
  238. function lve.init()
  239. end
  240.  
  241. function lve.unload()
  242. end
  243.  
  244. return lve
Advertisement
Add Comment
Please, Sign In to add comment