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

Wysłany: 2018-09-05, 21:50


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Cze??, jak zrobi? aby serwer wykrywa? czy gracz si? zalogowa? w sensie klikn?? przycisk "zaloguj" i pomy?lnie si? zalogowa? a nast?pnie wy?wietla?o si? kolejne GUI w kt?rym by?o by tworzenie postaci (na chwile obecn? chodzi o to jak zrobi? aby po zalogowaniu graczowi si? pojawia?o kolejne okno w kt?rym mo?e stworzy? postke)

C-SIDE
sWsH guiGetScreenSize()
1360
y 768

local sm = {}
sm.moov 0
sm.object1sm.object2 nilnil
 
 
local function camRender ()
    local x1y1z1 getElementPosition sm.object1 )
    local x2y2z2 getElementPosition sm.object2 )
    setCameraMatrix x1y1z1x2y2z2 )
end
 
local function removeCamHandler ()
    if(sm.moov == 1then
        sm.moov 0
        removeEventHandler "onClientPreRender"getRootElement(), camRender )
    end
end

function smoothMoveCameraa x1y1z1x1ty1tz1tx2y2z2x2ty2tz2ttime )
    if(sm.moov == 1then return false end
    sm.object1 createObject 1337x1y1z1 )
    sm.object2 createObject 1337x1ty1tz1t )
    setElementAlpha sm.object1)
    setElementAlpha sm.object2)
    setObjectScale(sm.object10.01)
    setObjectScale(sm.object20.01)
    moveObject sm.object1timex2y2z2000"InOutQuad" )
    moveObject sm.object2timex2ty2tz2t000"InOutQuad" )
 
    addEventHandler "onClientPreRender"getRootElement(), camRender )
    sm.moov 1
    setTimer removeCamHandlertime)
    setTimer destroyElementtime1sm.object1 )
    setTimer destroyElementtime1sm.object2 )
    return true
end


sWsH guiGetScreenSize()
1360
y 768

--  /x) * sW, /y) * sH


logowanie guiCreateLabel(0.770.410.180.05""true)
rejka guiCreateLabel(0.770.490.180.05""true)
login guiCreateEdit(0.380.420.160.04""true)
haslo guiCreateEdit(0.380.500.160.04""true)   
Logowanie_button_Gora guiCreateLabel(0.370.290.130.05""true)
Changelog_Button_Gora guiCreateLabel(0.520.290.130.05""trueguiEditSetMasked haslotrue guiSetVisible (logowaniefalse)
guiSetVisible (rejkafalse)
guiSetVisible (loginfalse)
guiSetVisible (haslofalse)
guiSetVisible (Logowanie_button_Gorafalse)
guiSetVisible (Changelog_Button_Gorafalse)

blad guiCreateLabel(0.000.571.000.05""true)
guiSetAlpha(blad0.2)
guiLabelSetColor(blad02550)
guiLabelSetHorizontalAlign(blad"center"false)
guiLabelSetVerticalAlign(blad"center")  
guiSetVisible (bladfalse)


function gui1()
        local screenWscreenH guiGetScreenSize()
        dxDrawRectangle(screenW 0.000screenH 0.345screenW 1.000screenH 0.281tocolor(000200), false)
        dxDrawText("Login Gracza:"screenW 0.215screenH 0.418screenW 0.366screenH 0.456tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Has?o Gracza:"screenW 0.215screenH 0.499screenW 0.366screenH 0.536tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawLine(screenW 0.215screenH 0.536screenW 0.366screenH 0.536tocolor(0100100255), 2false)
        dxDrawLine(screenW 0.215screenH 0.456screenW 0.366screenH 0.456tocolor(0100100255), 2false)
        dxDrawRectangle(screenW 0.771screenH 0.409screenW 0.177screenH 0.053tocolor(0100100200), false)
        dxDrawRectangle(screenW 0.771screenH 0.492screenW 0.177screenH 0.053tocolor(0100100200), false)
        dxDrawText("Zaloguj"screenW 0.770screenH 0.408screenW 0.948screenH 0.462tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zarejestruj"screenW 0.770screenH 0.491screenW 0.948screenH 0.546tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
end




addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), 
function ()
smoothMoveCameraa (648.00696, -1400.3413125.43704810.72760, -1400.4517825.53072,1045.97888, -1400.8480225.44975,1329.71045, -1400.4044225.4113042000 )
showChat (false)
showPlayerHudComponent("all",false)
guiSetVisible (logowanietrue)
guiSetVisible (rejkatrue)
guiSetVisible (logintrue)
guiSetVisible (haslotrue)
guiSetVisible (bladtrue)
showCursor (true)
addEventHandler ("onClientRender"rootgui1)
fadeCamera (true)
end)    

function onClickBtnLogin(button,state)
    if(button == "left" and state == "up"then
            username guiGetText(login)
            password guiGetText(haslo)
                    checksave true
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,passwordConfirm,checksave)
        end
    end
addEventHandler ("onClientGUIClick"logowanieonClickBtnLogin)

function onClickBtnRegister(button,state)
    if(button == "left" and state == "up"then
            username guiGetText(login)
            password guiGetText(haslo)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,password)
        end
    end
addEventHandler ("onClientGUIClick"rejkaonClickBtnRegister)

addEventHandler ("onClientGUIClick"Logowanie_button_Gora,
function ()
removeEventHandler ("onClientRender"rootgui1)
addEventHandler ("onClientRender"rootgui1)
guiSetVisible (logowanietrue)
guiSetVisible (rejkatrue)
guiSetVisible (logintrue)
guiSetVisible (bladtrue)
guiSetVisible (haslotrue)
end,
false)


addEvent ("statygracza"true)
addEventHandler ("statygracza"root,
function ()
player getLocalPlayer()
setCameraTarget (player)
showPlayerHudComponent("all"true)
guiSetVisible (logowaniefalse)
guiSetVisible (rejkafalse)
guiSetVisible (loginfalse)
guiSetVisible (bladfalse)
guiSetVisible (haslofalse)
guiSetVisible (Logowanie_button_Gorafalse)
guiSetVisible (Changelog_Button_Gorafalse)
showCursor (false)
showChat (true)
removeEventHandler "onClientPreRender"getRootElement(), camRender )
removeEventHandler ("onClientRender"rootgui1)
removeEventHandler ("onClientRender"rootgui2)
end
)

addEvent ("Zaloguj_N"true)
addEventHandler ("Zaloguj_N"root,
function ()
blad0 guiSetText (blad"Konto Utworzone Pomy?lnie")
end)

addEvent ("Konto_Jest"true)
addEventHandler ("Konto_Jest"root,
function ()
blad1 guiSetText (blad"Takie Konto Ju? Istnieje")
end)

addEvent ("Konto_Jest1"true)
addEventHandler ("Konto_Jest1"root,
function ()
blad2 guiSetText (blad"Takie Konto Ju? Istnieje")
end)

addEvent ("Haslo"true)
addEventHandler ("Haslo"root,
function ()
blad3 guiSetText (blad"Uzupe?nij Haslo")
end)

addEvent ("login"true)
addEventHandler ("login"root,
function ()
blad4 guiSetText (blad"Uzupe?nij Login")
end)


S-SIDE
function PlayerLogin(username,password,checksave)
if not (username == ""then
if not (password == ""then
local account getAccount username,password )
if ( account ~= false then
logIn(sourceaccountpassword)
setPlayerName(source,username)
setCameraTarget(sourcesource)
triggerClientEvent (source,"statygracza",getRootElement())
end
end
end
end                        
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

function registerPlayer(username,password,passwordConfirm)
    if not (username == ""then
        if not (password == ""then
                    local account getAccount (username,password)
                    if (account == falsethen
                        local accountAdded addAccount(tostring(username),tostring(password))
                        if (accountAddedthen
                            triggerClientEvent (source"Zaloguj_N"rootsource)
                        else
                            triggerClientEvent (source"Konto_Jest"rootsource)
                        end
                    else
                        triggerClientEvent (source"Konto_Jest1"rootsource)
                    end
        else
            triggerClientEvent (source"Haslo"rootsource)
        end
    else
        triggerClientEvent (source"login"rootsource)
        end
        end
                                               
        
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)


function playerLoginthePlayer )
end
addEventHandler("onPlayerLogin"getRootElement(), playerLogin)

function playerJointhePlayer )
spawnPlayer(thePlayer,822.51379, -1358.98242, -0.50781,0)
end
addEventHandler("onPlayerJoin"getRootElement(), playerLogin)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-05, 22:00


Cholewka

Zakorzeniony w LUA






Wiek: 22
Na forum: 3583 dni
Posty: 190

Piwa: 707

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Sprawdzaj czymkolwiek, np. zmienn?, czy GUI jest w??czone
if (guithen

Je?eli tak i kliknie na zaloguj, no to wy??czasz mu GUI i tworzysz kolejne.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-05, 22:01


nanKy







Wiek: 22
Na forum: 3866 dni
Posty: 498
Nick w MP: nanky

Piwa: 1773

Respekt: 239
Respekt: 239Respekt: 239

Tworzysz kolejn? funkcj? w kt?rej b?dziesz rysowa? GUI,


function panel_tworzenia()
-- Tutaj wrzucasz swoje dxDrawy
end


Tworzysz event do kt?rego b?dziesz si? odwo?ywa? po zalogowaniu po stronie serwera,


addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia',root,function()
      addEventHandler('onClientRender',root,panel_tworzenia) -- rysujemy gui
end)


Po zalogowaniu odwo?ujesz si? do strony klienta po rysowanie gui,


function PlayerLogin(username,password,checksave)
if not (username == ""then
if not (password == ""then
local account getAccount username,password )
if ( account ~= false then
logIn(sourceaccountpassword)
setPlayerName(source,username)
setCameraTarget(sourcesource)
triggerClientEvent (source,"statygracza",getRootElement())
triggerClientEvent(source,'show:panel_tworzenia',root)
end
end
end
end                        
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)


Dalej sobie dopisujesz ewentualne funkcje, w zakresie twoich potrzeb.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-05, 22:24


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

No dobrze, lecz jak zrobi? zapis aby po stworzeniu postaci i ponownym wej?ciu na serwer graczowi wczytywa?a si? ona?

[ Dodano: 2018-09-05, 23:10 ]
Oraz jak zrobi? aby po wpisaniu imienia i nazwiska nick zmienia? si? na nie, wraz z tym jak zrobi? aby da?o si? klikn?? "stworz postac" bo gui normalnie dzia?a

S-SIDE
function PlayerLogin(username,password,checksave)
if not (username == ""then
if not (password == ""then
local account getAccount username,password )
if ( account ~= false then
logIn(sourceaccountpassword)
setPlayerName(source,username)
setCameraTarget(sourcesource)
triggerClientEvent (source,"statygracza",getRootElement())
triggerClientEvent(source,'show:panel_tworzenia',root)
end
end
end
end                        
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

function registerPlayer(username,password,passwordConfirm)
    if not (username == ""then
        if not (password == ""then
                    local account getAccount (username,password)
                    if (account == falsethen
                        local accountAdded addAccount(tostring(username),tostring(password))
                        if (accountAddedthen
                            triggerClientEvent (source"Zaloguj_N"rootsource)
                        else
                            triggerClientEvent (source"Konto_Jest"rootsource)
                        end
                    else
                        triggerClientEvent (source"Konto_Jest1"rootsource)
                    end
        else
            triggerClientEvent (source"Haslo"rootsource)
        end
    else
        triggerClientEvent (source"login"rootsource)
        end
        end
                                               
        
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)


function playerLoginthePlayer )
end
addEventHandler("onPlayerLogin"getRootElement(), playerLogin)

addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia',root,function()
      addEventHandler('onClientRender',root,panel_tworzenia) -- rysujemy gui
end)

function playerJointhePlayer )
spawnPlayer(thePlayer,822.51379, -1358.98242, -0.50781,0)
end
addEventHandler("onPlayerJoin"getRootElement(), playerLogin)


C-SIDE
sWsH guiGetScreenSize()
1360
y 768

local sm = {}
sm.moov 0
sm.object1sm.object2 nilnil
 
 
local function camRender ()
    local x1y1z1 getElementPosition sm.object1 )
    local x2y2z2 getElementPosition sm.object2 )
    setCameraMatrix x1y1z1x2y2z2 )
end
 
local function removeCamHandler ()
    if(sm.moov == 1then
        sm.moov 0
        removeEventHandler "onClientPreRender"getRootElement(), camRender )
    end
end

function smoothMoveCameraa x1y1z1x1ty1tz1tx2y2z2x2ty2tz2ttime )
    if(sm.moov == 1then return false end
    sm.object1 createObject 1337x1y1z1 )
    sm.object2 createObject 1337x1ty1tz1t )
    setElementAlpha sm.object1)
    setElementAlpha sm.object2)
    setObjectScale(sm.object10.01)
    setObjectScale(sm.object20.01)
    moveObject sm.object1timex2y2z2000"InOutQuad" )
    moveObject sm.object2timex2ty2tz2t000"InOutQuad" )
 
    addEventHandler "onClientPreRender"getRootElement(), camRender )
    sm.moov 1
    setTimer removeCamHandlertime)
    setTimer destroyElementtime1sm.object1 )
    setTimer destroyElementtime1sm.object2 )
    return true
end


sWsH guiGetScreenSize()
1360
y 768

--  /x) * sW, /y) * sH


