Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --#######################
- --### Car lights test ###
- --### � 2008 LouNGeR ###
- --#######################
- KEY = {}
- KEY["TAB"] = 9
- KEY["0"] = 48
- KEY["1"] = 49
- KEY["2"] = 50
- KEY["3"] = 51
- KEY["4"] = 52
- KEY["5"] = 53
- KEY["6"] = 54
- KEY["7"] = 55
- KEY["8"] = 56
- KEY["9"] = 57
- --PLAYER_ID, PLAYER_INDEX, PLAYER_CHAR, PLAYER_CAR, IN_CAR = 0
- function Init()
- Wait(4000)
- end
- function WaitForPlayerPoolCreation()
- while IsPlayerPoolCreated() == 0 do
- Wait(2000)
- end
- end
- function WaitForValidPlayer()
- PLAYER_CHAR = 0
- repeat
- CallNative("GET_PLAYER_ID")
- PLAYER_ID = GetIntResult()
- if (PLAYER_ID >= 0) then
- PushInt(PLAYER_ID)
- CallNative("CONVERT_INT_TO_PLAYERINDEX")
- PLAYER_INDEX = GetIntResult()
- PushInt(PLAYER_INDEX)
- PushVarPtr()
- CallNative("GET_PLAYER_CHAR")
- PLAYER_CHAR = GetIntParam(1)
- if (PLAYER_CHAR <= 0) then Wait(1000) end
- end
- until (PLAYER_CHAR > 0)
- end
- -- Borrowed from Prince-Link
- -- http://www.gtaforums.com/index.php?showtopic=386908&view=findpost&p=1058802175
- -- http://insomnia247.nl/~shadowlink/car.lua
- function getPlayerCar()
- PLAYER_CAR = 0
- IN_CAR = 0
- repeat
- PushInt(PLAYER_CHAR)
- CallNative("IS_CHAR_IN_ANY_CAR")
- IN_CAR = GetIntResult()
- if(IN_CAR > 0) then
- PushInt(PLAYER_CHAR)
- PushVarPtr()
- CallNative("GET_CAR_CHAR_IS_USING")
- PLAYER_CAR = GetIntParam(1)
- end
- if (PLAYER_CAR <= 0) then
- Wait(1000)
- end
- until (PLAYER_CAR > 0)
- end
- function Main()
- Init()
- while true do
- WaitForPlayerPoolCreation()
- WaitForValidPlayer()
- getPlayerCar()
- if IsKeyPressed(KEY["TAB"]) == 1 then
- if IsKeyPressed(KEY["1"]) == 1 then
- PushInt(PLAYER_CAR)
- PushInt(0)
- CallNative("SET_VEH_HAZARDLIGHTS")
- end
- if IsKeyPressed(KEY["2"]) == 1 then
- PushInt(PLAYER_CAR)
- PushInt(1)
- CallNative("SET_VEH_HAZARDLIGHTS")
- end
- end
- Wait(300)
- end
- end
- Main();
Advertisement
Add Comment
Please, Sign In to add comment