Noneatme

Untitled

Mar 1st, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.37 KB | None | 0 0
  1. -- INDICATOR bei MULTI! --
  2. -- HOLY FUCK, DO NOT COPY! --
  3.  
  4. local blink = {}
  5. local blinkTimer = {}
  6. local bVar = {}
  7. local markerPositions = {}
  8. local bcVar = {}
  9.  
  10. markerPositions[411] = { {-1, 2.5, -0.2}, {-1, -2.3, 0}, {1, 2.5, -0.2}, {1, -2.3, 0} }
  11.  
  12. function reenableBlinker(thePlayer)
  13.    
  14.         if(bVar[thePlayer] == 0) then
  15.             bVar[thePlayer] = 1
  16.             for index, mark in pairs(blink[thePlayer]) do
  17.                 setElementAlpha(mark, 0)
  18.             end
  19.         else
  20.             bVar[thePlayer] = 0
  21.            
  22.             local r, g, b = 255, 255, 255
  23.             if(bcVar[thePlayer] == 0) then
  24.                 r, g, b = 0, 255, 255
  25.                 bcVar[thePlayer] = 1
  26.             elseif(bcVar[thePlayer] == 1) then
  27.                 r, g, b = 0, 255, 0
  28.                 bcVar[thePlayer] = 2
  29.             elseif(bcVar[thePlayer] == 2) then
  30.                 r, g, b = 0, 0, 255
  31.                 bcVar[thePlayer] = 3
  32.             elseif(bcVar[thePlayer] == 3) then
  33.                 r, g, b = 255, 150, 0
  34.                 bcVar[thePlayer] = 4
  35.             elseif(bcVar[thePlayer] == 4) then
  36.                 r, g, b = 255, 0, 0
  37.                 bcVar[thePlayer] = 5
  38.             elseif(bcVar[thePlayer] == 5) then
  39.                 r, g, b = 255, 255, 0
  40.                 bcVar[thePlayer] = 6
  41.             elseif(bcVar[thePlayer] == 6) then
  42.                 r, g, b = 50, 200, 255
  43.                 bcVar[thePlayer] = 7
  44.             elseif(bcVar[thePlayer] == 7) then
  45.                 r, g, b = 50, 50, 255
  46.                 bcVar[thePlayer] = 0
  47.             else
  48.                 r, g, b = 255, 255, 255
  49.             end
  50.            
  51.         for i = 1, 4, 1 do
  52.             setElementAlpha(blink[thePlayer][i], 255)
  53.             setMarkerColor(blink[thePlayer][i], r, g, b, 255)
  54.         end
  55.     end
  56. end
  57.  
  58. addEventHandler("onVehicleExplode", getRootElement(),
  59. function()
  60.         local data = getElementData(source, "v.stateowner")
  61.         if(data) then
  62.             if(getElementData(data, "b.state") == true) then
  63.                 killTimer(blinkTimer[data])
  64.                 for i = 1, 4, 1 do
  65.                     local mark = getElementData(source, "v.state"..i)
  66.                     destroyElement(mark)
  67.                 end
  68.                 bVar[data] = 0
  69.                 bcVar[data] = 0
  70.                 setElementData(data, "b.state", false)
  71.            
  72.         end
  73.     end
  74. end)
  75.  
  76. addEventHandler("onElementDestroy", getRootElement(),
  77. function()
  78.     if(getElementType(source) == "vehicle") then
  79.         local data = getElementData(source, "v.stateowner")
  80.         if(data) then
  81.             if(getElementData(data, "b.state") == true) then
  82.                 killTimer(blinkTimer[data])
  83.                 for i = 1, 4, 1 do
  84.                     local mark = getElementData(source, "v.state"..i)
  85.                     destroyElement(mark)
  86.                 end
  87.                 bVar[data] = 0
  88.                 bcVar[data] = 0
  89.                 setElementData(data, "b.state", false)
  90.             end
  91.         end
  92.     end
  93. end)
  94.  
  95. local persons = {
  96.     ["MuLTi"] = true,
  97.     ["[XP]Viperbrawl"] = true,
  98.     ["[XP]Sk_Styla"] = true,
  99.     ["#LarSo~"] = true,
  100.     ["[XP]InTrOBaSs"] = true,
  101.     ["[XP]xReket"] = true
  102. }
  103.  
  104. addCommandHandler("blink",
  105. function(thePlayer)
  106.     if(isPedInVehicle(thePlayer) == false) then return end
  107.     if(persons[getPlayerName(thePlayer)] == true) then else outputChatBox("Du bist nicht Befugt!", thePlayer, 200, 0, 0 false) return end
  108.     if(getElementData(thePlayer, "b.state") == true) then
  109.         setElementData(thePlayer, "b.state", false)
  110.         outputChatBox("Blinker Ausgeschaltet.", thePlayer, 0, 200, 0, false)
  111.         for i = 1, 4, 1 do
  112.             destroyElement(blink[thePlayer][i])
  113.         end
  114.         killTimer(blinkTimer[thePlayer])
  115.         bVar[thePlayer] = 0
  116.         bcVar[thePlayer] = 0
  117.     else
  118.         local veh = getPedOccupiedVehicle(thePlayer)
  119.         setElementData(thePlayer, "b.state", true)
  120.        
  121.         outputChatBox("Blinker Angeschaltet.", thePlayer, 0, 200, 0, false)
  122.         blink[thePlayer] = {}
  123.         blink[thePlayer][1] = createMarker(0, 0, 0, "corona", 0.3, 0 , 255, 255)
  124.         blink[thePlayer][2] = createMarker(0, 0, 0, "corona", 0.3, 0 , 255, 255)
  125.         blink[thePlayer][3] = createMarker(0, 0, 0, "corona", 0.3, 0 , 255, 255)
  126.         blink[thePlayer][4] = createMarker(0, 0, 0, "corona", 0.3, 0 , 255, 255)
  127.         for i = 1, 4, 1 do
  128.             setElementData(veh, "v.state"..i, blink[thePlayer][i])
  129.         end
  130.         setElementData(veh, "v.stateowner", thePlayer)
  131.         local model = getElementModel(veh)
  132.         attachElements(blink[thePlayer][1], veh, markerPositions[model][1][1], markerPositions[model][1][2], markerPositions[model][1][3])
  133.         attachElements(blink[thePlayer][2], veh, markerPositions[model][2][1], markerPositions[model][2][2], markerPositions[model][2][3])
  134.         attachElements(blink[thePlayer][3], veh, markerPositions[model][3][1], markerPositions[model][3][2], markerPositions[model][3][3])
  135.         attachElements(blink[thePlayer][4], veh, markerPositions[model][4][1], markerPositions[model][4][2], markerPositions[model][4][3])
  136.         bVar[thePlayer] = 0
  137.         bcVar[thePlayer] = 0
  138.         blinkTimer[thePlayer] = setTimer(reenableBlinker, 450, 0, thePlayer)
  139.     end
  140. end)
Advertisement
Add Comment
Please, Sign In to add comment