logowanie guiCreateLabel(0.770.410.180.05""true)
rejka guiCreateLabel(0.770.490.180.05""true)
login guiCreateEdit(0.380.420.160.04""true)
haslo guiCreateEdit(0.380.500.160.04""true)   
Logowanie_button_Gora guiCreateLabel(0.370.290.130.05""true)
Changelog_Button_Gora guiCreateLabel(0.520.290.130.05""trueguiEditSetMasked haslotrue guiSetVisible (logowaniefalse)
guiSetVisible (rejkafalse)
guiSetVisible (loginfalse)
guiSetVisible (haslofalse)
guiSetVisible (Logowanie_button_Gorafalse)
guiSetVisible (Changelog_Button_Gorafalse)

blad guiCreateLabel(0.000.571.000.05""true)
guiSetAlpha(blad0.2)
guiLabelSetColor(blad02550)
guiLabelSetHorizontalAlign(blad"center"false)
guiLabelSetVerticalAlign(blad"center")  
guiSetVisible (bladfalse)


function gui1()
        local screenWscreenH guiGetScreenSize()
        dxDrawRectangle(screenW 0.000screenH 0.345screenW 1.000screenH 0.281tocolor(000200), false)
        dxDrawText("Login Gracza:"screenW 0.215screenH 0.418screenW 0.366screenH 0.456tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Has?o Gracza:"screenW 0.215screenH 0.499screenW 0.366screenH 0.536tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawLine(screenW 0.215screenH 0.536screenW 0.366screenH 0.536tocolor(0100100255), 2false)
        dxDrawLine(screenW 0.215screenH 0.456screenW 0.366screenH 0.456tocolor(0100100255), 2false)
        dxDrawRectangle(screenW 0.771screenH 0.409screenW 0.177screenH 0.053tocolor(0100100200), false)
        dxDrawRectangle(screenW 0.771screenH 0.492screenW 0.177screenH 0.053tocolor(0100100200), false)
        dxDrawText("Zaloguj"screenW 0.770screenH 0.408screenW 0.948screenH 0.462tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zarejestruj"screenW 0.770screenH 0.491screenW 0.948screenH 0.546tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
end


Imie guiCreateEdit(53731032532""false)
Wiek guiCreateEdit(6833974132""false)
guiSetVisible (Imiefalse)
guiSetVisible (Wiekfalse)


function panel_tworzenia()
        local screenWscreenH guiGetScreenSize()
        dxDrawRectangle(02721366207tocolor(000200), false)
        dxDrawText("IMIE_NAZWISKO\n\n\n       WIEK"585276962300tocolor(254254254200), 1.00"bankgothic""left""top"falsefalsefalsefalsefalse)
        dxDrawRectangle(103336029131tocolor(212121200), false)
        dxDrawText("Stw?rz Posta?"11353681339391tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
end



addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), 
function ()
smoothMoveCameraa (648.00696, -1400.3413125.43704810.72760, -1400.4517825.53072,1045.97888, -1400.8480225.44975,1329.71045, -1400.4044225.4113042000 )
showChat (false)
showPlayerHudComponent("all",false)
guiSetVisible (logowanietrue)
guiSetVisible (rejkatrue)
guiSetVisible (logintrue)
guiSetVisible (haslotrue)
guiSetVisible (bladtrue)
showCursor (true)
addEventHandler ("onClientRender"rootgui1)
fadeCamera (true)
end)    

function onClickBtnLogin(button,state)
    if(button == "left" and state == "up"then
            username guiGetText(login)
            password guiGetText(haslo)
                    checksave true
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,passwordConfirm,checksave)
        end
    end
addEventHandler ("onClientGUIClick"logowanieonClickBtnLogin)


addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia',root,function()
      addEventHandler('onClientRender',root,panel_tworzenia) -- rysujemy gui
      guiSetVisible (Imietrue)
      guiSetVisible (Wiektrue)
      showCursor (true)
end)

function onClickBtnRegister(button,state)
    if(button == "left" and state == "up"then
            username guiGetText(login)
            password guiGetText(haslo)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,password)
        end
    end
addEventHandler ("onClientGUIClick"rejkaonClickBtnRegister)

addEventHandler ("onClientGUIClick"Logowanie_button_Gora,
function ()
removeEventHandler ("onClientRender"rootgui1)
addEventHandler ("onClientRender"rootgui1)
guiSetVisible (logowanietrue)
guiSetVisible (rejkatrue)
guiSetVisible (logintrue)
guiSetVisible (bladtrue)
guiSetVisible (haslotrue)
end,
false)


addEvent ("statygracza"true)
addEventHandler ("statygracza"root,
function ()
player getLocalPlayer()
setCameraTarget (player)
showPlayerHudComponent("all"true)
guiSetVisible (logowaniefalse)
guiSetVisible (rejkafalse)
guiSetVisible (loginfalse)
guiSetVisible (bladfalse)
guiSetVisible (haslofalse)
guiSetVisible (Logowanie_button_Gorafalse)
guiSetVisible (Changelog_Button_Gorafalse)
showCursor (false)
showChat (true)
removeEventHandler "onClientPreRender"getRootElement(), camRender )
removeEventHandler ("onClientRender"rootgui1)
removeEventHandler ("onClientRender"rootgui2)
end
)

addEvent ("Zaloguj_N"true)
addEventHandler ("Zaloguj_N"root,
function ()
blad0 guiSetText (blad"Konto Utworzone Pomy?lnie")
end)

addEvent ("Konto_Jest"true)
addEventHandler ("Konto_Jest"root,
function ()
blad1 guiSetText (blad"Takie Konto Ju? Istnieje")
end)

addEvent ("Konto_Jest1"true)
addEventHandler ("Konto_Jest1"root,
function ()
blad2 guiSetText (blad"Takie Konto Ju? Istnieje")
end)

addEvent ("Haslo"true)
addEventHandler ("Haslo"root,
function ()
blad3 guiSetText (blad"Uzupe?nij Haslo")
end)

addEvent ("login"true)
addEventHandler ("login"root,
function ()
blad4 guiSetText (blad"Uzupe?nij Login")
end)


Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 16:27


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

#1: czy posiadasz ju? jaki? system zapisu statystyk? Je?li tak, pode?lij kod od niego.

#2: aby zmieni? nick gracza na jego imi? i nazwisko u?yj poni?szej funkcji po stronie serwera


Więcej informacji znajdziesz w Wikipedii MTA:

setPlayerName


#3: przydatna b?dzie ta funkcja, najlepiej zbindowa? funkcje pod lewy przycisk myszy i sprawdza? czy myszka znajduje si? w miejscu napisu "Stw?rz posta?"


Więcej informacji znajdziesz w Wikipedii MTA:

isMouseInPosition


Je?li b?dzie mia? problemy z kodem, pisz ?mia?o.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 17:24


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Wilq, Tych funkcji kt?re mi podes?a?e? nie ogarniam, nie mam zielonego poj?cia jak ich u?y? (mimo ?e w kodzie ju? jakie? argumenty s? zawarte) a je?li chodzi zapis to w S-SIDE z tego co widze s? "statygracza"

tak jak wspomnia?em wy?ej
S-SIDE


