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

Wysłany: 2019-02-11, 22:03


wiciuke







Wiek: 29
Na forum: 3436 dni
Posty: 14
Nick w MP: wiciuke

Piwa: 1

Respekt: 50

Ostrzeżeń: 100%
Witam, ot?? mam problem i nie mog? poradzi? sobie z jednym skryptem mianowicie chodzi mi o to ?e je?eli b?dzie jaka? ilo?? hp to samoch?d wgl nie odpali, za pomoc daje piwo :piwo:

c.lua

local screenWscreenH guiGetScreenSize()
local cz dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf",10) or "default-bold"
local cz2 dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf",12) or "default-bold"
local w,guiGetScreenSize()
local sXsY guiGetScreenSize()
local startY = (sY 155)/2
opcjaWybrana 1

function stworzListe()
opcje = {}

local veh getPedOccupiedVehicle(localPlayer)
    if veh then
            if not getVehicleEngineState(vehthen
            table.insert(opcje, {"Odpal silnik"1})
            else
            table.insert(opcje, {"Zga? silnik"2})
            end
          

            if getVehicleOverrideLights(veh) ~= 2 then
            table.insert(opcje, {"Uruchom lampy"3})
            else
            table.insert(opcje, {"Zga? lampy"4})
            end

                
            if isElementFrozen(vehthen
            table.insert(opcje, {"Spu?? r?czny"7})
            else
            table.insert(opcje, {"Zaci?gnij r?czny"8})
            end


        if isVehicleLocked(vehthen
            table.insert(opcje, {"Otw?rz pojazd"5})
        else
            table.insert(opcje, {"Zamknij pojazd"6})
        end
    

           if getVehicleDoorOpenRatio(veh,0) == 0 then
          table.insert(opcje, {"Otw?rz mask?"9})
            else
            table.insert(opcje, {"Zamknij mask?"10})
            end

          if getVehicleDoorOpenRatio(veh,1) == 0 then
          table.insert(opcje, {"Otw?rz baga?nik"11})
            else
            table.insert(opcje, {"Zamknij baga?nik"12})
            end
          end
if #opcje > 0 then
        if not show then
        bindKey("mouse_wheel_up""down"onSuwakZmien)
        bindKey("mouse_wheel_down""down"onSuwakZmien)
        bindKey("arrow_u""down"onSuwakZmien)
        bindKey("arrow_d""down"onSuwakZmien)
        bindKey("space""down"onSuwakWybierz)
        addEventHandler("onClientRender"getRootElement(), dxDrawPanelInterakcji)
        show true
        end
    end
end

function ostatniPojazd()
local veh getElementData(localPlayer"lastVeh")
    if veh then
        if isElement(vehthen
        local driver getElementData(veh"lastDriver")
            if driver == localPlayer then
            local dxdydz getElementPosition(localPlayer)
            local vxvyvz getElementPosition(veh)
                if 10 >= getDistanceBetweenPoints3D(dxdydzvxvyvzthen
                saveV veh
                return veh
                end
            end
        end
    end
end

function wlaczPanelInterakcji()
local veh getPedOccupiedVehicle(localPlayer)
    if veh then
        if getVehicleController(veh) == localPlayer then   
        showChat(false)
        stworzListe()
        end
    else
    local veh ostatniPojazd()
        if veh then
        stworzListe()
        end
    end
end

function wylaczPanelInterakcji()
    if show then
    show false        
    showChat(true)
    unbindKey("mouse_wheel_up""down"onSuwakZmien)
    unbindKey("mouse_wheel_down""down"onSuwakZmien)
    unbindKey("arrow_u""down"onSuwakZmien)
    unbindKey("arrow_d""down"onSuwakZmien)
    unbindKey("space""down"onSuwakWybierz)
    removeEventHandler("onClientRender"getRootElement(), dxDrawPanelInterakcji)
    saveV nil
    end
end

bindKey("lshift""down"wlaczPanelInterakcji)
bindKey("lshift""up"wylaczPanelInterakcji)

function dxDrawPanelInterakcji()
        dxDrawImage(screenW 0.0000screenH 0.0000screenW 1.0000screenH 1.0000":ec-interakcja/tlo.png"000tocolor(255255255255), false)
        dxDrawText("Aby zatwierdzi? wyb?r kliknij spacje"screenW 0.2719screenH 0.4125screenW 0.7578screenH 0.4639tocolor(255255255255), 1.00cz"center""center"falsefalsefalsefalsefalse)
           dxDrawText("Aby wybra? opcje kliknij strza?k? w g?r? lub w d??.",  screenW 0.2719screenH 0.5361screenW 0.7578screenH 0.5875tocolor(255255255255), 1.00cz"center""center"falsefalsefalsefalsefalse)
    for i,v in pairs(opcje) do
        if == opcjaWybrana then
        dxDrawText(v[1], screenW 0.2758screenH 0.4625screenW 0.7516screenH 0.5389tocolor(255,255,255,255), 1cz2"center""center")
        else
        dxDrawText(v[1], screenW 0.2758screenH 0.4625screenW 0.7516screenH 0.5389tocolor(255,255,255,0), 1cz"center""center")
        end
    end
    
    if #opcje == 1 then
    opcjaWybrana 1
    end

stworzListe()
end

function onSuwakZmien(k,ks)
    if k  == "mouse_wheel_up" then --na dol
    opcjaWybrana opcjaWybrana 1
        if opcjaWybrana == 0 then
        opcjaWybrana #opcje
        end
    else
    opcjaWybrana opcjaWybrana 1
        if opcjaWybrana == #opcje + 1 then
        opcjaWybrana 1
        end
    end
end

function onSuwakZmien(k,ks)
    if k  == "arrow_u" then --na dol
    opcjaWybrana opcjaWybrana 1
        if opcjaWybrana == 0 then
        opcjaWybrana #opcje
        end
    else
    opcjaWybrana opcjaWybrana 1
        if opcjaWybrana == #opcje + 1 then
        opcjaWybrana 1
        end
    end
end

function onSuwakWybierz()
    if #opcje == 1 then
    triggerServerEvent("onInterakcjeWybierzAkcje"localPlayerfalsesaveV)
    return
    end

    if opcjaWybrana then
    local id opcje[opcjaWybrana][2]
        if id then
        triggerServerEvent("onInterakcjeWybierzAkcje"localPlayeridsaveV)
        end
    end
end

fileDelete("c.lua") -- usuwamy


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-11, 22:08


Gravgor







Wiek: 22
Na forum: 3619 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Mo?e poka? nam miejsce kt?re odpowiada za uruchomianie pojazdu?

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-11, 22:08


Emm

***** ***






Wiek: 32
Na forum: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Zapodaj stron? servera, z tego kodu nic nie zdzia?amy.

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-11, 22:13


wiciuke







Wiek: 29
Na forum: 3436 dni
Posty: 14
Nick w MP: wiciuke

Piwa: 1

Respekt: 50

Ostrzeżeń: 100%
addEvent("onInterakcjeWybierzAkcje"true)
addEventHandler("onInterakcjeWybierzAkcje"getRootElement(),
function(idvehicle)
local veh getPedOccupiedVehicle(source)
local recznySalon getElementData(veh,"vehicle.selling")
local recznyPraca getElementData(veh,"vehicle.praca")
    if veh then
        if getVehicleController(veh) == source then
            if id == 1 then
            setVehicleEngineState(vehtrue)
            elseif id == 2 then
            setVehicleEngineState(vehfalse)
            elseif id == 3 then
            setVehicleOverrideLights(veh2)
            elseif id == 4 then
            setVehicleOverrideLights(veh1)
            elseif id == 5 then
            setVehicleDoorOpenRatio(veh,0,1,2000)
            elseif id == 6 then
            setVehicleDoorOpenRatio(veh,0,0,2000)
                                                elseif id == 9 then
            setVehicleDoorOpenRatio(veh,1,1,2000)
            elseif id == 10 then
            setVehicleDoorOpenRatio(veh,1,0,2000)
            elseif id == 7 then
            if recznySalon then 
                     outputChatBox("* Interakcja nie dzia?a na pojazd z salonu",source,255,0,0) 
         return 
end
            if recznyPraca then 
                     outputChatBox("* Nie mo?esz spusci? r?cznego!",source,255,0,0) 
         return 
end
            setElementFrozen(vehfalse)
            elseif id == 8 then
local sx,sy,sz getElementVelocity(veh)
local kmhs math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
if kmhs 20 then
if getElementModel(source) == 574 then return end
            setElementFrozen(vehtrue)
            end
        end
    else
        if vehicle then
            if isElement(vehiclethen
                if isVehicleLocked(vehiclethen
                setVehicleLocked(vehiclefalse)
                else
                setVehicleLocked(vehiclefalse)
                end
            end
        end
    end
end
end)
addEvent("nankysilnik",true)
addEventHandler("nankysilnik",getRootElement(),function()
veh getPedOccupiedVehicle(source)
            setVehicleEngineState(vehfalse)
end)


addEventHandler("onVehicleEnter"getRootElement(),
function(playerseat)
    if seat == 0 then
    setVehicleEngineState(sourcetrue)
    setElementData(source"lastDriver"player)
    setElementData(player"lastVeh"source)
    end
end)



Prosz? uprzejmie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-11, 22:17


Gravgor







Wiek: 22
Na forum: 3619 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

addEvent("onInterakcjeWybierzAkcje"true)
        addEventHandler("onInterakcjeWybierzAkcje"getRootElement(),
        function(idvehicle)
        local veh getPedOccupiedVehicle(source)
        local recznySalon getElementData(veh,"vehicle.selling")
        local recznyPraca getElementData(veh,"vehicle.praca")
            if veh then
                if getVehicleController(veh) == source then
                    if id == 1 then
                        if getElementHealth(veh) < 300 then 
                            cancelEvent()
                    setVehicleEngineState(vehtrue)
                    elseif id == 2 then
                    setVehicleEngineState(vehfalse)
                    elseif id == 3 then
                    setVehicleOverrideLights(veh2)
                    elseif id == 4 then
                    setVehicleOverrideLights(veh1)
                    elseif id == 5 then
                    setVehicleDoorOpenRatio(veh,0,1,2000)
                    elseif id == 6 then
                    setVehicleDoorOpenRatio(veh,0,0,2000)
                                                        elseif id == 9 then
                    setVehicleDoorOpenRatio(veh,1,1,2000)
                    elseif id == 10 then
                    setVehicleDoorOpenRatio(veh,1,0,2000)
                    elseif id == 7 then
                    if recznySalon then 
                             outputChatBox("* Interakcja nie dzia?a na pojazd z salonu",source,255,0,0) 
                 return 
        end
                    if recznyPraca then 
                             outputChatBox("* Nie mo?esz spusci? r?cznego!",source,255,0,0) 
                 return 
        end
                    setElementFrozen(vehfalse)
                    elseif id == 8 then
        local sx,sy,sz getElementVelocity(veh)
        local kmhs math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
        if kmhs 20 then
        if getElementModel(source) == 574 then return end
                    setElementFrozen(vehtrue)
                    end
                end
            else
                if vehicle then
                    if isElement(vehiclethen
                        if isVehicleLocked(vehiclethen
                        setVehicleLocked(vehiclefalse)
                        else
                        setVehicleLocked(vehiclefalse)
                        end
                    end
                end
            end
        end
        end
        end)
        addEvent("nankysilnik",true)
        addEventHandler("nankysilnik",getRootElement(),function()
        veh getPedOccupiedVehicle(source)
                    setVehicleEngineState(vehfalse)
        end)
        
        
        addEventHandler("onVehicleEnter"getRootElement(),
        function(playerseat)
            if seat == 0 then
            setVehicleEngineState(sourcetrue)
            setElementData(source"lastDriver"player)
            setElementData(player"lastVeh"source)
            end
        end)
end)


Nie testowane.

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-11, 22:22


wiciuke







Wiek: 29
Na forum: 3436 dni
Posty: 14
Nick w MP: wiciuke

Piwa: 1

Respekt: 50

Ostrzeżeń: 100%
triggered serverside event onInterakcjeWybierzAkcje, but event is not added serverside
Wyskakuje mi taki b??d kiedy pr?buj? wykona? interakcje z pojazdem.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-12, 09:29


BlueCry

ŚĆRIPTER LUJA






Wiek: 25
Na forum: 4006 dni
Posty: 78
Nick w MP: BlueCry

Piwa: 2176

Respekt: 110
Respekt: 110

"wiciuke" napisał/a:

triggered serverside event onInterakcjeWybierzAkcje, but event is not added serverside
Wyskakuje mi taki b??d kiedy pr?buj? wykona? interakcje z pojazdem.

Sprawd? mete czy nie masz przypadkiem pliku serwera dodanego jako klient.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-12, 16:18


wiciuke







Wiek: 29
Na forum: 3436 dni
Posty: 14
Nick w MP: wiciuke

Piwa: 1

Respekt: 50

Ostrzeżeń: 100%
Tak, jest dodany.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-12, 17:05


BlueCry

ŚĆRIPTER LUJA






Wiek: 25
Na forum: 4006 dni
Posty: 78
Nick w MP: BlueCry

Piwa: 2176

Respekt: 110
Respekt: 110

"wiciuke" napisał/a:

Tak, jest dodany.

Poka? kod mety.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-12, 21:19


Gravgor







Wiek: 22
Na forum: 3619 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Sorki m?j b??d, cancelEvent() nie by? tam potrzebny.

s.lua

addEvent("onInterakcjeWybierzAkcje"true)
addEventHandler("onInterakcjeWybierzAkcje"getRootElement(),
function(idvehicle)
local veh getPedOccupiedVehicle(source)
local recznySalon getElementData(veh,"vehicle.selling")
local recznyPraca getElementData(veh,"vehicle.praca")
    if veh then
        if getVehicleController(veh) == source then
            if id == 1 then
              if getElementHealth(veh) < 400 then 
              outputChatBox("Silnik ju? nie odpali"client255255255)
                return end 
            setVehicleEngineState(vehtrue)
            elseif id == 2 then
            setVehicleEngineState(vehfalse)
            elseif id == 3 then
            setVehicleOverrideLights(veh2)
            elseif id == 4 then
            setVehicleOverrideLights(veh1)
            elseif id == 5 then
            setVehicleDoorOpenRatio(veh,0,1,2000)
            elseif id == 6 then
            setVehicleDoorOpenRatio(veh,0,0,2000)
                                                elseif id == 9 then
            setVehicleDoorOpenRatio(veh,1,1,2000)
            elseif id == 10 then
            setVehicleDoorOpenRatio(veh,1,0,2000)
            elseif id == 7 then
            if recznySalon then 
                     outputChatBox("* Interakcja nie dzia?a na pojazd z salonu",source,255,0,0) 
         return 
end
            if recznyPraca then 
                     outputChatBox("* Nie mo?esz spusci? r?cznego!",source,255,0,0) 
         return 
end
            setElementFrozen(vehfalse)
            elseif id == 8 then
local sx,sy,sz getElementVelocity(veh)
local kmhs math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
if kmhs 20 then
if getElementModel(source) == 574 then return end
            setElementFrozen(vehtrue)
            end
        end
    else
        if vehicle then
            if isElement(vehiclethen
                if isVehicleLocked(vehiclethen
                setVehicleLocked(vehiclefalse)
                else
                setVehicleLocked(vehiclefalse)
                end
            end
        end
    end
end
end)
addEvent("nankysilnik",true)
addEventHandler("nankysilnik",getRootElement(),function()
veh getPedOccupiedVehicle(source)
            setVehicleEngineState(vehfalse)
end)


addEventHandler("onVehicleEnter"getRootElement(),
function(playerseat)
    if seat == 0 then
    setVehicleEngineState(sourcetrue)
    setElementData(source"lastDriver"player)
    setElementData(player"lastVeh"source)
    end
end)


Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Tagi: interakcja :: silnik
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 - Silnik 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