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

Wysłany: 2018-03-25, 18:27


Rumper

Majster od pysa






Wiek: 15
Na forum: 3316 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Witam,bo chcia?bym zrobi? tak? jakby animacje do interakcji i zrobi?em to interakcja dzia?a ale bez tej animacji wgl ca?y obraz wywali?o.
KOD:
server

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

addEvent("engine"true)
addEventHandler("engine"getRootElement(),function()
    local veh getPedOccupiedVehicle(source)
    local e getVehicleEngineState(veh)
if == false then
    setVehicleEngineState(veh,true)
else
    setVehicleEngineState(veh,false)
end
end)

addEvent("brake"true)
addEventHandler("brake"getRootElement(), function()
    local veh getPedOccupiedVehicle(source)
if isElementFrozen(veh) == false then
    local sx,sy,sz getElementVelocity(veh)
    local km math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
if km 10 then return end
        setElementFrozen(vehtrue)
else
        setElementFrozen(vehfalse)
end
end)

addEvent("lights",true)
addEventHandler("lights",getRootElement(),function()
    local veh getPedOccupiedVehicle(source)
if getVehicleOverrideLights(veh) ~= 2 then
    setVehicleOverrideLights(veh,2)
else
    setVehicleOverrideLights(veh,1)
end
end)

addEvent("exit",true)
addEventHandler("exit",getRootElement(),function()
    local veh getPedOccupiedVehicle(source)
    for i=0,do
    setVehicleDoorOpenRatio vehigetVehicleDoorOpenRatio veh), 2500 )
        local wysadzil false
        for _player in pairs(getVehicleOccupants(veh)) do
        if player ~= getVehicleController(vehthen
        if not getControlState (player"enter_exit" then                
        setControlState(player,"enter_exit",true)
        setTimer(setControlState,200,1,player,"enter_exit",false)
        if not wysadzil then wysadzil true end
end
end
end
end
end)

addEvent("doors",true)
addEventHandler("doors",root,function()
    local veh getPedOccupiedVehicle(source)
if isVehicleLocked(vehthen
     setVehicleLocked(veh,false)
 else
     setVehicleLocked(veh,true)
end
end)

addEventHandler("onVehicleStartExit",root,function(player)
    local veh getPedOccupiedVehicle(player)
    if isVehicleLocked(vehthen 
        cancelEvent()
        outputChatBox("Nie mo?esz wyj?? z zamkni?tego pojazdu!"player)
    end
end)


client:

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

local dxfont0_cz dxCreateFont("cz.ttf"19)
local 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.gif"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"falsefalsefalsefalsefalse)
end

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
end)

bindKey("lshift","down",function()
    local veh getPedOccupiedVehicle(localPlayer)
    if veh then
    if getVehicleController(veh) == localPlayer then
    if shift == false then
        addEventHandler ("onClientRender"rootinterakcja)
        showCursor(true)
        shift true
    else
        removeEventHandler ("onClientRender"rootinterakcja)
        shift false 
        showCursor (false)
    end
end
end
end)


Za pomoc daje :piwo: R* [lua][/lua]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-13, 19:01


Cobey







Wiek: 25
Na forum: 3302 dni
Posty: 86
Nick w MP: Anonimowa

Piwa: 285

Respekt: -9

Ostrzeżeń: 100%
B??dy z db3?

Podpis
13.04.2018 [*] ArtWorld
Postaw piwo autorowi tego posta
 

 
Tagi: zbagowana :: interakcja
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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