function PlayerLogin(username,password,checksave)
if not (username == ""then
if not (password == ""then
local account getAccount username,password )
if ( account ~= false then
logIn(sourceaccountpassword)
setPlayerName(source,username)
setCameraTarget(sourcesource)
triggerClientEvent (source,"statygracza",getRootElement())
triggerClientEvent(source,'show:panel_tworzenia',root)
end
end
end
end                        
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

function registerPlayer(username,password,passwordConfirm)
    if not (username == ""then
        if not (password == ""then
                    local account getAccount (username,password)
                    if (account == falsethen
                        local accountAdded addAccount(tostring(username),tostring(password))
                        if (accountAddedthen
                            triggerClientEvent (source"Zaloguj_N"rootsource)
                        else
                            triggerClientEvent (source"Konto_Jest"rootsource)
                        end
                    else
                        triggerClientEvent (source"Konto_Jest1"rootsource)
                    end
        else
            triggerClientEvent (source"Haslo"rootsource)
        end
    else
        triggerClientEvent (source"login"rootsource)
        end
        end
                                               
        
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)


function playerLoginthePlayer )
end
addEventHandler("onPlayerLogin"getRootElement(), playerLogin)

addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia',root,function()
      addEventHandler('onClientRender',root,panel_tworzenia) -- rysujemy gui
end)

function playerJointhePlayer )
spawnPlayer(thePlayer,822.51379, -1358.98242, -0.50781,0)
end
addEventHandler("onPlayerJoin"getRootElement(), playerLogin)



C-SIDE


sWsH guiGetScreenSize()
1360
y 768

local sm = {}
sm.moov 0
sm.object1sm.object2 nilnil
 
 
local function camRender ()
    local x1y1z1 getElementPosition sm.object1 )
    local x2y2z2 getElementPosition sm.object2 )
    setCameraMatrix x1y1z1x2y2z2 )
end
 
local function removeCamHandler ()
    if(sm.moov == 1then
        sm.moov 0
        removeEventHandler "onClientPreRender"getRootElement(), camRender )
    end
end

function smoothMoveCameraa x1y1z1x1ty1tz1tx2y2z2x2ty2tz2ttime )
    if(sm.moov == 1then return false end
    sm.object1 createObject 1337x1y1z1 )
    sm.object2 createObject 1337x1ty1tz1t )
    setElementAlpha sm.object1)
    setElementAlpha sm.object2)
    setObjectScale(sm.object10.01)
    setObjectScale(sm.object20.01)
    moveObject sm.object1timex2y2z2000"InOutQuad" )
    moveObject sm.object2timex2ty2tz2t000"InOutQuad" )
 
    addEventHandler "onClientPreRender"getRootElement(), camRender )
    sm.moov 1
    setTimer removeCamHandlertime)
    setTimer destroyElementtime1sm.object1 )
    setTimer destroyElementtime1sm.object2 )
    return true
end


sWsH guiGetScreenSize()
1360
y 768

--  /x) * sW, /y) * sH


logowanie guiCreateLabel(0.770.410.180.05""true)
rejka guiCreateLabel(0.770.490.180.05""true)
login guiCreateEdit(0.380.420.160.04""true)
haslo guiCreateEdit(0.380.500.160.04""true)   
Logowanie_button_Gora guiCreateLabel(0.370.290.130.05""true)
Changelog_Button_Gora guiCreateLabel(0.520.290.130.05""trueguiEditSetMasked haslotrue guiSetVisible (logowaniefalse)
guiSetVisible (rejkafalse)
guiSetVisible (loginfalse)
guiSetVisible (haslofalse)
guiSetVisible (Logowanie_button_Gorafalse)
guiSetVisible (Changelog_Button_Gorafalse)

blad guiCreateLabel(0.000.571.000.05""true)
guiSetAlpha(blad0.2)
guiLabelSetColor(blad02550)
guiLabelSetHorizontalAlign(blad"center"false)
guiLabelSetVerticalAlign(blad"center")  
guiSetVisible (bladfalse)


function gui1()
        local screenWscreenH guiGetScreenSize()
        dxDrawRectangle(screenW 0.000screenH 0.345screenW 1.000screenH 0.281tocolor(000200), false)
        dxDrawText("Login Gracza:"screenW 0.215screenH 0.418screenW 0.366screenH 0.456tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Has?o Gracza:"screenW 0.215screenH 0.499screenW 0.366screenH 0.536tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawLine(screenW 0.215screenH 0.536screenW 0.366screenH 0.536tocolor(0100100255), 2false)
        dxDrawLine(screenW 0.215screenH 0.456screenW 0.366screenH 0.456tocolor(0100100255), 2false)
        dxDrawRectangle(screenW 0.771screenH 0.409screenW 0.177screenH 0.053tocolor(0100100200), false)
        dxDrawRectangle(screenW 0.771screenH 0.492screenW 0.177screenH 0.053tocolor(0100100200), false)
        dxDrawText("Zaloguj"screenW 0.770screenH 0.408screenW 0.948screenH 0.462tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zarejestruj"screenW 0.770screenH 0.491screenW 0.948screenH 0.546tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
end


Imie guiCreateEdit(53731032532""false)
Wiek guiCreateEdit(6833974132""false)
guiSetVisible (Imiefalse)
guiSetVisible (Wiekfalse)


function panel_tworzenia()
        local screenWscreenH guiGetScreenSize()
        dxDrawRectangle(02721366207tocolor(000200), false)
        dxDrawText("IMIE_NAZWISKO\n\n\n       WIEK"585276962300tocolor(254254254200), 1.00"bankgothic""left""top"falsefalsefalsefalsefalse)
        dxDrawRectangle(103336029131tocolor(212121200), false)
        dxDrawText("Stw?rz Posta?"11353681339391tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
end



addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), 
function ()
smoothMoveCameraa (648.00696, -1400.3413125.43704810.72760, -1400.4517825.53072,1045.97888, -1400.8480225.44975,1329.71045, -1400.4044225.4113042000 )
showChat (false)
showPlayerHudComponent("all",false)
guiSetVisible (logowanietrue)
guiSetVisible (rejkatrue)
guiSetVisible (logintrue)
guiSetVisible (haslotrue)
guiSetVisible (bladtrue)
showCursor (true)
addEventHandler ("onClientRender"rootgui1)
fadeCamera (true)
end)    

function onClickBtnLogin(button,state)
    if(button == "left" and state == "up"then
            username guiGetText(login)
            password guiGetText(haslo)
                    checksave true
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,passwordConfirm,checksave)
        end
    end
addEventHandler ("onClientGUIClick"logowanieonClickBtnLogin)


addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia',root,function()
      addEventHandler('onClientRender',root,panel_tworzenia) -- rysujemy gui
      guiSetVisible (Imietrue)
      guiSetVisible (Wiektrue)
      showCursor (true)
end)

function onClickBtnRegister(button,state)
    if(button == "left" and state == "up"then
            username guiGetText(login)
            password guiGetText(haslo)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,password)
        end
    end
addEventHandler ("onClientGUIClick"rejkaonClickBtnRegister)

addEventHandler ("onClientGUIClick"Logowanie_button_Gora,
function ()
removeEventHandler ("onClientRender"rootgui1)
addEventHandler ("onClientRender"rootgui1)
guiSetVisible (logowanietrue)
guiSetVisible (rejkatrue)
guiSetVisible (logintrue)
guiSetVisible (bladtrue)
guiSetVisible (haslotrue)
end,
false)


addEvent ("statygracza"true)
addEventHandler ("statygracza"root,
function ()
player getLocalPlayer()
setCameraTarget (player)
showPlayerHudComponent("all"true)
guiSetVisible (logowaniefalse)
guiSetVisible (rejkafalse)
guiSetVisible (loginfalse)
guiSetVisible (bladfalse)
guiSetVisible (haslofalse)
guiSetVisible (Logowanie_button_Gorafalse)
guiSetVisible (Changelog_Button_Gorafalse)
showCursor (false)
showChat (true)
removeEventHandler "onClientPreRender"getRootElement(), camRender )
removeEventHandler ("onClientRender"rootgui1)
removeEventHandler ("onClientRender"rootgui2)
end
)

