Guest User

Untitled

a guest
May 12th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. local carAlpha = 1
  2. local alphaMultiplikator = 3.55
  3.  
  4. addEventHandler("onClientRender", root, function()
  5.     if(carAlpha == 0) then return end
  6.     local myVeh = getPedOccupiedVehicle(me)
  7.     if not(myVeh) then return end
  8.     local mx, my, mz = getElementPosition(myVeh)
  9.     for i,fahrzeug in ipairs (getElementsByType("vehicle")) do
  10.         local f1, f2, f3 = getElementPosition(fahrzeug)
  11.         local distanz = getDistanceBetweenPoints3D (mx, my, mz, f1, f2, f3 )
  12.         if (distanz < 50) then
  13.             setElementAlpha(fahrzeug, distanz*alphaMultiplikator+20)
  14.         else   
  15.             setElementAlpha(fahrzeug, 255)
  16.         end
  17.         if(fahrzeug == getPedOccupiedVehicle(me)) then
  18.             setElementAlpha(fahrzeug, 255)         
  19.         end
  20.     end
  21. end)
  22.  
  23. bindKey("F6", "down", function()
  24.     if(carAlpha == 1) then
  25.         carAlpha = 0
  26.         outputChatBox("#FFFFFF|INFO| #00FF00Car-Alpha wurde ausgeschaltet.", 255, 255, 255, true)
  27.     for i,fahrzeug in ipairs (getElementsByType("vehicle")) do
  28.         setElementAlpha(fahrzeug, 255)
  29.     end
  30.     else
  31.         carAlpha = 1
  32.         outputChatBox("#FFFFFF|INFO| #00FF00Car-Alpha wurde angeschaltet.", 255, 255, 255, true)
  33.     end
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment