xSquiter02
Wiek: 30 Na forum: 3852 dni Posty: 13
Nick w MP: xSquiter
Witajcie, napisa?em skrypt na panel logowania na m?j serwer.
Wszystko dzia?a dzia?a dobrze, do momentu gdy w??cz? jaki? inny skrypt.
Po w??czeniu oboj?tnie jakiego skryptu ca?e hud znika i pokazuje si? tylko kursor i nie mo?na nic zrobi?.
Server . lua
addEvent ( "sprobujZalogowac" , true )
addEvent ( "sprobujZarejstrowac" , true )
addEventHandler ( "onClientResourceStart" , root ,
function()
local gt = setGameType ()
setGameType ( "BestLife" )
local time = getRealTime ()
end
)
addEventHandler ( "sprobujZalogowac" , root ,
function( login , passw )
if getAccount ( login ) then
local acc = getAccount ( login , passw )
if acc then
logIn ( source , acc , passw )
else
triggerClientEvent ( source , "onClientWrongLogin" , root , "Podano z?e has?o!" )
end
else
triggerClientEvent ( source , "onClientWrongLogin" , root , "Podano z?y login!" )
end
end
)
addEventHandler ( "onPlayerLogin" , root ,
function()
setCameraTarget ( source , source )
showChat ( source , true )
showCursor ( source , false )
spawnPlayer ( source , - 1966.9000244141 , 890.79998779297 , 42.099998474121 , 0.0 , 0 )
setPlayerHudComponentVisible ( source , "all" , false )
triggerClientEvent ( source , "onClientLoginSuccess" , root )
end
)
client . lua
addEvent ( "onClientWrongLogin" , true )
addEvent ( "onClientLoginSuccess" , true )
local screenW , screenH = guiGetScreenSize ()
local winlogin = guiCreateWindow ( 0 , 0 , 550 , 780 , "Logowanie" , false ) -- okno logowania
local zaloguj = guiCreateButton ( 40 , 625 , 220 , 100 , "Zaloguj" , false , winlogin ) -- przycisk zaloguj
local zarejstruj = guiCreateButton ( 295 , 625 , 220 , 100 , "Rejstracja" , false , winlogin ) -- przycisk zarejstruj
local editlogin = guiCreateEdit ( 25 , 340 , 495 , 50 , "" , false , winlogin ) -- miejsce na login
local editpassw = guiCreateEdit ( 25 , 440 , 495 , 50 , "" , false , winlogin ) -- miejsce na haslo
local labellogin = guiCreateLabel ( 25 , 325 , 120 , 20 , "Nazwa u?ytkownika" , false , winlogin )
local labelpassw guiCreateLabel ( 30 , 425 , 120 , 20 , "Has?o" , false , winlogin )
local ErrorL = guiCreateLabel ( 35 , 500 , 150 , 20 , "" , false , winlogin )
local colorL = guiLabelSetColor ( ErrorL , 255 , 0 , 0 )
-- L O G O W A N I E
-- R E J S T R A C J A
local winrejstracja = guiCreateWindow ( 0 , 0 , 550 , 780 , "Rejstracja" , false ) -- okno rejstracji
local relogin = guiCreateButton ( 295 , 625 , 220 , 100 , "Zarejstruj" , false , winrejstracja ) -- przycisk rejstracji
local reWroc = guiCreateButton ( 40 , 625 , 220 , 100 , "<<Wr?? do okna logowania" , false , winrejstracja )
local reLEdit = guiCreateEdit ( 25 , 340 , 495 , 50 , "" , false , winrejstracja ) -- login
local rePassw1 = guiCreateEdit ( 25 , 440 , 495 , 50 , "" , false , winrejstracja ) -- haslo
local reLabel = guiCreateLabel ( 25 , 325 , 120 , 20 , "Nazwa u?ytkownika" , false , winrejstracja )
local reLabel1 = guiCreateLabel ( 30 , 425 , 120 , 20 , "Has?o" , false , winrejstracja )
-- R E J S T R A C J A
guiSetVisible ( winrejstracja , false )
guiWindowSetMovable ( winlogin , false ) -- w ?? cza / wy ? acza przemieszczanie
guiWindowSetSizable ( winlogin , false ) -- w ?? cza / wy ? acza rozszerzanie
guiEditSetMasked ( editpassw , true )
guiEditSetMasked ( rePassw1 , true )
guiWindowSetMovable ( winrejstracja , false )
guiWindowSetSizable ( winrejstracja , false )
addEventHandler ( "onClientGUIClick" , zarejstruj ,
function( )
guiSetVisible ( winlogin , false )
guiSetVisible ( winrejstracja , true )
end , false
)
addEventHandler ( "onClientGUIClick" , reWroc ,
function( )
guiSetVisible ( winlogin , true )
guiSetVisible ( winrejstracja , false )
end , false
)
function setErrorString ( errorString )
guiSetText ( ErrorL , errorString )
end
addEventHandler ( "onClientWrongLogin" , root ,
function( errorString )
if errorString then
setErrorString ( errorString )
end
end
)
addEventHandler ( "onClientLoginSuccess" , root ,
function()
destroyElement ( winlogin )
destroyElement ( winrejstracja )
end
)
addEventHandler ( "onClientResourceStart" , root ,
function( )
showChat ( false )
setPlayerHudComponentVisible ( "all" , true )
showCursor ( true )
fadeCamera ( true )
end
)
addEventHandler ( "onClientGUIClick" , zaloguj ,
function( btn , state )
if btn == "left" and state == "up" then
local login = guiGetText ( editlogin )
local pass = guiGetText ( editpassw )
if login ~= "" and pass ~= "" then
triggerServerEvent ( "sprobujZalogowac" , localPlayer , login , pass )
else
setErrorString ( "Uzupe?nij wszystkie pola!" )
end
end
end , false
)