addEvent ("Zaloguj_N"true)
addEventHandler ("Zaloguj_N"root,
function ()
blad0 guiSetText (blad"Konto Utworzone Pomy?lnie")
end)

addEvent ("Konto_Jest"true)
addEventHandler ("Konto_Jest"root,
function ()
blad1 guiSetText (blad"Takie Konto Ju? Istnieje")
end)

addEvent ("Konto_Jest1"true)
addEventHandler ("Konto_Jest1"root,
function ()
blad2 guiSetText (blad"Takie Konto Ju? Istnieje")
end)

addEvent ("Haslo"true)
addEventHandler ("Haslo"root,
function ()
blad3 guiSetText (blad"Uzupe?nij Haslo")
end)

addEvent ("login"true)
addEventHandler ("login"root,
function ()
blad4 guiSetText (blad"Uzupe?nij Login")
end)


Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 18:33


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie lubi? pracowa? w syfie. Pozwolisz, ?e wszystko poprawi? i lekko zedytuj? tworzenie postaci - sam zobaczysz efekty, dasz zna? czy Ci si? podoba czy nie.

Posprz?tam w kodzie, troszk? jest zb?dnych linijek albo mo?na co? zrobi? w jednym evencie (b??dy logowania ; )).

Je?li chodzi o zapis postaci nadal nie dosta?em kodu. Event, o kt?rym m?wisz nie ma nic zwi?zanego z tym o czego chc?. Zacznijmy: masz ju? jaki? GM wgrany czy robisz od podstaw wszystko 'sam'?

Aktualnie bez zapisu postaci, z ka?dy zalogowaniem tworzymy now?:
Zawsze mog? zrobi? zapis w accountDacie, daj zna? co o tym my?lisz.

S-SIDE


addEvent("onRequestLogin"true)
addEventHandler("onRequestLogin"getRootElement(), function(usernamepassword)
    if (username == "" or not usernamethen triggerClientEvent(source"bladLogowania"source"Podaj login!") return end
        if (password == "" or not passwordthen triggerClientEvent(source"bladLogowania"source"Podaj has?o!") return end
            local account getAccount(usernamepassword)
            if (account == falsethen triggerClientEvent(source"bladLogowania"source"Nie ma podanego konta lub has?o jest nieprawid?owe!") return end
                if logIn(sourceaccountpasswordthen
                    setCameraTarget(sourcesource)
                    triggerClientEvent(source'show:panel_tworzenia'source)
                else
                    triggerClientEvent(source"bladLogowania"source"Has?o nieprawid?owe!")
                end
end)                   

addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister"getRootElement(), function(username,password,passwordConfirm)
    if (username == "" or not usernamethen triggerClientEvent(source"bladLogowania"source"Podaj login!") return end
        if (password == "" or not passwordthen triggerClientEvent(source"bladLogowania"source"Podaj has?o!") return end
            local account getAccount (username,password)
            if (account == truethen triggerClientEvent(source"bladLogowania"source"Takie konto ju? istnieje!") return end
                local accountAdded addAccount(tostring(username),tostring(password))
                if (not accountAddedthen triggerClientEvent(source"bladLogowania"source"Takie konto ju? istnieje!") return end
                    triggerClientEvent(source"bladLogowania"source"Konto zosta?o utworzone.")
end)

addEvent("savePlayer",true)
addEventHandler("savePlayer"getRootElement(), function(imiewiek)
    playerJoin(source)
    if wiek then
        setElementData(source"wiek"wiek)
    end
    if imie then
        setPlayerName(sourceimie)
    end
    triggerClientEvent(source"hide:panel_tworzenia"source)
end)

function playerJoin(thePlayer)
    spawnPlayer(thePlayer822.51379, -1358.98242, -0.507810)
end
addEventHandler("onPlayerJoin"getRootElement(), playerJoin)

C-SIDE


local sWsH guiGetScreenSize()
local x 1360
local y 768
--  /x) * sW, /y) * sH

local sm = {}
sm.moov 0
sm.object1sm.object2 nilnil
 
 
local function camRender ()
    local x1y1z1 getElementPosition sm.object1 )
    local x2y2z2 getElementPosition sm.object2 )
    setCameraMatrix x1y1z1x2y2z2 )
end
 
local function removeCamHandler ()
    if(sm.moov == 1then
        sm.moov 0
        removeEventHandler "onClientPreRender"getRootElement(), camRender )
    end
end

function smoothMoveCameraa x1y1z1x1ty1tz1tx2y2z2x2ty2tz2ttime )
    if(sm.moov == 1then return false end
    sm.object1 createObject 1337x1y1z1 )
    sm.object2 createObject 1337x1ty1tz1t )
    setElementAlpha sm.object1)
    setElementAlpha sm.object2)
    setObjectScale(sm.object10.01)
    setObjectScale(sm.object20.01)
    moveObject sm.object1timex2y2z2000"InOutQuad" )
    moveObject sm.object2timex2ty2tz2t000"InOutQuad" )
 
    addEventHandler "onClientPreRender"getRootElement(), camRender )
    sm.moov 1
    setTimer removeCamHandlertime)
    setTimer destroyElementtime1sm.object1 )
    setTimer destroyElementtime1sm.object2 )
    return true
end

local logowanie guiCreateLabel(0.770.410.180.05""true)
local rejka guiCreateLabel(0.770.490.180.05""true)
local login guiCreateEdit(0.380.420.160.04"WilQ"true)
local haslo guiCreateEdit(0.380.500.160.04"mta"true)   
    guiEditSetMasked(haslotrue) 
    guiSetVisible(logowaniefalse)
    guiSetVisible(rejkafalse)
    guiSetVisible(loginfalse)
    guiSetVisible(haslofalse)

local blad guiCreateLabel(0.000.571.000.05""true)
    guiSetAlpha(blad0.7)
    guiLabelSetColor(blad02550)
    guiLabelSetHorizontalAlign(blad"center"false)
    guiLabelSetVerticalAlign(blad"center")  
    guiSetVisible(bladfalse)
    
