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: 3436 dni
Posty: 168
Nick w MP: Grace

Piwa: 1031

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"sourcetrue)
    outputChatBox("dolaczyl"source) -- testowe
end
addEventHandler("onPlayerJoin"getRootElement(), playerJoin)


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

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: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

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: 3436 dni
Posty: 168
Nick w MP: Grace

Piwa: 1031

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"resourceRootloginGUI)


Postaw piwo autorowi tego posta
 

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


Atroth







Wiek: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

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: 3436 dni
Posty: 168
Nick w MP: Grace

Piwa: 1031

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: 3111 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: 3436 dni
Posty: 168
Nick w MP: Grace

Piwa: 1031

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: 3111 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: 3436 dni
Posty: 168
Nick w MP: Grace

Piwa: 1031

Respekt: 35,8

Nie mam ju? kompletnie pomys?u, daje ca?y kod:
Server
--[[
* AuthorSzymixo
ProjectiPlay-RPG
Typeserver
]]--
----------------------------------------------------------------------------
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(usernamepassword)
    query dbQuery(SQL"SELECT * FROM accounts WHERE BINARY username=? and password=?"usernamepassword)
    resultnumrowserrorMsg 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(usernamepasswordemail)
    query dbQuery(SQL"SELECT * FROM accounts WHERE BINAY username=?"username)
    resultnumrowserrorMsg 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 (?, ?, ?)"usernamepasswordemail)
        triggerClientEvent(client"register.success"client)
    end
end
addEvent("registerPlayer"true)
addEventHandler("registerPlayer"resourceRootregisterPlayer)
----------------------------------------------------------------------------


Client
--[[
* AuthorSzymixo
ProjectiPlay-RPG
Typeclient
]]--
----------------------------------------------------------------------------
function centerWindow (center_window)
    local screenWscreenH guiGetScreenSize()
    local windowWwindowH guiGetSize(center_windowfalse)
    local x= (screenW windowW) /2,(screenH windowH) /2
    return guiSetPosition(center_windowxyfalse)
end
----------------------------------------------------------------------------
GUIEditor = {
    button = {},
    window = {},
    label = {},
    memo = {}
}
-- GUI Rejestracji !!! DO ZMIANY !!!
window guiCreateWindow(605120334286"Register."false)
guiWindowSetSizable(windowfalse)
guiSetVisible(windowfalse)
centerWindow(window)
guiWindowSetMovable(windowfalse)
labUser guiCreateLabel(27666415"Username:"falsewindow)
guiSetFont(labUser"default-bold-small")
labPass guiCreateLabel(271046415"Password:"falsewindow)
guiSetFont(labPass"default-bold-small")
regRepeat guiCreateEdit(11113218333""falsewindow)
guiEditSetMasked(regRepeattrue)
labRep guiCreateLabel(814010315"Repeat Password:"falsewindow)
guiSetFont(labRep"default-bold-small")
regPassword guiCreateEdit(1119618333""falsewindow)
guiEditSetMasked(regPasswordtrue)
regUsername guiCreateEdit(1115818333""falsewindow)
regEmail guiCreateEdit(11116918333""falsewindow)
labMail guiCreateLabel(421793513"Email:"falsewindow)
guiSetFont(labMail"default-bold-small")
goback guiCreateButton(2322712049"Back"falsewindow)
guiSetFont(goback"default-bold-small")
regBtn guiCreateButton(19122912047"Register"falsewindow)
guiSetFont(regBtn"default-bold-small")

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

GUIEditor.window[1] = guiCreateWindow(562255427460"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(13465719"Username"falseGUIEditor.window[1])
guiSetFont(GUIEditor.label[1], "default-bold-small")
username guiCreateEdit(803617431""falseGUIEditor.window[1])
GUIEditor.label[2] = guiCreateLabel(13875719"Password"falseGUIEditor.window[1])
guiSetFont(GUIEditor.label[2], "default-bold-small")
password guiCreateEdit(807717431""falseGUIEditor.window[1])
guiEditSetMasked(passwordtrue)
GUIEditor.button[1] = guiCreateButton(2818112240"Register"falseGUIEditor.window[1])
guiSetFont(GUIEditor.button[1], "default-bold-small")
GUIEditor.label[3] = guiCreateLabel(011652115"____________________________________________________________________________________"falseGUIEditor.window[1])
GUIEditor.button[2] = guiCreateButton(2843311940"Login"falseGUIEditor.window[1])
guiSetFont(GUIEditor.button[2], "default-bold-small")
GUIEditor.label[4] = guiCreateLabel(101415719"Updates"falseGUIEditor.window[1])
guiSetFont(GUIEditor.label[4], "default-bold-small")
GUIEditor.memo[1] = guiCreateMemo(9162408283""falseGUIEditor.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"localPlayerloginGUI)
----------------------------------------------------------------------------
function login()
    if(source == GUIEditor.button[2]) then
        if(string.len(guiGetText(password)) > and string.len(guiGetText(username)) > 1then
            triggerServerEvent("loginPlayer"rootguiGetText(username), guiGetText(password))
        else
            outputChatBox("Has?o musi mie? minimum 4 znaki, a Login 1 znak!"root)
        end
    end
end
addEventHandler("onClientGUIClick"localPlayerlogin)
----------------------------------------------------------------------------
function register()
    if (source == regBtnthen
        if(string.len(guiGetText(regPassword)) > and string.len(guiGetText(regUsername)) > 1then
            if(guiGetText(regPassword) == guiGetText(regRepeat)) then
                triggerServerEvent("registerPlayer"rootguiGetText(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"localPlayerregister)
----------------------------------------------------------------------------
function backToLogin()
    if(source == gobackthen
        guiSetVisible(GUIEditor.window[1], true)
        guiSetVisible(windowfalse)
    end
end
addEventHandler("onClientGUIClick"localPlayerbackToLogin)
----------------------------------------------------------------------------
function openRegisterFormule()
    if(source == GUIEditor.button[1]) then
        guiSetVisible(GUIEditor.window[1], false)
        guiSetVisible(windowtrue)
    end
end
addEventHandler("onClientGUIClick"localPlayeropenRegisterFormule)
----------------------------------------------------------------------------
function updateNews()
    local input xmlLoadFile("news.xml")
    local value xmlNodeGetValue(input)
    guiSetText(GUIEditor.memo[1], tostring(value))
end
updateNews()
----------------------------------------------------------------------------
function loginSuccess()
    fadeCamera(true125500)
    guiSetVisible(GUIEditor.window[1], false)
    showCursor(false)
end
addEvent("login.success"true)
addEventHandler("login.success"localPlayerloginSuccess)
----------------------------------------------------------------------------
function registerSuccess()
    guiSetVisible(GUIEditor.window[1], true)
    guiSetVisible(windowfalse)
end
addEvent("register.success"true)
addEventHandler("register.success"localPlayerregisterSuccess)
----------------------------------------------------------------------------


Postaw piwo autorowi tego posta
 

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


PreQ

Halo admin






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

Piwa: 80

Respekt: 60

Wsz?dzie gdzie masz
 x 
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 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