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

Wysłany: 2017-11-30, 21:11


Grace

Kierowca Pralki






Wiek: 24
Na forum: 3578 dni
Posty: 168
Nick w MP: Grace

Piwa: 1039

Respekt: 35,8

M?j problem polega na tym, ?e nie przechodzi mi na stron? clienta.
w server-side robi? tak:
function playerJoin()
    triggerClientEvent(source, "openLoginGUI", source, true)
    outputChatBox("dolaczyl", source) -- testowe
end
addEventHandler("onPlayerJoin", getRootElement(), playerJoin)


a w client-side robi? tak:
function loginGUI(screen)
    if (screen == true) then
        guiSetVisible(GUIEdior.window[1], true)
        showCursor(true)
        fadeCamera(true)
        guiSetInputEnabled(false)
    end
end
addEvent("openLoginGUI", true)
addEventHandler("openLoginGUI", resourceRoot, loginGUI)

Oczywi?cie w cliencie wy?ej mam tworzenie GUI.
I dlaczego to GUI si? nie pokazuje? Dzi?ki z g?ry za pomoc

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-30, 21:13


Atroth







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

Piwa: 4813

Respekt: 540
Respekt: 540

xMaslo,

Jak? zmienn? wysy?asz na stron? clienta (chodzi mi o "true")?

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: 2017-11-30, 21:24


Grace

Kierowca Pralki






Wiek: 24
Na forum: 3578 dni
Posty: 168
Nick w MP: Grace

Piwa: 1039

Respekt: 35,8

chodzi o t? zmienn? 'screen'. Stwierdzi?em ?e jest ona bez sensu, kod wygl?da tak:
server:
function playerJoin()
    triggerClientEvent(source, "openLoginGUI", source)
    outputChatBox("dolaczyl", source) -- testowe
end
addEventHandler("onPlayerJoin", getRootElement(), playerJoin)


client
function loginGUI()
    guiSetVisible(GUIEdior.window[1], true)
    showCursor(true)
    fadeCamera(true)
    guiSetInputEnabled(false)
end
addEvent("openLoginGUI", true)
addEventHandler("openLoginGUI", resourceRoot, loginGUI)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-30, 21:27


Atroth







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

Piwa: 4813

Respekt: 540
Respekt: 540

xMaslo, No i w czym problem?

edit: zamiast resourceRoot daj root

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: 2017-11-30, 21:32


Grace

Kierowca Pralki






Wiek: 24
Na forum: 3578 dni
Posty: 168
Nick w MP: Grace

Piwa: 1039

Respekt: 35,8

zmienione na root w calym kodzie, nadal nic.
Nawet jak dam outputChatBoxa do clienta, nie wykona si?.
Po prostu, server nie wysyla nic do clienta, a nie wyskakuj? b??dy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-30, 21:36


PreQ

Halo admin






Wiek: 29
Na forum: 3252 dni
Posty: 34
Nick w MP: Shikomaru

Piwa: 80

Respekt: 60

Spr?buj z tym

 function?playerJoin() ????
triggerClientEvent(source,?"openLoginGUI",?plr) ????
outputChatBox("dolaczyl",?source , plr)?--?testowe 
end
 addEventHandler("onPlayerJoin",?getRootElement , playerJoin)  


Podpis
Mapper & Lua

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-30, 21:38


Grace

Kierowca Pralki






Wiek: 24
Na forum: 3578 dni
Posty: 168
Nick w MP: Grace

Piwa: 1039

Respekt: 35,8

Kod:

[2017-11-30 21:37] WARNING: iplay-login\login_s.lua:15: Bad argument @ 'triggerClientEvent' [Expected element at argument 3, got nil]


linijka 15 to 'triggerClientEvent' w 'playerJoin'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-30, 21:46


PreQ

Halo admin






Wiek: 29
Na forum: 3252 dni
Posty: 34
Nick w MP: Shikomaru

Piwa: 80

Respekt: 60

Teraz
 function?playerJoin() ????
bool triggerClientEvent(source,?"openLoginGUI",?plr ,?true)
 ???outputChatBox("dolaczyl",?source , plr)?--?testowe
 end
 addEventHandler("onPlayerJoin",?getRootElement(),?playerJoin)


Podpis
Mapper & Lua

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-01, 08:12


Grace

Kierowca Pralki






Wiek: 24
Na forum: 3578 dni
Posty: 168
Nick w MP: Grace

Piwa: 1039

Respekt: 35,8