local bladpostaci guiCreateLabel(0.000.381.000.05""true)
    guiSetAlpha(bladpostaci0.7)
    guiLabelSetColor(bladpostaci02550)
    guiLabelSetHorizontalAlign(bladpostaci"center"false)
    guiLabelSetVerticalAlign(bladpostaci"center")  
    guiSetVisible(bladpostacifalse)    

local Imie guiCreateEdit(53731032532""false)
local Wiek guiCreateEdit(6833974132""false)
    guiSetVisible(Imiefalse)
    guiSetVisible(Wiekfalse)
    
local stworzpostac guiCreateLabel(0.5350.330.1550.04""true)
    guiSetVisible(stworzpostacfalse)    
    
function gui1()
    dxDrawRectangle(sW 0.000sH 0.345sW 1.000sH 0.281tocolor(000200), false)
    dxDrawText("Login Gracza:"sW 0.215sH 0.418sW 0.366sH 0.456tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Has?o Gracza:"sW 0.215sH 0.499sW 0.366sH 0.536tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawLine(sW 0.215sH 0.536sW 0.366sH 0.536tocolor(0100100255), 2false)
    dxDrawLine(sW 0.215sH 0.456sW 0.366sH 0.456tocolor(0100100255), 2false)
    dxDrawRectangle(sW 0.771sH 0.409sW 0.177sH 0.053tocolor(0100100200), false)
    dxDrawRectangle(sW 0.771sH 0.492sW 0.177sH 0.053tocolor(0100100200), false)
    dxDrawText("Zaloguj"sW 0.770sH 0.408sW 0.948sH 0.462tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Zarejestruj"sW 0.770sH 0.491sW 0.948sH 0.546tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
end

function panel_tworzenia()
    dxDrawRectangle(02721366207tocolor(000200), false)
    dxDrawText("IMIE_NAZWISKO\n\n\n       WIEK"585276962300tocolor(254254254200), 1.00"bankgothic""left""top"falsefalsefalsefalsefalse)
    dxDrawRectangle(103336029131tocolor(0100100200), false)
    dxDrawText("Stw?rz Posta?"11353681339391tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
end

addEventHandler("onClientResourceStart"getResourceRootElement(getThisResource()), function()
    smoothMoveCameraa (648.00696, -1400.3413125.43704810.72760, -1400.4517825.53072,1045.97888, -1400.8480225.44975,1329.71045, -1400.4044225.4113042000 )
    showChat (false)
    setPlayerHudComponentVisible("all",false)
    guiSetVisible (logowanietrue)
    guiSetVisible (rejkatrue)
    guiSetVisible (logintrue)
    guiSetVisible (haslotrue)
    guiSetVisible (bladtrue)
    showCursor (true)
    addEventHandler("onClientRender"rootgui1)
    fadeCamera (true)
end)    

addEventHandler("onClientGUIClick"logowanie, function(button)
    if (button ~= "left"then return end
        triggerServerEvent("onRequestLogin"getLocalPlayer(), guiGetText(login), guiGetText(haslo))
end)

addEventHandler ("onClientGUIClick"rejka, function(button)
    if (button ~= "left"then return end
        triggerServerEvent("onRequestRegister"getLocalPlayer(), guiGetText(login), guiGetText(haslo))
end)

addEventHandler ("onClientGUIClick"stworzpostac, function(button)
    if (button ~= "left"then return end
        if guiGetText(Wiek) == "" or string.len(tonumber(guiGetText(Wiek))) > 2 then triggerEvent("bladPostaci"localPlayer"Podaj wiek!") return end
            if guiGetText(Imie) == "" or string.len(tostring(guiGetText(Imie))) > 17 or string.len(tostring(guiGetText(Imie))) < 6 then triggerEvent("bladPostaci"localPlayer"Podaj imie i nazwisko!") return end
                triggerServerEvent("savePlayer"getLocalPlayer(), tostring(guiGetText(Imie)), tonumber(guiGetText(Wiek)))
                
end)

addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia'getRootElement(), function()
    removeEventHandler("onClientRender"rootgui1)
        guiSetVisible (logowaniefalse)
        guiSetVisible (rejkafalse)
        guiSetVisible (loginfalse)
        guiSetVisible (haslofalse)
        guiSetVisible (bladfalse)    
    
    addEventHandler('onClientRender'getRootElement(), panel_tworzenia)
        guiSetVisible(Imietrue)
        guiSetVisible(Wiektrue)
        guiSetVisible(stworzpostactrue)
        guiSetVisible(bladpostacitrue)
end)

addEvent("hide:panel_tworzenia"true)
addEventHandler("hide:panel_tworzenia"getRootElement(), function()
    setCameraTarget(localPlayer)
    setPlayerHudComponentVisible("all"true)
    guiSetVisible(Imiefalse)
    guiSetVisible(Wiekfalse)
    guiSetVisible(stworzpostacfalse)
    guiSetVisible(bladpostacifalse)    
    showChat(true)
    showCursor(false)
    removeCamHandler()
    removeEventHandler("onClientRender"rootpanel_tworzenia)
end)

addEvent("bladLogowania"true)
addEventHandler("bladLogowania"getRootElement(), function(komunikat)
    guiSetText(bladkomunikat)
end)

addEvent("bladPostaci"true)
addEventHandler("bladPostaci"getRootElement(), function(komunikat)
    guiSetText(bladpostacikomunikat)
end)



W spoilerze zapis na accountDat?.

S-SIDE







C-SIDE







Ostatnio zmieniony przez Wilq 2018-09-06, 19:28, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 19:16


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Wilq, tak robie od podstaw, bo chce zrobi? co? swojego niestety nie umiem pisa? w LUA a dzi?ki u?ytkownikom GTAO troch? si? poducz? sam panel nie jest wykonany przeze mnie

[ Dodano: 2018-09-06, 19:22 ]
A je?li chodzi o save system narazie u?yj? z forum MTA bss (w przysz?o?ci spr?buj? to zrobi? autorsko)

function onPlayerQuit ( )
      local playeraccount getPlayerAccount source )
      if ( playeraccount then
            local x,y,getElementPosition (source)
            setAccountData playeraccount"s.HandMoney"getPlayerMoney source ) )
              setAccountData (playeraccount"s.skin"tostring (getPedSkin (source)))
            setAccountData (playeraccount"s.x"x)
            setAccountData (playeraccount"s.y"y)
             setAccountData (playeraccount"s.z"z)
             setAccountData (playeraccount"s.int"getElementInterior (source))
             setAccountData (playeraccount"s.dim"getElementDimension (source))
            setAccountData (playeraccount"s.rot"getPlayerRotation (source))
            setAccountData (playeraccount"s.weap0"getPedWeapon source))
            setAccountData (playeraccount"s.weap1"getPedWeapon source))
            setAccountData (playeraccount"s.weap2"getPedWeapon source))
            setAccountData (playeraccount"s.ammo2"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap3"getPedWeapon source))
            setAccountData (playeraccount"s.ammo3"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap4"getPedWeapon source))
            setAccountData (playeraccount"s.ammo4"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap5"getPedWeapon source))
            setAccountData (playeraccount"s.ammo5"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap6"getPedWeapon source))
            setAccountData (playeraccount"s.ammo6"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap7"getPedWeapon source))
            setAccountData (playeraccount"s.ammo7"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap8"getPedWeapon source))
            setAccountData (playeraccount"s.ammo8"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap9"getPedWeapon source))
            setAccountData (playeraccount"s.ammo9"getPedTotalAmmo source))
            setAccountData (playeraccount"s.weap10"getPedWeapon source10 ))
            setAccountData (playeraccount"s.weap11"getPedWeapon source11 ))
            setAccountData (playeraccount"s.weap12"getPedWeapon source12 ))
      end
end
addEventHandler "onPlayerQuit"getRootElement ( ), onPlayerQuit )

local root getRootElement()
addEventHandler("onPlayerLogin"root,
  function()
     local playeraccount getPlayerAccount source )
      if ( playeraccount then
            local playermoney getAccountData playeraccount"s.HandMoney" )
            if ( playermoney then
                  setPlayerMoney sourceplayermoney )
            end
            local playerInt getAccountData (playeraccount"s.int")
              local playerDim getAccountData (playeraccount"s.dim")  
            local playerSkin getAccountData (playeraccount"s.skin")
             local playerX getAccountData (playeraccount"s.x")
              local playerY getAccountData (playeraccount"s.y")
              local playerZ getAccountData (playeraccount"s.z")
            local playerRot getAccountData (playeraccount"s.rot")
              spawnPlayer(sourceplayerXplayerYplayerZplayerRotplayerSkinplayerIntplayerDim)
            fadeCamera (sourcetrue)
            setCameraTarget (sourcesource)
            local weap0 getAccountData(playeraccount"s.weap0")
            local weap1 getAccountData(playeraccount"s.weap1")
            local weap2 getAccountData(playeraccount"s.weap2")
            local ammo2 getAccountData(playeraccount"s.ammo2")
            local weap3 getAccountData(playeraccount"s.weap3")
            local ammo3 getAccountData(playeraccount"s.ammo3")
            local weap4 getAccountData(playeraccount"s.weap4")
            local ammo4 getAccountData(playeraccount"s.ammo4")
            local weap5 getAccountData(playeraccount"s.weap5")
            local ammo5 getAccountData(playeraccount"s.ammo5")
            local weap6 getAccountData(playeraccount"s.weap6")
            local ammo6 getAccountData(playeraccount"s.ammo6")
            local weap7 getAccountData(playeraccount"s.weap7")
            local ammo7 getAccountData(playeraccount"s.ammo7")
            local weap8 getAccountData(playeraccount"s.weap8")
            local ammo8 getAccountData(playeraccount"s.ammo8")
            local weap9 getAccountData(playeraccount"s.weap9")
            local ammo9 getAccountData(playeraccount"s.ammo9")
            local weap10 getAccountData(playeraccount"s.weap10")
            local weap11 getAccountData(playeraccount"s.weap11")
            local weap12 getAccountData(playeraccount"s.weap12")
            giveWeapon sourceweap0)
            giveWeapon sourceweap1)
            giveWeapon sourceweap2ammo2 )
            giveWeapon sourceweap3ammo3 )
            giveWeapon sourceweap4ammo4 )
            giveWeapon sourceweap5ammo5 )
            giveWeapon sourceweap6ammo6 )
            giveWeapon sourceweap7ammo7 )
            giveWeapon sourceweap8ammo8 )
            giveWeapon sourceweap9ammo9 )
            giveWeapon sourceweap10)
            giveWeapon sourceweap11)
            giveWeapon sourceweap12)        
      end
  end
)


[ Dodano: 2018-09-06, 19:25 ]
Dodam jeszcze ?e przycisk "stw?rz posta?" nie dzia?a :p

[ Dodano: 2018-09-06, 19:27 ]
Cytat:

Zawsze mog? zrobi? zapis w accountDacie, daj zna? co o tym my?lisz.


Og?lnie chodzi mi o SQlite (nie mysql) :D

Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 19:30


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Przyznam, ?e nie jestem najlepszy w SQlite wi?c ?rednio b?dzie z pomoc? z mojej strony.
Tak, zauwa?y?em, ?e przycisk nie dzia?a i go poprawi?em, w spoilerze najnowsza wersja.

Powodzenia!

S-SIDE







C-SIDE







Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
trojkatdwanasci
Wysłany: 2018-09-06, 19:38


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Wilq, Dzi?kuj? za pomoc :roll: :roll: oczywi?cie piwko i respekt leci ;P

Tak dodam ?e w skrypcie zauwa?y?em setElementData wiek etc. I da?em ci system zapisu czy nie da?oby rady po??czy? to i np

setAccountData (playeraccount"wiek")
- Daje tylko przyk?ad, je?li to nie pyknie to ju? sam postaram si? ogarn?? jaki? zapis db, pytam tylko czy jest taka mo?liwo??.

Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 19:42


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Oczywi?cie, ?e jest.
Je?li chcesz, do 20 minut wy?l? system zapisu i system logowania zintegrowany ze sob?,
tylko pytanie czy jest po co, przecie? logowanie ma ju? samo w sobie zapis na accountDat? co powoduje, ?e te inforomacje nie s? tracone.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 19:53


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Wilq, Bardziej chodzi mi o to aby przy logowaniu nie by?a potrzeba tworzenia nowej postaci, tylko od razu gdy skrypt wykryje ju? posta? z automatu po klikni?ciu "zaloguj" ?aduje posta? a je?eli konto nie wykryje postaci to wy?wietla si? gui tworzenia

Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 19:56


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ale to ju? tam jest,

if getAccountData(account"player.stworzonapostac") == true then [...]


przetestuj kod i zobacz jak on w grze wygl?da i co si? zmieni?o prosz?. : )

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 20:06


trojkatdwanasci







Wiek: 33
Na forum: 2908 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Wilq, zn?w dodam ?e przycisk stworzenia postaci nie dzia?a. I nie wiem od czego to zale?y

[ Dodano: 2018-09-06, 20:16 ]
Chyba ?e to zale? od rozdzielczo?ci monitora (w?tpie) to by ci??ko by?o

Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-09-06, 20:26


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Tak, zale?ne od rozdzielczo?ci. Do tworzenia postaci zapomnia?e? doda? skalowania, rozumiem, ?e pasek ma by? na ca?? szeroko?? ekranu? Na FullHD on nie jest po ca?ej szeroko?ci jakby co.

Sprawd?:

C-SIDE

local logowanie guiCreateLabel(0.770.410.180.05""true)
local rejka guiCreateLabel(0.770.490.180.05""true)
local login guiCreateEdit(0.380.420.160.04""true)
local haslo guiCreateEdit(0.380.500.160.04""true)   
    guiEditSetMasked(haslotrue) 
    guiSetVisible(logowaniefalse)
    guiSetVisible(rejkafalse)
    guiSetVisible(loginfalse)
    guiSetVisible(haslofalse)

