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

Wysłany: 2022-03-29, 19:33


lego15







Wiek: 26
Na forum: 2097 dni
Posty: 21
Nick w MP: popoq

Piwa: 10

Respekt: 50

Witam, napisa?em skrypt na dyspozytora dla frakcji SAFD ( dost?pno?? dla frakcji safd dopisze potem oraz zmieni? stacje radiow? na odglos syreny). Chodzi o to ?e d?wi?k si? normalnie uruchamia oraz wy??cza jednak nie da si? powt?rzy? tej czynno?ci gdy j? wy??cz? nie da si? jej w??czy?

local screenWscreenH guiGetScreenSize()
local marker=createMarker(-2544.27661, -34.9700315.46506"cylinder"2255,255,255,20)
local sx,sy=guiGetScreenSize()
local w= (sx/1280),(sy/720)
local scalaczcionki = (w+h)*0.5
local sxsy guiGetScreenSize()
local dxfont0_bold dxCreateFont(":vectory-f1/files/fonts/bold.ttf", (14/1920) * sx)
local dxfont1_light dxCreateFont(":vectory-f1/files/fonts/light.ttf", (10/1920) * sx)
local screenWscreenH guiGetScreenSize()
local nazwa guiGetText(podanaNazwa)

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    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 gui()
    dxDrawImage(785404351274":nrpg_interface/img/white123.png"000tocolor(101010165), false)
    dxDrawText("Dyspozytor - SAFD"8884111024435tocolor(255255255255), 1.30"default""left""top"falsefalsefalsefalsefalse)
    dxDrawImage(7864483461":nrpg_interface/img/1.png"000tocolor(255255255255), false)
    dxDrawText("W tym panelu uruchomisz syrene jako cz?onek\n frakcji S.A Fire Departament!"8014671016600tocolor(255255255255), 1.20"default""left""top"falsefalsefalsefalsefalse)
    dxDrawImage(84657622881":nrpg_interface/img/white123.png"000tocolor(141414254), false)
    if mysz(84757622580then
        dxDrawImage(84657622881":nrpg_interface/img/white123.png"000tocolor(00020), false)
    end
    dxDrawText("Uruchom Syrene"8616001049662tocolor(255255255255), 1.70"default""left""top"falsefalsefalsefalsefalse)
    dxDrawImage(10266003332":nrpg_interface/img/siren.png"000tocolor(255255255255), false)
end

function wyl()
    dxDrawImage(785404351274":nrpg_interface/img/white123.png"000tocolor(101010165), false)
    dxDrawText("Dyspozytor - SAFD"8884111024435tocolor(255255255255), 1.30"default""left""top"falsefalsefalsefalsefalse)
    dxDrawImage(7864483461":nrpg_interface/img/1.png"000tocolor(255255255255), false)
    dxDrawText("W tym panelu uruchomisz syrene jako cz?onek\n frakcji S.A Fire Departament!"8014671016600tocolor(255255255255), 1.20"default""left""top"falsefalsefalsefalsefalse)
    dxDrawImage(84657622881":nrpg_interface/img/white123.png"000tocolor(141414254), false)
    if mysz(84757622580then
        dxDrawImage(84657622881":nrpg_interface/img/white123.png"000tocolor(00020), false)
    end
    dxDrawText("Wy??cz Syrene"8616001049662tocolor(255255255255), 1.70"default""left""top"falsefalsefalsefalsefalse)
    dxDrawImage(10266003332":nrpg_interface/img/siren.png"000tocolor(255255255255), false)
end



addEventHandler("onClientMarkerHit"marker, function(el)
    gui1 true
    guiSetVisible(podanaNazwatrue)
    addEventHandler("onClientRender"rootgui)
    showCursor(truefalse)
    guiSetVisible(podanaNazwatrue)
end)

addEventHandler("onClientMarkerLeave"resourceRoot, function(el)
    gui1 false
    if el ~= localPlayer then return end
    guiSetVisible(podanaNazwafalse)
    removeEventHandler("onClientRender"getRootElement(), gui)
    removeEventHandler("onClientRender"getRootElement(), wyl)
    showCursor(false)
    guiSetVisible(podanaNazwafalse)
    end)



function mysz(psx,psy,pssx,pssy,abx,aby)
        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

addEventHandler("onClientClick"root, function(btnstate)
        if btn == "left" and state == "down" then
        if isMouseIn(screenW 0.4365screenH 0.5296screenW 0.1271screenH 0.0833) and gui1 then
           siren playSound3D'http://s2.radioparty.pl:8005/stream', -2544.20117, -35.0839516.46683true )
            removeEventHandler("onClientRender"getRootElement(), gui)
            gui1 false
            addEventHandler("onClientRender"rootwyl)
            gui2 true
            addEventHandler("onClientClick"root, function(btnnstate)
                if btnn == "left" and state == "down" then
                    if isMouseIn(screenW 0.4365screenH 0.5296screenW 0.1271screenH 0.0833) and gui2 then
                        stopSound(siren)
                        removeEventHandler("onClientRender"getRootElement(), wyl)
                        gui2 false
                        addEventHandler("onClientRender"rootgui)
                    end
                end
            end)
        end
    end
end


Komentarz Nexisten dodany 30 Marzec 2022, 13:18Następnym razem skorzystaj ze znaczników [lua], tym razem uzupełniłem to za Ciebie :]
Ostatnio zmieniony przez Nexisten 2022-03-30, 13:17, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2022-03-29, 22:38


kamison

Przyszły programista .lua






Wiek: 25
Na forum: 3302 dni
Posty: 391
Nick w MP: kamison

Piwa: 594

Respekt: 205,3
Respekt: 205,3Respekt: 205,3

Zobacz czy jak wstawisz te eventy "onClientClick" osobno, nie jeden w drugim czy zadzia?a jak nie to mo?e zdefiniuj zmienn? "siren" przed tymi eventami

Postaw piwo autorowi tego posta
 

 
Tagi: kłopoty :: dyspozytorem
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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