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

Wysłany: 2018-08-27, 13:02


Gravgor







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

Piwa: 702

Respekt: 57,8

Hejka zn?w mam problem z pokazywaniem Gui.

server.lua
addCommandHandler("panelR", function(thePlayer)
        if getElementData(client, "player:adminS") then
            triggerClientEvent(client, "pokaz:gui", resourceRoot)
            outputChatBox(client, "?eby zamkn?c gui kliknij przycisk ZAMKNIJ")
        end)


client.lua

addEvent("pokaz:gui", true)
addEventHandler("pokaz:gui", getRootElement(), function()
  showGUI(true)
end)

---inny kod

function showGUI(value)
    if value then
        showCursor(true)
        guiSetVisible(buttons.button1, true)
        guiSetVisible(buttons.button2, true)
        guiSetVisible(buttons.button3, true)
        guiSetVisible(window.window1, true)
    guiSetVisible(memo.memo1, true)
    guiMemoSetReadOnly(memo, true),
    guiWindowSetSizable(window.window1, false)
    else
        showCursor(false)
        guiSetVisible(buttons.button1, false)
        guiSetVisible(buttons.button2, false)
        guiSetVisible(buttons.button3, false)
        guiSetVisible(window.window1, false)
    guiWindowSetSizable(window.window1, false)
    guiSetVisible(memo.memo1, false)
    end


Brak b??d?w w db3

Ostatnio zmieniony przez Gravgor 2018-08-27, 19:29, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 15:10


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

1.W komendzie wpisa?e? argument wykonawcy jako thePlayer, ale dziwnym cudem client p??niej wita - popraw to na thePlayer.
2.outputChatBox ma pierwszy argument string, czyli tekst uj?ty w cudzys?owiu, a nast?pnie element, kt?remu ma si? wy?wietli? informacja - popraw.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 15:39


Gravgor







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

Piwa: 702

Respekt: 57,8

"Kalizman" napisał/a:

1.W komendzie wpisa?e? argument wykonawcy jako thePlayer, ale dziwnym cudem client p??niej wita - popraw to na thePlayer.
2.outputChatBox ma pierwszy argument string, czyli tekst uj?ty w cudzys?owiu, a nast?pnie element, kt?remu ma si? wy?wietli? informacja - popraw.


Brak reakcji skryptu za komend?. Wszystko poprawione.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 15:58


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Poka? teraz poprawiony kod oraz b??dy z db3 (je?eli si? pojawiaj?)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 16:20


Gravgor







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

Piwa: 702

Respekt: 57,8

"Kalizman" napisał/a:

Poka? teraz poprawiony kod oraz b??dy z db3 (je?eli si? pojawiaj?)


addCommandHandler("panelR", function(thePlayer)
        if getElementData(thePlayer, "player:adminS") then
              triggerClientEvent(thePlayer, "pokaz:gui", resourceRoot)
              outputChatBox("?eby zamkn?c gui kliknij przycisk ZAMKNIJ", thePlayer)
          end)


Brak DB3.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 16:22


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

addCommandHandler("panelR", function(thePlayer)
        if getElementData(thePlayer, "player:adminS") then
              triggerClientEvent(thePlayer, "pokaz:gui", resourceRoot)
              outputChatBox("?eby zamkn?c gui kliknij przycisk ZAMKNIJ", thePlayer)
        end --od instrukcji getElementData
     end --od function
) --nawias od commandHandler


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 16:38


Gravgor







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

Piwa: 702

Respekt: 57,8

"Kalizman" napisał/a:

addCommandHandler("panelR", function(thePlayer)
        if getElementData(thePlayer, "player:adminS") then
              triggerClientEvent(thePlayer, "pokaz:gui", resourceRoot)
              outputChatBox("?eby zamkn?c gui kliknij przycisk ZAMKNIJ", thePlayer)
        end --od instrukcji getElementData
     end --od function
) --nawias od commandHandler


Dalej nic, nie wiem co tutaj mo?e powodowa? taki zabieg, ?e gui po prostu si? nie wy?wietla. Brak b??d?w w DB3.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 17:01


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Gravgor,


triggerClientEvent(thePlayer, "pokaz:gui", thePlayer)


Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 17:09


Gravgor







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

Piwa: 702

Respekt: 57,8

"Atroth" napisał/a:

Gravgor,


triggerClientEvent(thePlayer, "pokaz:gui", thePlayer)


Dalej nic. Mo?e najlepiej wy?l? ca?y kod po stronie klienta.


---rcon

function renderDX()
        dxDrawRectangle(455, 116, 381, 615, tocolor(6, 5, 6, 255), false)
        dxDrawRectangle(454, 115, 382, 107, tocolor(3, 221, 3, 255), false)
        dxDrawText("RCON PANEL", 524, 130, 784, 207, tocolor(255, 255, 255, 255), 4.00, "default", "left", "top", false, false, false, false, false)
end

addEvent("pokaz:gui", true)
addEventHandler("pokaz:gui", getRootElement(), function()
  showGUI(true)
end)

local buttons = {
           button3 = guiCreateButton(523, 643, 250, 60, "Zamknij", false),


         button1 = guiCreateButton(498, 528, 117, 50, "daj:hajs", false),


         button2 = guiCreateButton(677, 528, 117, 50, "zabierz:hajs", false),

         --GUIEditor.button[1] = guiCreateButton(677, 439, 117, 50, "test", false)


         --GUIEditor.button[2] = guiCreateButton(498, 439, 117, 50, "test", false)


        -- GUIEditor.button[3] = guiCreateButton(492, 351, 117, 50, "test", false)


         --GUIEditor.button[4] = guiCreateButton(677, 351, 117, 50, "test", false)
}


function setMoney(button, state)
    if guiGetVisible(buttons.button1) then
        if source ~= buttons.button1 then
            triggerServerEvent("daj:hajs", resourceRoot, thePlayer)
            outputChatBox("Otrzyma?e? pi?cdziesiat tysiecy! Wykorzystaj to dobrze!")
        end
    end
    addEventHandler("onClientGUIClick", root, setMoney)


        function takeMoney(button, state)
            if guiGetVisible(buttons.button2) then
                if source ~= buttons.button2 then
                    triggerServerEvent("zabierz:hajs", resourceRoot, thePlayer)
                    outputChatBox("Zabrali?my Ci niepotrzebny hajs!")
                end
            end
            addEventHandler("onClientGUIClick", root, takeMoney)

function zamknijGui()
  if guiGetVisible(buttons.button3) then
        if source ~= buttons.button3 then
      showGUI(false)
      outputChatBox("Zamkn??e? GUI")
    end
  end

      function showGUI(value)
          if value then
              showCursor(true)
              guiSetVisible(buttons.button1, true)
              guiSetVisible(buttons.button2, true)
              guiSetVisible(buttons.button3, true)
              addEventHandler("onClientRender", renderDX)
          else
              showCursor(false)
              guiSetVisible(buttons.button1, false)
              guiSetVisible(buttons.button2, false)
              guiSetVisible(buttons.button3, false)
              removeEventHandler("onClientRender", renderDX)
          end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 17:21


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

tu masz
 showGUI(true)

a ni?ej
 function showGUI(value)
          if value then


zmie? to ni?ej na if value == true then

Podpis
Pomogłem Ci
? Może zostawiłbyś za to piwko, lub respekt? Dzięki!
Mój projekt:
?
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-27, 17:32


Gravgor







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

Piwa: 702

Respekt: 57,8

"TeeNekk" napisał/a:

tu masz
 showGUI(true)

a ni?ej
 function showGUI(value)
          if value then


zmie? to ni?ej na if value == true then


Dalej to samo :-?

[ Dodano: 2018-08-27, 19:28 ]
close

Postaw piwo autorowi tego posta
 

 
Tagi: close
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