local blad guiCreateLabel(0.000.571.000.05""true)
    guiSetAlpha(blad0.7)
    guiLabelSetColor(blad02550)
    guiLabelSetHorizontalAlign(blad"center"false)
    guiLabelSetVerticalAlign(blad"center")  
    guiSetVisible(bladfalse)
    
local bladpostaci guiCreateLabel(0.000.381.000.05""true)
    guiSetAlpha(bladpostaci0.7)
    guiLabelSetColor(bladpostaci02550)
    guiLabelSetHorizontalAlign(bladpostaci"center"false)
    guiLabelSetVerticalAlign(bladpostaci"center")      
    guiSetVisible(bladpostacifalse)    

local Imie guiCreateEdit(53731032532""false)
local Wiek guiCreateEdit(6833974132""false)
    guiSetVisible(Imiefalse)
    guiSetVisible(Wiekfalse)
    
local stworzpostac guiCreateLabel(0.5350.330.1550.04""true)
    guiSetVisible(stworzpostacfalse)    
    
function gui1()
    dxDrawRectangle(sW 0.000sH 0.345sW 1.000sH 0.281tocolor(000200), false)
    dxDrawText("Login Gracza:"sW 0.215sH 0.418sW 0.366sH 0.456tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Has?o Gracza:"sW 0.215sH 0.499sW 0.366sH 0.536tocolor(0100100255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawLine(sW 0.215sH 0.536sW 0.366sH 0.536tocolor(0100100255), 2false)
    dxDrawLine(sW 0.215sH 0.456sW 0.366sH 0.456tocolor(0100100255), 2false)
    dxDrawRectangle(sW 0.771sH 0.409sW 0.177sH 0.053tocolor(0100100200), false)
    dxDrawRectangle(sW 0.771sH 0.492sW 0.177sH 0.053tocolor(0100100200), false)
    dxDrawText("Zaloguj"sW 0.770sH 0.408sW 0.948sH 0.462tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
    dxDrawText("Zarejestruj"sW 0.770sH 0.491sW 0.948sH 0.546tocolor(255255255255), 1.00"default-bold""center""center"falsefalsefalsefalsefalse)
end

function panel_tworzenia()
    dxDrawRectangle(sW*0/1920sH*272/1080sW*1920/1920sH*207/1080tocolor(000200), false)
    dxDrawText("IMIE_NAZWISKO\n\n\n       WIEK"sW*585/1920sH*276/1080sW*962/1920sH*300/1080tocolor(254254254200), 1.00"bankgothic""left""top"falsefalsefalsefalsefalse)
    dxDrawRectangle(sW*1033/1920sH*360/1080sW*291/1920sH*31/1080tocolor(0100100200), false)
    dxDrawText("Stw?rz Posta?"sW*1135/1920sH*368/1080sW*1339/1920sH*391/1080tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
end

addEventHandler("onClientResourceStart"getResourceRootElement(getThisResource()), function()
    smoothMoveCameraa(648.00696, -1400.3413125.43704810.72760, -1400.4517825.53072,1045.97888, -1400.8480225.44975,1329.71045, -1400.4044225.4113042000 )
    showChat(false)
    setPlayerHudComponentVisible("all",false)
    guiSetVisible(logowanietrue)
    guiSetVisible(rejkatrue)
    guiSetVisible(logintrue)
    guiSetVisible(haslotrue)
    guiSetVisible(bladtrue)
    showCursor(true)
    addEventHandler("onClientRender"rootgui1)
    fadeCamera(true)
end)    

addEventHandler("onClientGUIClick"logowanie, function(button)
    if (button ~= "left"then return end
        triggerServerEvent("onRequestLogin"getLocalPlayer(), guiGetText(login), guiGetText(haslo))
end)

addEventHandler ("onClientGUIClick"rejka, function(button)
    if (button ~= "left"then return end
        triggerServerEvent("onRequestRegister"getLocalPlayer(), guiGetText(login), guiGetText(haslo))
end)

addEventHandler ("onClientGUIClick"stworzpostac, function(button)
    if (button ~= "left"then return end
        if guiGetText(Wiek) == "" or string.len(tonumber(guiGetText(Wiek))) > 2 then triggerEvent("bladPostaci"localPlayer"Podaj wiek!") return end
            if guiGetText(Imie) == "" or string.len(tostring(guiGetText(Imie))) > 17 or string.len(tostring(guiGetText(Imie))) < 6 then triggerEvent("bladPostaci"localPlayer"Podaj imie i nazwisko!") return end
                triggerServerEvent("savePlayer"getLocalPlayer(), tostring(guiGetText(Imie)), tonumber(guiGetText(Wiek)))
                
end)

addEvent('show:panel_tworzenia',true)
addEventHandler('show:panel_tworzenia'getRootElement(), function()
    removeEventHandler("onClientRender"rootgui1)
        guiSetVisible (logowaniefalse)
        guiSetVisible (rejkafalse)
        guiSetVisible (loginfalse)
        guiSetVisible (haslofalse)
        guiSetVisible (bladfalse)    
    
    addEventHandler('onClientRender'getRootElement(), panel_tworzenia)
        guiSetVisible(Imietrue)
        guiSetVisible(Wiektrue)
        guiSetVisible(stworzpostactrue)
        guiSetVisible(bladpostacitrue)
end)

addEvent("hide:loginpanel"true)
addEventHandler("hide:loginpanel"getRootElement(), function()
    setCameraTarget(localPlayer)
    setPlayerHudComponentVisible("all"true)
    removeEventHandler("onClientRender"rootgui1)
        guiSetVisible (logowaniefalse)
        guiSetVisible (rejkafalse)
        guiSetVisible (loginfalse)
        guiSetVisible (haslofalse)
        guiSetVisible (bladfalse)    
    showChat(true)
    showCursor(false)
    removeCamHandler()
end)

addEvent("hide:panel_tworzenia"true)
addEventHandler("hide:panel_tworzenia"getRootElement(), function()
    setCameraTarget(localPlayer)
    setPlayerHudComponentVisible("all"true)
    guiSetVisible(Imiefalse)
    guiSetVisible(Wiekfalse)
    guiSetVisible(stworzpostacfalse)
    guiSetVisible(bladpostacifalse)    
    showChat(true)
    showCursor(false)
    removeCamHandler()
    removeEventHandler("onClientRender"rootpanel_tworzenia)
end)

addEvent("bladLogowania"true)
addEventHandler("bladLogowania"getRootElement(), function(komunikat)
    if not komunikat then return end
        guiSetText(bladtostring(komunikat))
end)

addEvent("bladPostaci"true)
addEventHandler("bladPostaci"getRootElement(), function(komunikat)
    if not komunikat then return end
        guiSetText(bladpostacitostring(komunikat))
end)


Ostatnio zmieniony przez Wilq 2018-09-06, 20:39, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowania/tworzenia
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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