Nie mam ju? kompletnie pomys?u, daje ca?y kod:
Server
--[[
* Author: Szymixo
* Project: iPlay-RPG
* Type: server
]]--
----------------------------------------------------------------------------
local SQL = dbConnect("mysql", "dbname=mta;host=localhost", "root", "", "share=1")
if SQL == false then
    outputDebugString("Polaczenie z MySQL nie udalo sie.")
else
    outputDebugString("Poprawnie polaczono z baza danych MySQL")
end
----------------------------------------------------------------------------
 addEventHandler("onPlayerJoin", getRootElement(), function()
     triggerClientEvent(source, "openLoginGUI", source)
 end)
----------------------------------------------------------------------------
function loginPlayer(username, password)
    query = dbQuery(SQL, "SELECT * FROM accounts WHERE BINARY username=? and password=?", username, password)
    result, numrows, errorMsg = dbPoll(query, -1)
    
    local row = result[1]
    if row then
        triggerClientEvent(client, "login.success", client)
        outputChatBox("Pomy?lnie zalogowa?e? si?.", client)
    else
        outputChatBox("Niepoprawne dane logowania!", client)
    end
end
addEvent("loginPlayer", true)
addEventHandler("loginPlayer", getRootElement(), loginPlayer)
----------------------------------------------------------------------------
function registerPlayer(username, password, email)
    query = dbQuery(SQL, "SELECT * FROM accounts WHERE BINAY username=?", username)
    result, numrows, errorMsg = dbPoll(query, -1)
    
    local row = result[1]
    if row then
        outputChatBox("Ten nick jest ju? zaj?ty!", client)
    else
        query1 = dbQuery(SQL, "INSERT INTO accounts (username, password, email) VALUES (?, ?, ?)", username, password, email)
        triggerClientEvent(client, "register.success", client)
    end
end
addEvent("registerPlayer", true)
addEventHandler("registerPlayer", resourceRoot, registerPlayer)
----------------------------------------------------------------------------


Client
--[[
* Author: Szymixo
* Project: iPlay-RPG
* Type: client
]]--
----------------------------------------------------------------------------
function centerWindow (center_window)
    local screenW, screenH = guiGetScreenSize()
    local windowW, windowH = guiGetSize(center_window, false)
    local x, y = (screenW - windowW) /2,(screenH - windowH) /2
    return guiSetPosition(center_window, x, y, false)
end
----------------------------------------------------------------------------
GUIEditor = {
    button = {},
    window = {},
    label = {},
    memo = {}
}
-- GUI Rejestracji !!! DO ZMIANY !!!
window = guiCreateWindow(605, 120, 334, 286, "Register.", false)
guiWindowSetSizable(window, false)
guiSetVisible(window, false)
centerWindow(window)
guiWindowSetMovable(window, false)
labUser = guiCreateLabel(27, 66, 64, 15, "Username:", false, window)
guiSetFont(labUser, "default-bold-small")
labPass = guiCreateLabel(27, 104, 64, 15, "Password:", false, window)
guiSetFont(labPass, "default-bold-small")
regRepeat = guiCreateEdit(111, 132, 183, 33, "", false, window)
guiEditSetMasked(regRepeat, true)
labRep = guiCreateLabel(8, 140, 103, 15, "Repeat Password:", false, window)
guiSetFont(labRep, "default-bold-small")
regPassword = guiCreateEdit(111, 96, 183, 33, "", false, window)
guiEditSetMasked(regPassword, true)
regUsername = guiCreateEdit(111, 58, 183, 33, "", false, window)
regEmail = guiCreateEdit(111, 169, 183, 33, "", false, window)
labMail = guiCreateLabel(42, 179, 35, 13, "Email:", false, window)
guiSetFont(labMail, "default-bold-small")
goback = guiCreateButton(23, 227, 120, 49, "Back", false, window)
guiSetFont(goback, "default-bold-small")
regBtn = guiCreateButton(191, 229, 120, 47, "Register", false, window)
guiSetFont(regBtn, "default-bold-small")

-- GUI logowania !!! DO ZMIANY !!!

GUIEditor.window[1] = guiCreateWindow(562, 255, 427, 460, "Login.", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetVisible(GUIEditor.window[1], false)
centerWindow(GUIEditor.window[1])
guiWindowSetMovable(GUIEditor.window[1], false)
GUIEditor.label[1] = guiCreateLabel(13, 46, 57, 19, "Username", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[1], "default-bold-small")
username = guiCreateEdit(80, 36, 174, 31, "", false, GUIEditor.window[1])
GUIEditor.label[2] = guiCreateLabel(13, 87, 57, 19, "Password", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[2], "default-bold-small")
password = guiCreateEdit(80, 77, 174, 31, "", false, GUIEditor.window[1])
guiEditSetMasked(password, true)
GUIEditor.button[1] = guiCreateButton(281, 81, 122, 40, "Register", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[1], "default-bold-small")
GUIEditor.label[3] = guiCreateLabel(0, 116, 521, 15, "____________________________________________________________________________________", false, GUIEditor.window[1])
GUIEditor.button[2] = guiCreateButton(284, 33, 119, 40, "Login", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[2], "default-bold-small")
GUIEditor.label[4] = guiCreateLabel(10, 141, 57, 19, "Updates", false, GUIEditor.window[1])
guiSetFont(GUIEditor.label[4], "default-bold-small")
GUIEditor.memo[1] = guiCreateMemo(9, 162, 408, 283, "", false, GUIEditor.window[1])
guiMemoSetReadOnly(GUIEditor.memo[1], true)
----------------------------------------------------------------------------
function loginGUI()
    guiSetVisible(GUIEdior.window[1], true)
    showCursor(true)
    fadeCamera(true)
    guiSetInputEnabled(false)
end
addEvent("openLoginGUI", true)
addEventHandler("openLoginGUI", localPlayer, loginGUI)
----------------------------------------------------------------------------
function login()
    if(source == GUIEditor.button[2]) then
        if(string.len(guiGetText(password)) > 4 and string.len(guiGetText(username)) > 1) then
            triggerServerEvent("loginPlayer", root, guiGetText(username), guiGetText(password))
        else
            outputChatBox("Has?o musi mie? minimum 4 znaki, a Login 1 znak!", root)
        end
    end
end
addEventHandler("onClientGUIClick", localPlayer, login)
----------------------------------------------------------------------------
function register()
    if (source == regBtn) then
        if(string.len(guiGetText(regPassword)) > 4 and string.len(guiGetText(regUsername)) > 1) then
            if(guiGetText(regPassword) == guiGetText(regRepeat)) then
                triggerServerEvent("registerPlayer", root, guiGetText(regUsername), guiGetText(regPassword))
            else
                outputChatBox("Has?a nie s? takie same!", client)
            end
        else
            outputChatBox("Twoje has?o lub login s? za kr?tkie!", client)
        end
    end
end
addEventHandler("onClientGUIClick", localPlayer, register)
----------------------------------------------------------------------------
function backToLogin()
    if(source == goback) then
        guiSetVisible(GUIEditor.window[1], true)
        guiSetVisible(window, false)
    end
end
addEventHandler("onClientGUIClick", localPlayer, backToLogin)
----------------------------------------------------------------------------
function openRegisterFormule()
    if(source == GUIEditor.button[1]) then
        guiSetVisible(GUIEditor.window[1], false)
        guiSetVisible(window, true)
    end
end
addEventHandler("onClientGUIClick", localPlayer, openRegisterFormule)
----------------------------------------------------------------------------
function updateNews()
    local input = xmlLoadFile("news.xml")
    local value = xmlNodeGetValue(input)
    guiSetText(GUIEditor.memo[1], tostring(value))
end
updateNews()
----------------------------------------------------------------------------
function loginSuccess()
    fadeCamera(true, 1, 255, 0, 0)
    guiSetVisible(GUIEditor.window[1], false)
    showCursor(false)
end
addEvent("login.success", true)
addEventHandler("login.success", localPlayer, loginSuccess)
----------------------------------------------------------------------------
function registerSuccess()
    guiSetVisible(GUIEditor.window[1], true)
    guiSetVisible(window, false)
end
addEvent("register.success", true)
addEventHandler("register.success", localPlayer, registerSuccess)
----------------------------------------------------------------------------


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-01, 08:22


PreQ

Halo admin






Wiek: 29
Na forum: 3252 dni
Posty: 34
Nick w MP: Shikomaru

Piwa: 80

Respekt: 60

Wsz?dzie gdzie masz
 x , y 
musisz powpisywa? kordy.
Sie dziwisz ?e Ci sie nie wy?wietla jak nie masz podanej pozycji do tego ;v

Podpis
Mapper & Lua

Postaw piwo autorowi tego posta
 

 
Tagi: gui :: się :: nie :: pokazuje
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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