Wysłany: 2017-11-25, 11:18
AspWalczak12
Wiek: 46 Na forum: 3114 dni Posty: 33
Mam problem z podpi?ciem przycisk?w pod kod panelu logowania
Oto gui
GUIEditor = {
button = {},
staticimage = {},
memo = {}
}
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
local screenW , screenH = guiGetScreenSize ()
GUIEditor . staticimage [ 1 ] = guiCreateStaticImage (( screenW - 1280 ) / 2 , ( screenH - 720 ) / 2 , 1280 , 720 , "tlo.png" , false )
tekst1 = guiCreateEdit ( 480 , 383 , 285 , 30 , "" , false , GUIEditor . staticimage [ 1 ])
guiSetAlpha ( tekst1 , 0.75 )
tekst2 = guiCreateEdit ( 480 , 540 , 285 , 30 , "" , false , GUIEditor . staticimage [ 1 ])
guiSetAlpha ( tekst2 , 0.75 )
przycisk1 = guiCreateButton ( 391 , 616 , 203 , 65 , "" , false , GUIEditor . staticimage [ 1 ])
guiSetAlpha ( przycisk1 , 0.25 )
przycisk2 = guiCreateButton ( 671 , 617 , 203 , 64 , "" , false , GUIEditor . staticimage [ 1 ])
guiSetAlpha ( przycisk2 , 0.25 )
if data . info then dxDrawText ( data . info , sx * 252 / 1024 , sy * 272 / 768 , sx * 800 / 1024 , sy * 255 / 768 , tocolor ( 140 , 0 , 255 , 255 ), 2.00 , "default" , "center" , "center" , false ) end
end
A to kod oryginalny kod ze starym gui po stronie clienta
local sx , sy = guiGetScreenSize ()
local data ={ showed = nil , button ={}, info = nil , misc = nil , }
function isMouseIn ( psx , psy , pssx , pssy , abx , aby )
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
local dist = 10
local angler = 0
function getPointFromDistanceRotation ( x , y , dist , angler )
local a = math . rad ( 20 - angler )
local dx = math . cos ( a ) * dist ;
local dy = math . sin ( a ) * dist ;
return x + dx , y + dy ;
end
function renderLoginBox ()
dxDrawImage ( 0 , 0 , 1366 , 775 , "tlo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawLine ( 415 - 1 , 175 - 1 , 415 - 1 , 556 , tocolor ( 0 , 51 , 169 , 255 ), 1 , false )
dxDrawLine ( 969 , 175 - 1 , 415 - 1 , 175 - 1 , tocolor ( 0 , 51 , 169 , 255 ), 1 , false )
dxDrawLine ( 415 - 1 , 556 , 969 , 556 , tocolor ( 0 , 51 , 169 , 255 ), 1 , false )
dxDrawLine ( 969 , 556 , 969 , 175 - 1 , tocolor ( 0 , 51 , 169 , 255 ), 1 , false )
dxDrawRectangle ( 415 , 175 , 554 , 381 , tocolor ( 0 , 0 , 0 , 200 ), false )
if data . info then dxDrawText ( data . info , sx * 252 / 1024 , sy * 222 / 768 , sx * 800 / 1024 , sy * 255 / 768 , tocolor ( 237 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false ) end
dxDrawText ( "Login U?ytkownika:" , 522 , 348 , 788 , 394 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
dxDrawText ( "Has?o U?ytkownika:" , 522 , 440 , 788 , 476 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
if not isMouseIn ( 778 , 375 , 165 , 42 ) then dxDrawRectangle ( 778 , 375 , 165 , 42 , tocolor ( 35 , 35 , 35 , 193 ), false )
else dxDrawRectangle ( 778 , 375 , 165 , 42 , tocolor ( 0 , 51 , 169 , 150 ), false ) end
if not isMouseIn ( 778 , 470 , 165 , 40 ) then dxDrawRectangle ( 778 , 470 , 165 , 40 , tocolor ( 35 , 35 , 35 , 193 ), false )
else dxDrawRectangle ( 778 , 470 , 165 , 40 , tocolor ( 0 , 51 , 169 , 150 ), false ) end
dxDrawText ( "Zaloguj" , 836 , 389 , 979 , 422 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
dxDrawText ( "Zarejestruj" , 830 , 480 , 1014 , 515 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "left" , "top" , false , false , false , false , false )
dxDrawImage ( 505 , 200 , 352 , 82 , "og.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
local x , y = getPointFromDistanceRotation ( 1479.85486 ,- 1700.9080 , dist , angler )
setCameraMatrix ( x , y , 50 )
angler =( angler + 0.1 )
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
if isMouseIn ( 778 , 375 , 165 , 42 ) and data . showed then
local login = guiGetText ( data . button [ 1 ])
local pass = guiGetText ( data . button [ 2 ])
if string . len ( login ) < 2 or string . len ( pass ) < 2 then
data . info = " "
return
end
triggerServerEvent ( "logging:checkAccount" , resourceRoot , login , pass )
end
if isMouseIn ( 778 , 470 , 165 , 40 ) and data . showed then
local login = guiGetText ( data . button [ 1 ])
local pass = guiGetText ( data . button [ 2 ])
if string . len ( login ) < 2 or string . len ( pass ) < 2 then
data . info = " "
return
end
if string . len ( login ) > 22 or string . len ( pass ) > 30 then
data . info = "Login/Has?o musi mie? mniej ni? 22/30 znak?w."
return
end
triggerServerEvent ( "logging:newAccount" , resourceRoot , login , pass )
end
end
end )
addEvent ( "logging:result" , true )
addEventHandler ( "logging:result" , resourceRoot , function( value , info )
if not info then info = "" end
if value then
data . showed = false
showZones ( data . misc )
destroyElement ( data . button [ 1 ])
destroyElement ( data . button [ 2 ])
removeEventHandler ( "onClientRender" , root , renderLoginBox )
else
data . info = tostring ( info )
setTimer (function() data . info = nil end , 3000 , 1 )
end
end )
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
showChat ( false )
showCursor ( true )
fadeCamera ( true )
data . showed = true
showPlayerHudComponent ( "all" , false )
setElementAlpha ( localPlayer , 0 )
data . misc = playSound ( "misc/intro.mp3" , true )
setSoundVolume ( data . misc , 1.0 )
guiSetInputMode ( "no_binds_when_editing" )
setElementData ( localPlayer , "status" , "Loguje si?" )
setElementData ( localPlayer , "player:logged" , false )
addEventHandler ( "onClientRender" , root , renderLoginBox )
data . button [ 1 ] = guiCreateEdit ( 444 , 375 , 292 , 39 , "" , false )
data . button [ 2 ] = guiCreateEdit ( 444 , 470 , 292 , 40 , "" , false )
end )
addEvent ( "hideLoginWindow" , true )
addEventHandler ( "hideLoginWindow" , getResourceRootElement ( getThisResource ()), hideLoginWindow )
Za pomoc dam zime piwko i respekt
Wysłany: 2017-11-25, 14:13
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Do button?w stosujesz event
Wysłany: 2017-11-25, 16:59
AspWalczak12
Wiek: 46 Na forum: 3114 dni Posty: 33
Zamieni?em
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
if isMouseIn ( sx * 305 / 2524 , sy * 506 / 1188 , sx * 200 / 1024 , sy * 45 / 768 ) and data . showed then
local login = guiGetText ( data . button [ 1 ])
local pass = guiGetText ( data . button [ 2 ])
if string . len ( login ) < 2 or string . len ( pass ) < 2 then
data . info = "Wype?nij wszystkie pola!"
return
end
triggerServerEvent ( "logging:checkAccount" , resourceRoot , login , pass )
end
if isMouseIn ( sx * 535 / 764 , sy * 506 / 1200 , sx * 200 / 1024 , sy * 45 / 768 ) and data . showed then
local login = guiGetText ( data . button [ 1 ])
local pass = guiGetText ( data . button [ 2 ])
if string . len ( login ) > 22 or string . len ( pass ) > 22 and string . len ( login ) < 3 or string . len ( pass ) < 3 then
data . info = "Login/Has?o musz? mie? mniej ni? od 3 do 22 znak?w."
return
end
triggerServerEvent ( "logging:newAccount" , resourceRoot , login , pass )
end
end
end )
na
addEventHandler ( "onClientGUIClick" , przycisk1 , tekst1 , false )
if przycisk1 == "left" then
local login = guiGetText ( tekst1 )
local pass = guiGetText ( tekst2 )
if string . len ( login ) < 2 or string . len ( pass ) < 2 then
data . info = "Wypenij wszystkie pola"
return
end
triggerServerEvent ( "logging:checkAccount" , resourceRoot , login , pass )
end
local login = guiGetText ( tekst1 )
local pass = guiGetText ( tekst2 )
if string . len ( login ) > 22 or string . len ( pass ) > 22 and string . len ( login ) < 3 or string . len ( pass ) < 3 then
data . info = "Login/Has?o musz? mie? mniej ni? od 3 do 22 znak?w."
return
end
triggerServerEvent ( "logging:newAccount" , resourceRoot , login , pass )
end
end
end )
i nie dzia?a
Wysłany: 2017-11-26, 12:32
psychol.
Wiek: 23 Na forum: 3502 dni Posty: 225
Nick w MP: psychol.
Piwa : 2998
addEventHandler ( "onClientGUIClick" , przycisk1 , tekst1 , false )
zmie? na:
addEventHandler ( "onClientGUIClick" , przycisk1 , function()
Wysłany: 2017-11-26, 16:38
AspWalczak12
Wiek: 46 Na forum: 3114 dni Posty: 33
Wysłany: 2017-11-26, 20:25
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
AspWalczak12 ,
1. Usu? "if przycisk1=="left" then" i jednego enda.
2. Nikt za Ciebie ci?gle poprawia? skryptu nie b?dzie.
3. Jakie? db3?
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Tagi: nie :: moge :: podpiąc :: guzików :: pod :: gui
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: