Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-03-27, 17:42


smigi







Wiek: 23
Na forum: 3367 dni
Posty: 60
Nick w MP: smigi

Piwa: 2

Respekt: 50

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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-27, 18:07


NotPaladyn







Wiek: 23
Na forum: 2790 dni
Posty: 866
Nick w MP: NotPaladyn

Piwa: 3135

Respekt: 690
Respekt: 690Respekt: 690


   Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną.
Spr?buj tak:

--[[ 
@authornanKy (eryk1337.official@gmail.com) 
@resourceinteraction 
@copyrightu?ywaj ile chceszje?eli szanujesz mojpracto nie usuwaj notki o autorze. 
]] 

local dxfont0_cz dxCreateFont("cz.ttf"19local screenWscreenH guiGetScreenSize() 
ww,hh 19201080 
www,hhh guiGetScreenSize() 
w= (www/ww), (hhh/hh) 

function isMouseIn(psx,psy,pssx,pssy,abx,abylocal sxsy 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 isEventHandlerAddedsEventNamepElementAttachedTofunc )
     if typesEventName ) == 'string' and isElementpElementAttachedTo ) and typefunc ) == 'function' then
          local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
          if typeaAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
               for iv in ipairsaAttachedFunctions ) do
                    if == 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(vehthen 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(vehthen zamek "Otw?rz zamek" else zamek "Zamknij zamek" end 
dxDrawImage(screenW 0.3635screenH 0.1519screenW 0.2734screenH 0.6963":sr-interakcja/interakcja.png"0*w0*w0*wtocolor(255255255255), false) 
if isMouseIn(screenW 0.4510screenH 0.2185screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.2065screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.2065screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.3389screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.3296screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.3296screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.4639screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.4546screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.4546screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.5843screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.5750screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.5750screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.7074screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.6963screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.6963screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
dxDrawText(silnik, (screenW 0.4391) + 1, (screenH 0.2074) + 1, (screenW 0.6104) + 1, (screenH 0.3102) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(silnikscreenW 0.4391screenH 0.2074screenW 0.6104screenH 0.3102tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(reczny, (screenW 0.4391) + 1, (screenH 0.3296) + 1, (screenW 0.6104) + 1, (screenH 0.4324) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(recznyscreenW 0.4391screenH 0.3296screenW 0.6104screenH 0.4324tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(swiatla, (screenW 0.4385) + 1, (screenH 0.4546) + 1, (screenW 0.6099) + 1, (screenH 0.5574) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(swiatlascreenW 0.4385screenH 0.4546screenW 0.6099screenH 0.5574tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText("Wysad? pasa?er?w", (screenW 0.4385) + 1, (screenH 0.5750) + 1, (screenW 0.6099) + 1, (screenH 0.6778) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText("Wysad? pasa?er?w"screenW 0.4385screenH 0.5750screenW 0.6099screenH 0.6778tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(zamek, (screenW 0.4385) + 1, (screenH 0.6963) + 1, (screenW 0.6099) + 1, (screenH 0.7991) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(zamekscreenW 0.4385screenH 0.6963screenW 0.6099screenH 0.7991tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalseend 

addEventHandler("onClientClick"root, function(btnstate) 
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.4510screenH 0.2185screenW 0.1505screenH 0.0824then 
triggerServerEvent("engine"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.3389screenW 0.1505screenH 0.0824then 
triggerServerEvent("brake"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.4639screenW 0.1505screenH 0.0824then 
triggerServerEvent("lights"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.5843screenW 0.1505screenH 0.0824then 
triggerServerEvent("exit"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.7074screenW 0.1505screenH 0.0824then 
triggerServerEvent("doors"localPlayerend 
end 
end 
endbindKey("lshift","down",function() 
local veh getPedOccupiedVehicle(localPlayer) 
if veh then 
if getVehicleController(veh) == localPlayer then 
if shift == false then 
addEventHandler ("onClientRender"rootinterakcjashowCursor(trueshift true 
else 
removeEventHandler ("onClientRender"rootinterakcjashift false 
showCursor (falseend 
end 
end 
end) 




function closeinteraction()
local veh getPedOccupiedVehicle(localPlayer) 
if veh then 
if getVehicleController(veh) == localPlayer then 
if isEventHandlerAdded("onClientRender"rootinterakcjathen
removeEventHandler ("onClientRender"rootinterakcjaend
end
end
end
addEventHandler("onClientVehicleExit"getRootElement(), closeinteraction)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-27, 18:46


smigi







Wiek: 23
Na forum: 3367 dni
Posty: 60
Nick w MP: smigi

Piwa: 2

Respekt: 50

"NotPaladyn" napisał/a:

Spr?buj tak:

--[[ 
@authornanKy (eryk1337.official@gmail.com) 
@resourceinteraction 
@copyrightu?ywaj ile chceszje?eli szanujesz mojpracto nie usuwaj notki o autorze. 
]] 

local dxfont0_cz dxCreateFont("cz.ttf"19local screenWscreenH guiGetScreenSize() 
ww,hh 19201080 
www,hhh guiGetScreenSize() 
w= (www/ww), (hhh/hh) 

function isMouseIn(psx,psy,pssx,pssy,abx,abylocal sxsy 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 isEventHandlerAddedsEventNamepElementAttachedTofunc )
     if typesEventName ) == 'string' and isElementpElementAttachedTo ) and typefunc ) == 'function' then
          local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
          if typeaAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
               for iv in ipairsaAttachedFunctions ) do
                    if == 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(vehthen 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(vehthen zamek "Otw?rz zamek" else zamek "Zamknij zamek" end 
dxDrawImage(screenW 0.3635screenH 0.1519screenW 0.2734screenH 0.6963":sr-interakcja/interakcja.png"0*w0*w0*wtocolor(255255255255), false) 
if isMouseIn(screenW 0.4510screenH 0.2185screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.2065screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.2065screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.3389screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.3296screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.3296screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.4639screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.4546screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.4546screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.5843screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.5750screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.5750screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
if isMouseIn(screenW 0.4510screenH 0.7074screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.6963screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.6963screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
dxDrawText(silnik, (screenW 0.4391) + 1, (screenH 0.2074) + 1, (screenW 0.6104) + 1, (screenH 0.3102) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(silnikscreenW 0.4391screenH 0.2074screenW 0.6104screenH 0.3102tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(reczny, (screenW 0.4391) + 1, (screenH 0.3296) + 1, (screenW 0.6104) + 1, (screenH 0.4324) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(recznyscreenW 0.4391screenH 0.3296screenW 0.6104screenH 0.4324tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(swiatla, (screenW 0.4385) + 1, (screenH 0.4546) + 1, (screenW 0.6099) + 1, (screenH 0.5574) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(swiatlascreenW 0.4385screenH 0.4546screenW 0.6099screenH 0.5574tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText("Wysad? pasa?er?w", (screenW 0.4385) + 1, (screenH 0.5750) + 1, (screenW 0.6099) + 1, (screenH 0.6778) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText("Wysad? pasa?er?w"screenW 0.4385screenH 0.5750screenW 0.6099screenH 0.6778tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(zamek, (screenW 0.4385) + 1, (screenH 0.6963) + 1, (screenW 0.6099) + 1, (screenH 0.7991) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalsedxDrawText(zamekscreenW 0.4385screenH 0.6963screenW 0.6099screenH 0.7991tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalseend 

addEventHandler("onClientClick"root, function(btnstate) 
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.4510screenH 0.2185screenW 0.1505screenH 0.0824then 
triggerServerEvent("engine"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.3389screenW 0.1505screenH 0.0824then 
triggerServerEvent("brake"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.4639screenW 0.1505screenH 0.0824then 
triggerServerEvent("lights"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.5843screenW 0.1505screenH 0.0824then 
triggerServerEvent("exit"localPlayer) 
elseif isMouseIn(screenW 0.4510screenH 0.7074screenW 0.1505screenH 0.0824then 
triggerServerEvent("doors"localPlayerend 
end 
end 
endbindKey("lshift","down",function() 
local veh getPedOccupiedVehicle(localPlayer) 
if veh then 
if getVehicleController(veh) == localPlayer then 
if shift == false then 
addEventHandler ("onClientRender"rootinterakcjashowCursor(trueshift true 
else 
removeEventHandler ("onClientRender"rootinterakcjashift false 
showCursor (falseend 
end 
end 
end) 




function closeinteraction()
local veh getPedOccupiedVehicle(localPlayer) 
if veh then 
if getVehicleController(veh) == localPlayer then 
if isEventHandlerAdded("onClientRender"rootinterakcjathen
removeEventHandler ("onClientRender"rootinterakcjaend
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?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-28, 03:49


Hades.

Łiiiiiiiiii






Wiek: 22
Na forum: 4699 dni
Posty: 372
Nick w MP: Hades

Piwa: 3214

Respekt: 337,8
Respekt: 337,8Respekt: 337,8Respekt: 337,8

R*


--[[ 
@authornanKy (eryk1337.official@gmail.com) 
@resourceinteraction 
@copyrightu?ywaj ile chceszje?eli szanujesz mojpracto nie usuwaj notki o autorze. 
]] 

local dxfont0_cz dxCreateFont("cz.ttf"19local screenWscreenH guiGetScreenSize() 
ww,hh 19201080 
www,hhh guiGetScreenSize() 
w= (www/ww), (hhh/hh) 

function isMouseIn(psx,psy,pssx,pssy,abx,aby) 
    local sxsy 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(vehthen 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(vehthen zamek "Otw?rz zamek" else zamek "Zamknij zamek" end 
    dxDrawImage(screenW 0.3635screenH 0.1519screenW 0.2734screenH 0.6963":sr-interakcja/interakcja.png"0*w0*w0*wtocolor(255255255255), false) 
    if isMouseIn(screenW 0.4510screenH 0.2185screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.2065screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.2065screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
    if isMouseIn(screenW 0.4510screenH 0.3389screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.3296screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.3296screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
    if isMouseIn(screenW 0.4510screenH 0.4639screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.4546screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.4546screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
    if isMouseIn(screenW 0.4510screenH 0.5843screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.5750screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.5750screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
    if isMouseIn(screenW 0.4510screenH 0.7074screenW 0.1505screenH 0.0824then dxDrawImage(screenW 0.4385screenH 0.6963screenW 0.1719screenH 0.1037":sr-interakcja/buttonon.png"0*w0*w0*wtocolor(255255255255), false) else dxDrawImage(screenW 0.4385screenH 0.6963screenW 0.1719screenH 0.1037":sr-interakcja/buttonoff.png"0*w0*w0*wtocolor(255255255255), falseend 
    dxDrawText(silnik, (screenW 0.4391) + 1, (screenH 0.2074) + 1, (screenW 0.6104) + 1, (screenH 0.3102) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(silnikscreenW 0.4391screenH 0.2074screenW 0.6104screenH 0.3102tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(reczny, (screenW 0.4391) + 1, (screenH 0.3296) + 1, (screenW 0.6104) + 1, (screenH 0.4324) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(recznyscreenW 0.4391screenH 0.3296screenW 0.6104screenH 0.4324tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(swiatla, (screenW 0.4385) + 1, (screenH 0.4546) + 1, (screenW 0.6099) + 1, (screenH 0.5574) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(swiatlascreenW 0.4385screenH 0.4546screenW 0.6099screenH 0.5574tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText("Wysad? pasa?er?w", (screenW 0.4385) + 1, (screenH 0.5750) + 1, (screenW 0.6099) + 1, (screenH 0.6778) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText("Wysad? pasa?er?w"screenW 0.4385screenH 0.5750screenW 0.6099screenH 0.6778tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(zamek, (screenW 0.4385) + 1, (screenH 0.6963) + 1, (screenW 0.6099) + 1, (screenH 0.7991) + 1tocolor(000255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalse) 
    dxDrawText(zamekscreenW 0.4385screenH 0.6963screenW 0.6099screenH 0.7991tocolor(255255255255), 1*wdxfont0_cz"center""center"falsefalsefalsefalsefalseend 

addEventHandler("onClientClick"root, function(btnstate) 
    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.4510screenH 0.2185screenW 0.1505screenH 0.0824then 
                triggerServerEvent("engine"localPlayer) 
            elseif isMouseIn(screenW 0.4510screenH 0.3389screenW 0.1505screenH 0.0824then 
                triggerServerEvent("brake"localPlayer) 
            elseif isMouseIn(screenW 0.4510screenH 0.4639screenW 0.1505screenH 0.0824then 
                triggerServerEvent("lights"localPlayer) 
            elseif isMouseIn(screenW 0.4510screenH 0.5843screenW 0.1505screenH 0.0824then 
                triggerServerEvent("exit"localPlayer) 
            elseif isMouseIn(screenW 0.4510screenH 0.7074screenW 0.1505screenH 0.0824then 
                triggerServerEvent("doors"localPlayer) 
            end 
        end 
    end 
endshowInteract = function( bool )
    if bool and not shift then
        addEventHandler('onClientRender'rootinterakcja);
        showCursortrue );
        shift true;
    else
        removeEventHandler('onClientRender'rootinterakcja);
        showCursorfalse );
        shift false;
    end
end

addEventHandler('onClientVehicleEnter'root, function( playerseat )
    if player == localPlayer and seat == 0 then
        bindKey('lshift''both', function(keystate)
            if getPedOccupiedVehiclelocalPlayer then
                if state == 'down' then
                    showInteracttrue );
                elseif state == 'up' then
                    showInteractfalse );
                end
            end
        end);
    end
end);

addEventHandler('onClientVehicleStartExit'root, function( playerseat )
    if player == localPlayer and sea == 0 then
        if shift then
            showIntearctfalse );
        end
    end
end);



Licz? na :piwo: lub R*

Postaw piwo autorowi tego posta
 

 
Tagi: interakcja :: wyjsciu :: auta :: zeby :: sie :: automatycznie :: wylaczal
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » interakcja po wyjsciu z auta zeby sie automatycznie wylaczal Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku