vicuuus
Wiek: 25 Na forum: 4006 dni Posty: 63
Piwa : 11
Witam
[you]
, potrzebuje pomocy z gui. Chcia?bym aby zamiast obrazka by?a zwyk?a kamera, mianowicie camera = { 2076.280517578125 , 969.53167724609375 , 37.864288330078125 , 1997.1920166015625 , 1026.97216796875 , 16.755256652832031 },
Oto m?j kod:
logowanie = {}
logowanie . GUI = {
staticimage = {},
button = {},
window = {},
edit = {},
label = {},
image = {},
}
local lastLogin = getTickCount () - 5000
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
logowanie . GUI . image [ 1 ] = guiCreateStaticImage ( 0.0 , 0.0 , 1279.0 , 767.0 , "__images/login.png" , true )
guiSetEnabled ( logowanie . GUI . image [ 1 ], false )
logowanie . GUI . window [ 1 ] = guiCreateLabel ( 519 , 203 , 310 , 284 , _t ( "PANEL LOGOWANIA" ), false )
guiLabelSetColor ( logowanie . GUI . window [ 1 ], 221 , 221 , 221 )
guiLabelSetHorizontalAlign ( logowanie . GUI . window [ 1 ], "center" , false )
guiLabelSetVerticalAlign ( logowanie . GUI . window [ 1 ], "center" )
centerWindow ( logowanie . GUI . window [ 1 ])
guiSetAlpha ( logowanie . GUI . window [ 1 ], 0.7 )
guiWindowSetSizable ( logowanie . GUI . window [ 1 ], false )
logowanie . GUI . staticimage [ 1 ] = guiCreateStaticImage ( 0.03 , 0.09 , 0.34 , 0.39 , "__images/lock.png" , true , logowanie . GUI . window [ 1 ])
logowanie . GUI . label [ 1 ] = guiCreateLabel ( 0.04 , 0.53 , 0.23 , 0.11 , _t ( "LOGIN:" ), true , logowanie . GUI . window [ 1 ])
guiSetFont ( logowanie . GUI . label [ 1 ], "default-bold-small" )
guiLabelSetVerticalAlign ( logowanie . GUI . label [ 1 ], "center" )
logowanie . GUI . label [ 2 ] = guiCreateLabel ( 0.04 , 0.64 , 0.23 , 0.12 , _t ( "HAS?O:" ), true , logowanie . GUI . window [ 1 ])
guiSetFont ( logowanie . GUI . label [ 2 ], "default-bold-small" )
guiLabelSetVerticalAlign ( logowanie . GUI . label [ 2 ], "center" )
logowanie . GUI . edit [ 1 ] = guiCreateEdit ( 0.28 , 0.54 , 0.66 , 0.11 , removeHEXFromString ( tostring ( getPlayerName ( localPlayer ))), true , logowanie . GUI . window [ 1 ])
logowanie . GUI . staticimage [ 2 ] = guiCreateStaticImage ( 0.85 , 0.13 , 0.13 , 0.87 , "__images/user.png" , true , logowanie . GUI . edit [ 1 ])
guiSetAlpha ( logowanie . GUI . staticimage [ 2 ], 0.70 )
logowanie . GUI . edit [ 2 ] = guiCreateEdit ( 0.28 , 0.65 , 0.66 , 0.11 , "" , true , logowanie . GUI . window [ 1 ])
logowanie . GUI . staticimage [ 3 ] = guiCreateStaticImage ( 0.84 , 0.07 , 0.14 , 0.93 , "__images/lock.png" , true , logowanie . GUI . edit [ 2 ])
guiSetAlpha ( logowanie . GUI . staticimage [ 3 ], 0.70 )
logowanie . GUI . button [ 1 ] = guiCreateButton ( 0.03 , 0.81 , 0.46 , 0.15 , "" , true , logowanie . GUI . window [ 1 ])
guiSetProperty ( logowanie . GUI . button [ 1 ], "NormalTextColour" , "FFAAAAAA" )
logowanie . GUI . staticimage [ 4 ] = guiCreateStaticImage ( 0.03 , 0.02 , 0.25 , 0.98 , "__images/ok.png" , true , logowanie . GUI . button [ 1 ])
logowanie . GUI . label [ 3 ] = guiCreateLabel ( 0.34 , 0.00 , 0.66 , 0.95 , _t ( "Zaloguj lub\nZarejestruj" ), true , logowanie . GUI . button [ 1 ])
guiSetFont ( logowanie . GUI . label [ 3 ], "default-bold-small" )
guiLabelSetHorizontalAlign ( logowanie . GUI . label [ 3 ], "center" , false )
guiLabelSetVerticalAlign ( logowanie . GUI . label [ 3 ], "center" )
logowanie . GUI . label [ 5 ] = guiCreateLabel ( 0.40 , 0.09 , 0.54 , 0.39 , _t ( "Witaj!\n\nZarejestruj/Zaloguj Si?!\n\nWi?kszo?? funkcji serwera\ndost?pna jest dopiero \npo zalogowaniu." ), true , logowanie . GUI . window [ 1 ])
guiSetFont ( logowanie . GUI . label [ 5 ], "default-bold-small" )
guiEditSetMaxLength ( logowanie . GUI . edit [ 1 ], 22 )
guiEditSetMaxLength ( logowanie . GUI . edit [ 2 ], 30 )
guiEditSetMasked ( logowanie . GUI . edit [ 2 ], true )
guiSetEnabled ( logowanie . GUI . label [ 3 ], false )
guiSetEnabled ( logowanie . GUI . label [ 4 ], false )
guiSetEnabled ( logowanie . GUI . staticimage [ 5 ], false )
guiSetEnabled ( logowanie . GUI . label [ 5 ], false )
guiSetEnabled ( logowanie . GUI . label [ 3 ], false )
guiSetEnabled ( logowanie . GUI . staticimage [ 4 ], false )
guiSetEnabled ( logowanie . GUI . staticimage [ 3 ], false )
guiSetEnabled ( logowanie . GUI . staticimage [ 2 ], false )
guiSetEnabled ( logowanie . GUI . staticimage [ 1 ], false )
guiSetEnabled ( logowanie . GUI . button [ 2 ], false )
addEventHandler ( "onClientGUIClick" , logowanie . GUI . button [ 1 ],
function()
if getTickCount () - lastLogin < 5000 then createInfoBoxClient ( 20 , "(drawY/5.0)*2" , "Musisz odczeka? " .. math . floor (( 6000 -( getTickCount ()- lastLogin ))/ 1000 ).. "s. od ostatniej pr?by logowania." , 8000 ) return end
local userLogin = guiGetText ( logowanie . GUI . edit [ 1 ])
local userPassword = guiGetText ( logowanie . GUI . edit [ 2 ])
if userLogin ~= '' and userPassword ~= '' then
lastLogin = getTickCount ()
if string . len ( userLogin ) < 1 then return createInfoBoxClient ( 20 , "(drawY/5.0)*2" , "[Login] musi zawiera? przynajniej jeden znak." , 8000 ) end
if string . len ( userLogin ) > 22 then return createInfoBoxClient ( 20 , "(drawY/5.0)*2" , "[Login] mo?e sk??da? si? maksymalnie z 22 znak?w." , 8000 ) end
if string . len ( userPassword ) < 5 then return createInfoBoxClient ( 20 , "(drawY/5.0)*2" , "[Has?o] musi zawiera? przynajniej 5 znak?w." , 8000 ) end
if string . len ( userPassword ) > 30 then return createInfoBoxClient ( 20 , "(drawY/5.0)*2" , "[Has?o] mo?e sk??da? si? maksymalnie z 30 znak?w." , 8000 ) end
triggerServerEvent ( "clientLoginRegister" , resourceRoot , userLogin , userPassword )
xmlSavePassword ( userLogin , userPassword )
else
createInfoBoxClient ( 20 , "(drawY/5.0)*2" , "Wprowad? [Login] i [Has?o]." , 8000 )
end
end , false )
addEventHandler ( "onClientGUIClick" , logowanie . GUI . button [ 2 ],
function()
cPoZalogowaniu ()
end , false )
guiSetVisible ( logowanie . GUI . window [ 1 ], false )
guiSetVisible ( logowanie . GUI . image [ 1 ], false )
xmlLoadPassword ()
end )
addEvent ( "Client:HideLoginPanel" , true )
addEventHandler ( "Client:HideLoginPanel" , localPlayer ,
function()
cPoZalogowaniu ()
local confirm_sound = playSound ( "__sounds/click_confirm.ogg" )
setSoundVolume ( confirm_sound , 0.3 )
end )