Wysłany: 2020-03-27, 17:42
smigi
Wiek: 23 Na forum: 3367 dni Posty: 60
Nick w MP: smigi
Piwa : 2
Witam potrzebuje do tego kodu doda? ?eby interakcja po wyjsciu z pojazdu sie automatycznie wylaczala gdy? si? buguje
kod:
Cytat: --[[
@author: nanKy ([email protected] )
@resource: interaction
@copyright: u?ywaj ile chcesz, je?eli szanujesz moj? prac? to nie usuwaj notki o autorze.
]]
local dxfont0_cz = dxCreateFont("cz.ttf", 19)
local screenW, screenH = guiGetScreenSize()
ww,hh = 1920, 1080
www,hhh = guiGetScreenSize()
w, h = (www/ww), (hhh/hh)
function isMouseIn(psx,psy,pssx,pssy,abx,aby)
local sx, sy = guiGetScreenSize()
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
shift = false
function interakcja()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleEngineState(veh) == false then silnik = "Odpal silnik" else silnik = "Zga? silnik" end
if isElementFrozen(veh) then reczny = "Spu?? r?czny" else reczny = "Zaci?gnij r?czny" end
if getVehicleOverrideLights(veh) == 2 then swiatla = "Zga? ?wiat?a" else swiatla = "Zapal ?wiat?a" end
if isVehicleLocked(veh) then zamek = "Otw?rz zamek" else zamek = "Zamknij zamek" end
dxDrawImage(screenW * 0.3635, screenH * 0.1519, screenW * 0.2734, screenH * 0.6963, ":sr-interakcja/interakcja.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false)
if isMouseIn(screenW * 0.4510, screenH * 0.2185, screenW * 0.1505, screenH * 0.0824) then dxDrawImage(screenW * 0.4385, screenH * 0.2065, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonon.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) else dxDrawImage(screenW * 0.4385, screenH * 0.2065, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonoff.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) end
if isMouseIn(screenW * 0.4510, screenH * 0.3389, screenW * 0.1505, screenH * 0.0824) then dxDrawImage(screenW * 0.4385, screenH * 0.3296, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonon.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) else dxDrawImage(screenW * 0.4385, screenH * 0.3296, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonoff.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) end
if isMouseIn(screenW * 0.4510, screenH * 0.4639, screenW * 0.1505, screenH * 0.0824) then dxDrawImage(screenW * 0.4385, screenH * 0.4546, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonon.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) else dxDrawImage(screenW * 0.4385, screenH * 0.4546, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonoff.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) end
if isMouseIn(screenW * 0.4510, screenH * 0.5843, screenW * 0.1505, screenH * 0.0824) then dxDrawImage(screenW * 0.4385, screenH * 0.5750, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonon.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) else dxDrawImage(screenW * 0.4385, screenH * 0.5750, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonoff.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) end
if isMouseIn(screenW * 0.4510, screenH * 0.7074, screenW * 0.1505, screenH * 0.0824) then dxDrawImage(screenW * 0.4385, screenH * 0.6963, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonon.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) else dxDrawImage(screenW * 0.4385, screenH * 0.6963, screenW * 0.1719, screenH * 0.1037, ":sr-interakcja/buttonoff.png", 0*w, 0*w, 0*w, tocolor(255, 255, 255, 255), false) end
dxDrawText(silnik, (screenW * 0.4391) + 1, (screenH * 0.2074) + 1, (screenW * 0.6104) + 1, (screenH * 0.3102) + 1, tocolor(0, 0, 0, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(silnik, screenW * 0.4391, screenH * 0.2074, screenW * 0.6104, screenH * 0.3102, tocolor(255, 255, 255, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(reczny, (screenW * 0.4391) + 1, (screenH * 0.3296) + 1, (screenW * 0.6104) + 1, (screenH * 0.4324) + 1, tocolor(0, 0, 0, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(reczny, screenW * 0.4391, screenH * 0.3296, screenW * 0.6104, screenH * 0.4324, tocolor(255, 255, 255, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(swiatla, (screenW * 0.4385) + 1, (screenH * 0.4546) + 1, (screenW * 0.6099) + 1, (screenH * 0.5574) + 1, tocolor(0, 0, 0, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(swiatla, screenW * 0.4385, screenH * 0.4546, screenW * 0.6099, screenH * 0.5574, tocolor(255, 255, 255, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText("Wysad? pasa?er?w", (screenW * 0.4385) + 1, (screenH * 0.5750) + 1, (screenW * 0.6099) + 1, (screenH * 0.6778) + 1, tocolor(0, 0, 0, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText("Wysad? pasa?er?w", screenW * 0.4385, screenH * 0.5750, screenW * 0.6099, screenH * 0.6778, tocolor(255, 255, 255, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(zamek, (screenW * 0.4385) + 1, (screenH * 0.6963) + 1, (screenW * 0.6099) + 1, (screenH * 0.7991) + 1, tocolor(0, 0, 0, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
dxDrawText(zamek, screenW * 0.4385, screenH * 0.6963, screenW * 0.6099, screenH * 0.7991, tocolor(255, 255, 255, 255), 1*w, dxfont0_cz, "center", "center", false, false, false, false, false)
end
addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
local veh = getPedOccupiedVehicle(localPlayer)
if shift == true and getVehicleController(veh) == localPlayer and veh then
if isMouseIn(screenW * 0.4510, screenH * 0.2185, screenW * 0.1505, screenH * 0.0824) then
triggerServerEvent("engine", localPlayer)
elseif isMouseIn(screenW * 0.4510, screenH * 0.3389, screenW * 0.1505, screenH * 0.0824) then
triggerServerEvent("brake", localPlayer)
elseif isMouseIn(screenW * 0.4510, screenH * 0.4639, screenW * 0.1505, screenH * 0.0824) then
triggerServerEvent("lights", localPlayer)
elseif isMouseIn(screenW * 0.4510, screenH * 0.5843, screenW * 0.1505, screenH * 0.0824) then
triggerServerEvent("exit", localPlayer)
elseif isMouseIn(screenW * 0.4510, screenH * 0.7074, screenW * 0.1505, screenH * 0.0824) then
triggerServerEvent("doors", localPlayer)
end
end
end
end)
bindKey("lshift","down",function()
local veh = getPedOccupiedVehicle(localPlayer)
if veh then
if getVehicleController(veh) == localPlayer then
if shift == false then
addEventHandler ("onClientRender", root, interakcja)
showCursor(true)
shift = true
else
removeEventHandler ("onClientRender", root, interakcja)
shift = false
showCursor (false)
end
end
end
end)
Wysłany: 2020-03-27, 18:07
NotPaladyn
Wiek: 23 Na forum: 2790 dni Posty: 866
Nick w MP: NotPaladyn
Piwa : 3135
Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną .
Spr?buj tak:
--[[
@ author : nanKy ( eryk1337 . official @ gmail . com )
@ resource : interaction
@ copyright : u ? ywaj ile chcesz , je ? eli szanujesz moj ? prac ? to nie usuwaj notki o autorze .
]]
local dxfont0_cz = dxCreateFont ( "cz.ttf" , 19 )
local screenW , screenH = guiGetScreenSize ()
ww , hh = 1920 , 1080
www , hhh = guiGetScreenSize ()
w , h = ( www / ww ), ( hhh / hh )
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
local sx , sy = guiGetScreenSize ()
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if type ( sEventName ) == 'string' and isElement ( pElementAttachedTo ) and type ( func ) == 'function' then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i , v in ipairs ( aAttachedFunctions ) do
if v == func then
return true
end
end
end
end
return false
end
shift = false
function interakcja ()
local veh = getPedOccupiedVehicle ( localPlayer )
if getVehicleEngineState ( veh ) == false then silnik = "Odpal silnik" else silnik = "Zga? silnik" end
if isElementFrozen ( veh ) then reczny = "Spu?? r?czny" else reczny = "Zaci?gnij r?czny" end
if getVehicleOverrideLights ( veh ) == 2 then swiatla = "Zga? ?wiat?a" else swiatla = "Zapal ?wiat?a" end
if isVehicleLocked ( veh ) then zamek = "Otw?rz zamek" else zamek = "Zamknij zamek" end
dxDrawImage ( screenW * 0.3635 , screenH * 0.1519 , screenW * 0.2734 , screenH * 0.6963 , ":sr-interakcja/interakcja.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false )
if isMouseIn ( screenW * 0.4510 , screenH * 0.2185 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.2065 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.2065 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.3389 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.3296 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.3296 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.4639 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.4546 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.4546 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.5843 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.5750 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.5750 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.7074 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.6963 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.6963 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
dxDrawText ( silnik , ( screenW * 0.4391 ) + 1 , ( screenH * 0.2074 ) + 1 , ( screenW * 0.6104 ) + 1 , ( screenH * 0.3102 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( silnik , screenW * 0.4391 , screenH * 0.2074 , screenW * 0.6104 , screenH * 0.3102 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( reczny , ( screenW * 0.4391 ) + 1 , ( screenH * 0.3296 ) + 1 , ( screenW * 0.6104 ) + 1 , ( screenH * 0.4324 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( reczny , screenW * 0.4391 , screenH * 0.3296 , screenW * 0.6104 , screenH * 0.4324 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( swiatla , ( screenW * 0.4385 ) + 1 , ( screenH * 0.4546 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.5574 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( swiatla , screenW * 0.4385 , screenH * 0.4546 , screenW * 0.6099 , screenH * 0.5574 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Wysad? pasa?er?w" , ( screenW * 0.4385 ) + 1 , ( screenH * 0.5750 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.6778 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Wysad? pasa?er?w" , screenW * 0.4385 , screenH * 0.5750 , screenW * 0.6099 , screenH * 0.6778 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( zamek , ( screenW * 0.4385 ) + 1 , ( screenH * 0.6963 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.7991 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( zamek , screenW * 0.4385 , screenH * 0.6963 , screenW * 0.6099 , screenH * 0.7991 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
local veh = getPedOccupiedVehicle ( localPlayer )
if shift == true and getVehicleController ( veh ) == localPlayer and veh then
if isMouseIn ( screenW * 0.4510 , screenH * 0.2185 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "engine" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.3389 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "brake" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.4639 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "lights" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.5843 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "exit" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.7074 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "doors" , localPlayer )
end
end
end
end )
bindKey ( "lshift" , "down" ,function()
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
if getVehicleController ( veh ) == localPlayer then
if shift == false then
addEventHandler ( "onClientRender" , root , interakcja )
showCursor ( true )
shift = true
else
removeEventHandler ( "onClientRender" , root , interakcja )
shift = false
showCursor ( false )
end
end
end
end )
function closeinteraction ()
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
if getVehicleController ( veh ) == localPlayer then
if isEventHandlerAdded ( "onClientRender" , root , interakcja ) then
removeEventHandler ( "onClientRender" , root , interakcja )
end
end
end
end
addEventHandler ( "onClientVehicleExit" , getRootElement (), closeinteraction )
Wysłany: 2020-03-27, 18:46
smigi
Wiek: 23 Na forum: 3367 dni Posty: 60
Nick w MP: smigi
Piwa : 2
"NotPaladyn" napisał/a :Spr?buj tak:
--[[
@ author : nanKy ( eryk1337 . official @ gmail . com )
@ resource : interaction
@ copyright : u ? ywaj ile chcesz , je ? eli szanujesz moj ? prac ? to nie usuwaj notki o autorze .
]]
local dxfont0_cz = dxCreateFont ( "cz.ttf" , 19 )
local screenW , screenH = guiGetScreenSize ()
ww , hh = 1920 , 1080
www , hhh = guiGetScreenSize ()
w , h = ( www / ww ), ( hhh / hh )
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
local sx , sy = guiGetScreenSize ()
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if type ( sEventName ) == 'string' and isElement ( pElementAttachedTo ) and type ( func ) == 'function' then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
for i , v in ipairs ( aAttachedFunctions ) do
if v == func then
return true
end
end
end
end
return false
end
shift = false
function interakcja ()
local veh = getPedOccupiedVehicle ( localPlayer )
if getVehicleEngineState ( veh ) == false then silnik = "Odpal silnik" else silnik = "Zga? silnik" end
if isElementFrozen ( veh ) then reczny = "Spu?? r?czny" else reczny = "Zaci?gnij r?czny" end
if getVehicleOverrideLights ( veh ) == 2 then swiatla = "Zga? ?wiat?a" else swiatla = "Zapal ?wiat?a" end
if isVehicleLocked ( veh ) then zamek = "Otw?rz zamek" else zamek = "Zamknij zamek" end
dxDrawImage ( screenW * 0.3635 , screenH * 0.1519 , screenW * 0.2734 , screenH * 0.6963 , ":sr-interakcja/interakcja.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false )
if isMouseIn ( screenW * 0.4510 , screenH * 0.2185 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.2065 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.2065 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.3389 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.3296 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.3296 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.4639 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.4546 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.4546 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.5843 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.5750 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.5750 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.7074 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.6963 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.6963 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
dxDrawText ( silnik , ( screenW * 0.4391 ) + 1 , ( screenH * 0.2074 ) + 1 , ( screenW * 0.6104 ) + 1 , ( screenH * 0.3102 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( silnik , screenW * 0.4391 , screenH * 0.2074 , screenW * 0.6104 , screenH * 0.3102 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( reczny , ( screenW * 0.4391 ) + 1 , ( screenH * 0.3296 ) + 1 , ( screenW * 0.6104 ) + 1 , ( screenH * 0.4324 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( reczny , screenW * 0.4391 , screenH * 0.3296 , screenW * 0.6104 , screenH * 0.4324 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( swiatla , ( screenW * 0.4385 ) + 1 , ( screenH * 0.4546 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.5574 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( swiatla , screenW * 0.4385 , screenH * 0.4546 , screenW * 0.6099 , screenH * 0.5574 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Wysad? pasa?er?w" , ( screenW * 0.4385 ) + 1 , ( screenH * 0.5750 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.6778 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Wysad? pasa?er?w" , screenW * 0.4385 , screenH * 0.5750 , screenW * 0.6099 , screenH * 0.6778 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( zamek , ( screenW * 0.4385 ) + 1 , ( screenH * 0.6963 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.7991 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( zamek , screenW * 0.4385 , screenH * 0.6963 , screenW * 0.6099 , screenH * 0.7991 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
local veh = getPedOccupiedVehicle ( localPlayer )
if shift == true and getVehicleController ( veh ) == localPlayer and veh then
if isMouseIn ( screenW * 0.4510 , screenH * 0.2185 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "engine" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.3389 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "brake" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.4639 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "lights" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.5843 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "exit" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.7074 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "doors" , localPlayer )
end
end
end
end )
bindKey ( "lshift" , "down" ,function()
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
if getVehicleController ( veh ) == localPlayer then
if shift == false then
addEventHandler ( "onClientRender" , root , interakcja )
showCursor ( true )
shift = true
else
removeEventHandler ( "onClientRender" , root , interakcja )
shift = false
showCursor ( false )
end
end
end
end )
function closeinteraction ()
local veh = getPedOccupiedVehicle ( localPlayer )
if veh then
if getVehicleController ( veh ) == localPlayer then
if isEventHandlerAdded ( "onClientRender" , root , interakcja ) then
removeEventHandler ( "onClientRender" , root , interakcja )
end
end
end
end
addEventHandler ( "onClientVehicleExit" , getRootElement (), closeinteraction )
nadal nie dziala
[ Dodano : 2020-03-27, 18:48 ]
teraz jest tak ze jesli chcesz wlaczyc musisz kliknac a jesli chcesz wylaczyc tez musisz kliknac shift dalbys rade to tak zedytowac zeby sie automatycznie wylaczalo?
Wysłany: 2020-03-28, 03:49
Hades.
Łiiiiiiiiii
Wiek: 22 Na forum: 4699 dni Posty: 372
Nick w MP: Hades
Piwa : 3214
--[[
@ author : nanKy ( eryk1337 . official @ gmail . com )
@ resource : interaction
@ copyright : u ? ywaj ile chcesz , je ? eli szanujesz moj ? prac ? to nie usuwaj notki o autorze .
]]
local dxfont0_cz = dxCreateFont ( "cz.ttf" , 19 )
local screenW , screenH = guiGetScreenSize ()
ww , hh = 1920 , 1080
www , hhh = guiGetScreenSize ()
w , h = ( www / ww ), ( hhh / hh )
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
local sx , sy = guiGetScreenSize ()
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
shift = false
function interakcja ()
local veh = getPedOccupiedVehicle ( localPlayer )
if getVehicleEngineState ( veh ) == false then silnik = "Odpal silnik" else silnik = "Zga? silnik" end
if isElementFrozen ( veh ) then reczny = "Spu?? r?czny" else reczny = "Zaci?gnij r?czny" end
if getVehicleOverrideLights ( veh ) == 2 then swiatla = "Zga? ?wiat?a" else swiatla = "Zapal ?wiat?a" end
if isVehicleLocked ( veh ) then zamek = "Otw?rz zamek" else zamek = "Zamknij zamek" end
dxDrawImage ( screenW * 0.3635 , screenH * 0.1519 , screenW * 0.2734 , screenH * 0.6963 , ":sr-interakcja/interakcja.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false )
if isMouseIn ( screenW * 0.4510 , screenH * 0.2185 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.2065 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.2065 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.3389 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.3296 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.3296 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.4639 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.4546 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.4546 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.5843 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.5750 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.5750 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
if isMouseIn ( screenW * 0.4510 , screenH * 0.7074 , screenW * 0.1505 , screenH * 0.0824 ) then dxDrawImage ( screenW * 0.4385 , screenH * 0.6963 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonon.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) else dxDrawImage ( screenW * 0.4385 , screenH * 0.6963 , screenW * 0.1719 , screenH * 0.1037 , ":sr-interakcja/buttonoff.png" , 0 * w , 0 * w , 0 * w , tocolor ( 255 , 255 , 255 , 255 ), false ) end
dxDrawText ( silnik , ( screenW * 0.4391 ) + 1 , ( screenH * 0.2074 ) + 1 , ( screenW * 0.6104 ) + 1 , ( screenH * 0.3102 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( silnik , screenW * 0.4391 , screenH * 0.2074 , screenW * 0.6104 , screenH * 0.3102 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( reczny , ( screenW * 0.4391 ) + 1 , ( screenH * 0.3296 ) + 1 , ( screenW * 0.6104 ) + 1 , ( screenH * 0.4324 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( reczny , screenW * 0.4391 , screenH * 0.3296 , screenW * 0.6104 , screenH * 0.4324 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( swiatla , ( screenW * 0.4385 ) + 1 , ( screenH * 0.4546 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.5574 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( swiatla , screenW * 0.4385 , screenH * 0.4546 , screenW * 0.6099 , screenH * 0.5574 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Wysad? pasa?er?w" , ( screenW * 0.4385 ) + 1 , ( screenH * 0.5750 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.6778 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Wysad? pasa?er?w" , screenW * 0.4385 , screenH * 0.5750 , screenW * 0.6099 , screenH * 0.6778 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( zamek , ( screenW * 0.4385 ) + 1 , ( screenH * 0.6963 ) + 1 , ( screenW * 0.6099 ) + 1 , ( screenH * 0.7991 ) + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
dxDrawText ( zamek , screenW * 0.4385 , screenH * 0.6963 , screenW * 0.6099 , screenH * 0.7991 , tocolor ( 255 , 255 , 255 , 255 ), 1 * w , dxfont0_cz , "center" , "center" , false , false , false , false , false )
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
local veh = getPedOccupiedVehicle ( localPlayer )
if shift == true and getVehicleController ( veh ) == localPlayer and veh then
if isMouseIn ( screenW * 0.4510 , screenH * 0.2185 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "engine" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.3389 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "brake" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.4639 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "lights" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.5843 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "exit" , localPlayer )
elseif isMouseIn ( screenW * 0.4510 , screenH * 0.7074 , screenW * 0.1505 , screenH * 0.0824 ) then
triggerServerEvent ( "doors" , localPlayer )
end
end
end
end )
showInteract = function( bool )
if bool and not shift then
addEventHandler ( 'onClientRender' , root , interakcja );
showCursor ( true );
shift = true ;
else
removeEventHandler ( 'onClientRender' , root , interakcja );
showCursor ( false );
shift = false ;
end
end
addEventHandler ( 'onClientVehicleEnter' , root , function( player , seat )
if player == localPlayer and seat == 0 then
bindKey ( 'lshift' , 'both' , function( key , state )
if getPedOccupiedVehicle ( localPlayer ) then
if state == 'down' then
showInteract ( true );
elseif state == 'up' then
showInteract ( false );
end
end
end );
end
end );
addEventHandler ( 'onClientVehicleStartExit' , root , function( player , seat )
if player == localPlayer and sea == 0 then
if shift then
showIntearct ( false );
end
end
end );
Licz? na lub
Tagi: interakcja :: wyjsciu :: auta :: zeby :: sie :: automatycznie :: wylaczal
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: