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

Wysłany: 2020-10-05, 18:20


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

c.lua BEZ dgs:
ocal stereo = {}
dziecijp = {
["-"] = true,
["-"] = true,
}

local DGS = exports.dgs

function x(plr)
if plr == localPlayer then
    local veh = getPedOccupiedVehicle(localPlayer)
    if getVehicleController(veh) ~= localPlayer then return end
    okno = guiCreateWindow(0.30, 0.86, 0.40, 0.10, "System STEREO (Kliknij F3 aby pokaza? kursor)", true)
    guiWindowSetMovable(okno, false)
    guiWindowSetSizable(okno, false)

    button = guiCreateButton(0.02, 0.47, 0.95, 0.16, "W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)", true, okno)
    link = guiCreateEdit(0.02, 0.14, 0.95, 0.26, "", true, okno)    
    guiSetVisible(okno, true)
    end
end

function ustaw()
if source ~= button then return end
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then outputChatBox("Nie jeste? w poje?dzie!") return end-- nie powinno si? zdarzy?
if getElementData(veh,"stereo:use") ~= true then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:link",guiGetText(link))
setElementData(veh,"stereo:use", true)
guiSetText(button,"WY??CZ RADIO")
else
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:use", false)
guiSetText(button,"W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)")
end
end
addEventHandler ( "onClientGUIClick", resourceRoot, ustaw )

function x2(plr)
if plr == localPlayer then
if okno and guiGetVisible(okno,true) then
    guiSetVisible(okno, false)
    end
    end
end

addEventHandler("onClientPlayerVehicleEnter", getRootElement(),
function(theVehicle, seat)
if source ~= localPlayer then return end
if seat ~= 0 then return end
if getVehicleUpgradeOnSlot(theVehicle, 10) == 1086 then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
x(source)
end
end)
function wyjebpanel()
local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then
        if okno and ( guiGetVisible(okno) == true ) then
        guiSetVisible(okno, false)
        end
    end
end
addEventHandler("onClientRender", root, wyjebpanel)

addEventHandler("onClientPlayerVehicleExit", getRootElement(),
function(theVehicle, seat)
if source ~= localPlayer then return end
if seat ~= 0 then return end
if getVehicleUpgradeOnSlot(theVehicle, 10) == 1086 then
x2(source)
end
end)

addEventHandler("onClientElementDataChange",root,function(data,_)
    if getElementType(source) ~= "vehicle" then return end
if data ~= "stereo:use" then return end
local data_tog = getElementData(source,data)
if data_tog == true then
        local url = getElementData(source,"stereo:link")
        stereo[source]=playSound3D(url, 0, 0, 0, true)
        setSoundVolume(stereo[source], 2)
        setSoundEffectEnabled(stereo[source],"compressor",true)
        setSoundMaxDistance(stereo[source], 50)
        setElementDimension(stereo[source],getElementDimension(source))
        setElementInterior(stereo[source],getElementInterior(source))
        attachElements(stereo[source], source)
else
        if not stereo[source] then return end
        stopSound(stereo[source])
end
end)


addEventHandler("onClientElementStreamIn",root,function()
    if getElementType(source) ~= "vehicle" then return end
    if not stereo[source] then
        local data_tog = getElementData(source,"stereo:use")
        if data_tog == true then
            local url = getElementData(source,"stereo:link")
            stereo[source]=playSound3D(url, 0, 0, 0)
            setSoundVolume(stereo[source], 0.6)
            setSoundEffectEnabled(stereo[source],"compressor",true)
            setSoundMaxDistance(stereo[source], 20)
            setElementDimension(stereo[source],getElementDimension(source))
            setElementInterior(stereo[source],getElementInterior(source))
            attachElements(stereo[source], source)
        end
    end
end)


addEventHandler("onClientElementDestroy",root,function()
    if getElementType(source) ~= "vehicle" then return end
        local data_tog = getElementData(source,"stereo:use")
        if data_tog == true then
            if not stereo[source] then return end
            stopSound(stereo[source])
        end
end)
fileDelete("c.lua")


Z dgs:
local stereo = {}
dziecijp = {
["-"] = true,
["-"] = true,
}

local DGS = exports.dgs

function x(plr)
if plr == localPlayer then
    local veh = getPedOccupiedVehicle(localPlayer)
    if getVehicleController(veh) ~= localPlayer then return end
    okno = DGS:dgsCreateWindow(0.30, 0.86, 0.40, 0.10, "System STEREO (Kliknij F3 aby pokaza? kursor)", true)
    DGS:dgsWindowSetMovable(okno, false)
    DGS:dgsWindowSetSizable(okno, false)

    button = DGS:dgsCreateButton(0.02, 0.47, 0.95, 0.16, "W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)", true, okno)
    link = DGS:dgsCreateEdit(0.02, 0.14, 0.95, 0.26, "", true, okno)    
    DGS:dgsSetVisible(okno, true)
    end
end

function ustaw()
if source ~= button then return end
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then outputChatBox("Nie jeste? w poje?dzie!") return end-- nie powinno si? zdarzy?
if getElementData(veh,"stereo:use") ~= true then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:link",DGS:dgsGetText(link))
setElementData(veh,"stereo:use", true)
DGS:dgsSetText(button,"WY??CZ RADIO")
else
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:use", false)
DGS:dgsSetText(button,"W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)")
end
end
addEventHandler ( "onClientGUIClick", resourceRoot, ustaw )

function x2(plr)
if plr == localPlayer then
if okno and DGS:dgsGetVisible(okno,true) then
    DGS:dgsSetVisible(okno, false)
    end
    end
end

addEventHandler("onClientPlayerVehicleEnter", getRootElement(),
function(theVehicle, seat)
if source ~= localPlayer then return end
if seat ~= 0 then return end
if getVehicleUpgradeOnSlot(theVehicle, 10) == 1086 then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
x(source)
end
end)
function wyjebpanel()
local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then
        if okno and ( DGS:dgsGetVisible(okno) == true ) then
        DGS:dgsSetVisible(okno, false)
        end
    end
end
addEventHandler("onClientRender", root, wyjebpanel)

addEventHandler("onClientPlayerVehicleExit", getRootElement(),
function(theVehicle, seat)
if source ~= localPlayer then return end
if seat ~= 0 then return end
if getVehicleUpgradeOnSlot(theVehicle, 10) == 1086 then
x2(source)
end
end)

addEventHandler("onClientElementDataChange",root,function(data,_)
    if getElementType(source) ~= "vehicle" then return end
if data ~= "stereo:use" then return end
local data_tog = getElementData(source,data)
if data_tog == true then
        local url = getElementData(source,"stereo:link")
        stereo[source]=playSound3D(url, 0, 0, 0, true)
        setSoundVolume(stereo[source], 2)
        setSoundEffectEnabled(stereo[source],"compressor",true)
        setSoundMaxDistance(stereo[source], 50)
        setElementDimension(stereo[source],getElementDimension(source))
        setElementInterior(stereo[source],getElementInterior(source))
        attachElements(stereo[source], source)
else
        if not stereo[source] then return end
        stopSound(stereo[source])
end
end)


addEventHandler("onClientElementStreamIn",root,function()
    if getElementType(source) ~= "vehicle" then return end
    if not stereo[source] then
        local data_tog = getElementData(source,"stereo:use")
        if data_tog == true then
            local url = getElementData(source,"stereo:link")
            stereo[source]=playSound3D(url, 0, 0, 0)
            setSoundVolume(stereo[source], 0.6)
            setSoundEffectEnabled(stereo[source],"compressor",true)
            setSoundMaxDistance(stereo[source], 20)
            setElementDimension(stereo[source],getElementDimension(source))
            setElementInterior(stereo[source],getElementInterior(source))
            attachElements(stereo[source], source)
        end
    end
end)


addEventHandler("onClientElementDestroy",root,function()
    if getElementType(source) ~= "vehicle" then return end
        local data_tog = getElementData(source,"stereo:use")
        if data_tog == true then
            if not stereo[source] then return end
            stopSound(stereo[source])
        end
end)
fileDelete("c.lua")


0 bledow w debugu nic!

Dokladniej to kiedy klikam W??CZ radio NIC SIE NIE DZIEJE nie zmienia sie na wylacz zostaje tak jak jest i muzyka nie gra prosze o podpowiedz co zle zrobilem znowu..

[ Dodano: 2020-10-05, 18:54 ]
tam jest funkcja onClientGUIClick ale nie wiem jak zrobic to w dgsie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-05, 21:34


kamison

Przyszły programista .lua






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

Piwa: 599

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

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
vAnimo
Wysłany: 2020-10-05, 21:39


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

czyli co mam tam zrobi? m?g?by? ja?niej bo wiem co robi ta metoda ale nie wiem jak jej uzyc w tym kodziekamison,

[ Dodano: 2020-10-05, 21:43 ]
najlepiej podaj swoj discord/ts3 badz jakis komunikator zebym mogl sie z toba skontaktowac

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-05, 21:47


kamison

Przyszły programista .lua






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

Piwa: 599

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

Pomagamy na forum, nie discordzie.
Zobacz to


function ustaw()
if source ~= button then return end
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then outputChatBox("Nie jeste? w poje?dzie!") return end-- nie powinno si? zdarzy?
if getElementData(veh,"stereo:use") ~= true then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:link",DGS:dgsGetText(link))
setElementData(veh,"stereo:use", true)
DGS:dgsSetText(button,"WY??CZ RADIO")
else
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:use", false)
DGS:dgsSetText(button,"W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)")
end
end
addEventHandler ( "onDgsMouseClick", resourceRoot, ustaw )


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
vAnimo
Wysłany: 2020-10-05, 21:49


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

Nie dziala 0 bledow w debugu

[ Dodano: 2020-10-05, 21:51 ]
Klikam ten przycisk z linkiem wklejonym i nie zmienia sie na wylacz| 0 bledow nic nie ma| bez linku to samo

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-05, 22:15


kamison

Przyszły programista .lua






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

Piwa: 599

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

Zobacz jeszcze ten event
onDgsMouseClickDown
https://wiki.multitheftauto.com/wiki/OnDgsMouseClickDown


[ Dodano: 2020-10-05, 22:21 ]
I jeszcze moo?esz sprawdzi? to co w pa?cie jest
https://pastebin.pl/view/67a19e30 - g?upie te zabezpieczenie anty hakerowskie, ju? drugi raz w przeci?gu tygodnia

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
vAnimo
Wysłany: 2020-10-05, 22:29


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

Kocham cie twoj kod dziala
Ps. serio nie k?ami?c siedzia?em nad tym 5 h od 17:19 i myslalem co moge zrobic juz chcialem isc spac ale zobaczylem twoj post kocham cie no homo

blad: https://imgur.com/a/eeLDYIU

Pr?bowa?em tak:

local stereo = {}
dziecijp = {
["-"] = true,
["-"] = true,
}

DGS = exports.dgs
function x(plr)
if plr == localPlayer then
    local veh = getPedOccupiedVehicle(localPlayer)
    if getVehicleController(veh) ~= localPlayer then return end
    okno = DGS:dgsCreateWindow(0.30, 0.86, 0.40, 0.10, "System STEREO (Kliknij F3 aby pokaza? kursor)", true)
    DGS:dgsWindowSetMovable(okno, false)
    DGS:dgsWindowSetSizable(okno, false)

    button = DGS:dgsCreateButton(0.02, 0.47, 0.95, 0.16, "W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)", true, okno)
    link = DGS:dgsCreateEdit(0.02, 0.14, 0.95, 0.26, "", true, okno)    
    DGS:dgsSetVisible(okno, true)
    end
end

function xd( button, state )
    if button == "left" and state == "down" then
        outputChatBox ("dziala")
    end
end
addEventHandler ( "onDgsMouseClick", button, xd)


--[[function ustaw()
if source ~= button then return end
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then outputChatBox("Nie jeste? w poje?dzie!") return end-- nie powinno si? zdarzy?
if getElementData(veh,"stereo:use") ~= true then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:link",DGS:dgsGetText(link))
setElementData(veh,"stereo:use", true)
DGS:dgsSetText(button,"WY??CZ RADIO")
else
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
setElementData(veh,"stereo:use", false)
DGS:dgsSetText(button,"W??CZ RADIO (PODAJ LINK DO MP3/PLS/M3U)")
end
end
addEventHandler ( "onDgsMouseClick", przycisk, ustaw )]]

function x2(plr)
if plr == localPlayer then
if okno and DGS:dgsGetVisible(okno,true) then
    DGS:dgsSetVisible(okno, false)
    end
    end
end

addEventHandler("onClientPlayerVehicleEnter", getRootElement(),
function(theVehicle, seat)
if source ~= localPlayer then return end
if seat ~= 0 then return end
if getVehicleUpgradeOnSlot(theVehicle, 10) == 1086 then
if dziecijp[getPlayerSerial(localPlayer)] then outputChatBox("Posiadasz zablokowan? mo?liwos? korzystania z STEREO.",255,255,255) return end
x(source)
end
end)
function wyjebpanel()
local veh = getPedOccupiedVehicle(localPlayer)
    if not veh then
        if okno and ( DGS:dgsGetVisible(okno) == true ) then
        DGS:dgsSetVisible(okno, false)
        end
    end
end
addEventHandler("onClientRender", root, wyjebpanel)

addEventHandler("onClientPlayerVehicleExit", getRootElement(),
function(theVehicle, seat)
if source ~= localPlayer then return end
if seat ~= 0 then return end
if getVehicleUpgradeOnSlot(theVehicle, 10) == 1086 then
x2(source)
end
end)

addEventHandler("onClientElementDataChange",root,function(data,_)
    if getElementType(source) ~= "vehicle" then return end
if data ~= "stereo:use" then return end
local data_tog = getElementData(source,data)
if data_tog == true then
        local url = getElementData(source,"stereo:link")
        stereo[source]=playSound3D(url, 0, 0, 0, true)
        setSoundVolume(stereo[source], 2)
        setSoundEffectEnabled(stereo[source],"compressor",true)
        setSoundMaxDistance(stereo[source], 50)
        setElementDimension(stereo[source],getElementDimension(source))
        setElementInterior(stereo[source],getElementInterior(source))
        attachElements(stereo[source], source)
else
        if not stereo[source] then return end
        stopSound(stereo[source])
end
end)


addEventHandler("onClientElementStreamIn",root,function()
    if getElementType(source) ~= "vehicle" then return end
    if not stereo[source] then
        local data_tog = getElementData(source,"stereo:use")
        if data_tog == true then
            local url = getElementData(source,"stereo:link")
            stereo[source]=playSound3D(url, 0, 0, 0)
            setSoundVolume(stereo[source], 0.6)
            setSoundEffectEnabled(stereo[source],"compressor",true)
            setSoundMaxDistance(stereo[source], 20)
            setElementDimension(stereo[source],getElementDimension(source))
            setElementInterior(stereo[source],getElementInterior(source))
            attachElements(stereo[source], source)
        end
    end
end)


addEventHandler("onClientElementDestroy",root,function()
    if getElementType(source) ~= "vehicle" then return end
        local data_tog = getElementData(source,"stereo:use")
        if data_tog == true then
            if not stereo[source] then return end
            stopSound(stereo[source])
        end
end)
fileDelete("c.lua")


[ Dodano: 2020-10-05, 22:30 ]
Ale dzia?a wszystko
zapisze sobie twoj kod na zawsze i bede o tobie pamieta? :piwo: :piwo: MASZ ZIMNE PIWO I POWIEM KOLEDZE ZEBY TOBIE DAL

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-10-05, 22:33


kamison

Przyszły programista .lua






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

Piwa: 599

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

Zobacz to:


function xd( button, state )
    if source == button then
        if button == "left" and state == "down" then
            outputChatBox ("dziala")
        end
    end
end
addEventHandler ( "onDgsMouseClick", resourceRoot, xd)


Pr?bujesz przypi?? handler do rzeczy, kt?rej jeszcze nie ma czyli buttona

?le, dopiero teraz zauwa?y?em - jak zdefuniujesz w funkcji xd button jako czytanie przycisku myszy to nie b?dziesz w stanie wczyta? button jako
przycisku w grze wi?c lepiej sobie zmie? nazwe?ictwo, najlepiej skr?tami tj. b - button, s - state itp.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
vAnimo
Wysłany: 2020-10-06, 05:59


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

Problem rozwi?zany, temat do zamkniecia

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: dziala :: gui :: zmienione :: dgs
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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