View difference between Paste ID: VkP9mDin and UqKuHWYL
SHOW: | | - or go back to the newest paste.
1
-- Car Alpha bei MuLTi! --
2
local carAlpha = 1
3
local alphaMultiplikator = 3.55
4
5
addEventHandler("onClientRender", root, function()
6
	if(carAlpha == 0) then return end
7
	local myVeh = getPedOccupiedVehicle(me)
8
	if not(myVeh) then return end
9
	local mx, my, mz = getElementPosition(myVeh)
10
	for i,fahrzeug in ipairs (getElementsByType("vehicle")) do
11
		local f1, f2, f3 = getElementPosition(fahrzeug)
12
		local distanz = getDistanceBetweenPoints3D (mx, my, mz, f1, f2, f3 )
13
		if (distanz < 50) then
14
			setElementAlpha(fahrzeug, distanz*alphaMultiplikator+20)
15
		else	
16
			setElementAlpha(fahrzeug, 255)
17
		end
18
		if(fahrzeug == getPedOccupiedVehicle(me)) then 
19
			setElementAlpha(fahrzeug, 255)			
20
		end
21
	end
22
end)
23
24
bindKey("F6", "down", function()
25
	if(carAlpha == 1) then
26
		carAlpha = 0
27
		outputChatBox("#FFFFFF|INFO| #00FF00Car-Alpha wurde ausgeschaltet.", 255, 255, 255, true)
28
	for i,fahrzeug in ipairs (getElementsByType("vehicle")) do 
29
		setElementAlpha(fahrzeug, 255) 
30
	end
31
	else
32
		carAlpha = 1
33
		outputChatBox("#FFFFFF|INFO| #00FF00Car-Alpha wurde angeschaltet.", 255, 255, 255, true)
34
	end
35
end)