Wysłany: 2018-03-11, 01:03
warzywko13
Wiek: 26 Na forum: 3719 dni Posty: 6
Nick w MP: warzywko13
Czy m?g?by mi kto? pom?c albo chocia? powiedzie? gdzie zawar?em b??d w tym skrypcie. Jest to skrypt na logowanie problem polega nast?puj?co: skrypt nie wy?wietla gui graczowi na ekranie. Co ciekawe kiedy usun? wszystko poza gui to magicznie gui si? wy?wietla/dzia?a.
GUIEditor = {
button = {},
window = {},
label = {},
edit = {}
}
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
local screenW , screenH = guiGetScreenSize ()
GUIEditor . window [ 1 ] = guiCreateWindow (( screenW - 585 ) / 2 , ( screenH - 1080 ) / 2 , 585 , 1080 , "" , false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
GUIEditor . edit [ 1 ] = guiCreateEdit (( 585 - 331 ) / 2 , ( 1080 - 46 ) / 2 , 331 , 46 , "" , false , GUIEditor . window [ 1 ])
GUIEditor . edit [ 2 ] = guiCreateEdit ( 126 , 423 , 332 , 42 , "" , false , GUIEditor . window [ 1 ])
GUIEditor . button [ 1 ] = guiCreateButton ( 67 , 690 , 191 , 70 , "Zaloguj" , false , GUIEditor . window [ 1 ])
GUIEditor . button [ 2 ] = guiCreateButton ( 312 , 691 , 190 , 69 , "Zarejestruj" , false , GUIEditor . window [ 1 ])
GUIEditor . label [ 1 ] = guiCreateLabel ( 117 , 174 , 341 , 107 , "Zombie RPG" , false , GUIEditor . window [ 1 ])
guiSetFont ( GUIEditor . label [ 1 ], "sa-header" )
GUIEditor . label [ 2 ] = guiCreateLabel ( 81 , 433 , 36 , 32 , "Login :" , false , GUIEditor . window [ 1 ])
guiSetFont ( GUIEditor . label [ 2 ], "default-bold-small" )
GUIEditor . label [ 3 ] = guiCreateLabel ( 81 , 527 , 36 , 33 , "Haslo :" , false , GUIEditor . window [ 1 ])
guiSetFont ( GUIEditor . label [ 3 ], "default-bold-small" )
end
)
function buttonClick ()
if source == GUIEditor . button [ 2 ] then
local username = guiGetText ( GUIEditor . edit [ 1 ])
local password = guiGetText ( GUIEditor . edit [ 2 ])
triggerServerEvent ( "registerRequest" , getLocalPlayer (), getLocalPlayer (), username , password )
elseif source == GUIEditor . button [ 1 ] then
local username = guiGetText ( GUIEditor . edit [ 1 ])
local password = guiGetText ( GUIEditor . edit [ 2 ])
triggerServerEvent ( "loginRequest" , getLocalPlayer (), getLocalPlayer (), username , password )
end
end
addEventHandler ( "onClientGUIClick" , GUIEditor . window [ 1 ], buttonClick )
Wysłany: 2018-03-11, 01:23
PenkY
Mapper
Wiek: 23 Na forum: 3464 dni Posty: 223
Nick w MP: penky
Piwa : 2210
Jakie? b??dy w DB3? Je?li tak to pode?lij SS a spr?buj? Ci jako? pom?c
Wysłany: 2018-03-11, 12:50
warzywko13
Wiek: 26 Na forum: 3719 dni Posty: 6
Nick w MP: warzywko13
"PenkY." napisał/a :Jakie? b??dy w DB3? Je?li tak to pode?lij SS a spr?buj? Ci jako? pom?c
raczej tak w db3 nie ma problem?w mo?e jeszcze po stronie serwera co? znajdziesz
addEvent ( "registerRequest" , true )
function registerRequest ( player , username , password )
local acount = getAccount ( username )
if acount == false then
local ip = getPlayerIP ( player )
local serial = getPlayerSerial ( player )
-- local variables
exports . mysql : _Exec ( "insert into users(username,password,ip,serial) values (?,?,?,?)" , username , password , ip , serial )
local addAccount = addAccount ( tostring ( username ), tostring ( password ))
if addAccount then
outputDebugString ( "Stworzyles konto o nazwie " .. username )
else
outputDebugString ( "Ktos juz ma konto o tej nazwie" )
end
end
end
addEventHandler ( "registerRequest" , getRootElement (), registerRequest )
addEvent ( "loginRequest" , true )
function loginRequest ( player , username , password )
local check = exports . mysql : _QuerySingle ( "select * from users where username = ? " , username )
if check then
local checkPass = check . password
if ( checkPass == password ) then
logIn ( player , getAccount ( username ), tostring ( password ))
triggerClientEvent ( player , "showHide" , getRootElement ())
outputDebugString ( "Zalogowales sie" )
end
end
end
addEventHandler ( "loginRequest" , getRootElement (), loginRequest )
Wysłany: 2018-03-11, 14:25
NeX.
Calm Story
Wiek: 26 Na forum: 3643 dni Posty: 56
Nick w MP: NeX
Piwa : 36
local k_j = {}
local sw , sh = guiGetScreenSize ()
k_j . window = guiCreateWindow ( sw / 2 -( 585 / 2 ), sh / 2 -( 1080 / 2 ), 585 , 1080 , "" , false )
guiWindowSetSizable ( k_j . window , false )
k_j . edit1 = guiCreateEdit (( 585 - 331 )/ 2 ,( 108 - 46 )/ 2 , 331 , 46 , "" , false , k_j . window )
k_j . edit2 = guiCreateEdit ( 126 , 423 , 332 , 42 , "" , false , k_j . window )
k_j . btn1 = guiCreateButton ( 67 , 690 , 191 , 70 , "Zaloguj" , false , k_j . window )
k_j . btn2 = guiCreateButton ( 312 , 691 , 190 , 69 , "Zarejestruj" , false , k_j . window )
k_j . lbl1 = guiCreateLabel ( 117 , 174 , 341 , 107 , "Zombie RPG" , false , k_j . window )
guiSetFont ( k_j . lbl1 , "sa-header" )
k_j . lbl2 = guiCreateLabel ( 81 , 433 , 36 , 32 , "Login :" , false , k_j . window )
guiSetFont ( k_j . lbl2 , "default-bold-small" )
k_j . lbl3 = guiCreateLabel ( 81 , 527 , 36 , 33 , "Haslo :" , false , k_j . window )
guiSetFont ( k_j . lbl3 , "default-bold-small" )
guiSetVisible ( k_j . window , false )
addEventHandler ( "onClientResourceStart" , resourceRoot ,function()
if k_j . window and isElement ( k_j . window ) then
guiSetVisible ( k_j . window , true )
showCursor ( true )
end
end )
addEventHandler ( "onClientGUIClick" , resourceRoot ,function()
if source == k_j . btn2 then
local username = guiGetText ( k_j . edit1 )
local password = guiGetText ( k_j . edit2 )
triggerServerEvent ( "registerRequest" , getLocalPlayer (), getLocalPlayer (), username , password )
elseif source == k_j . btn1 then
local username = guiGetText ( k_j . edit1 )
local password = guiGetText ( k_j . edit2 )
triggerServerEvent ( "loginRequest" , getLocalPlayer (), getLocalPlayer (), username , password )
end
end )
Prosz? ;>
Podpis
Wykonuję zasoby programistyczne w języku lua. Osoby zainteresowane proszone są o kontakt.
[email protected]
Tagi: skrypt :: logowanie
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: