Wysłany: 2019-01-12, 11:13
Fl!k
Wiek: 26 Na forum: 3593 dni Posty: 162
Piwa : 18
Witam posiadam panel z serwera NiceLife 5.0 przerobi?em go lecz nie wiem jak zmieni? miejsce tego co sie klika aby wej?? np. do logowania lub rejestrowania na inne miejsce
Podaje wam c_logging
if getElementData ( localPlayer , "player:uid" ) then return end
local root = getRootElement ()
local blur = exports [ 'blur' ]
local czcionka = dxCreateFont ( "font/1.ttf" , 25 )
local czcionka2 = dxCreateFont ( "font/1.ttf" , 16 )
local czcionka3 = dxCreateFont ( "font/1.ttf" , 12 )
local czcionka4 = dxCreateFont ( "font/1.ttf" , 10 )
local resourceRoot = getResourceRootElement ( getThisResource ())
local screenW , screenH = guiGetScreenSize ()
local screenWidth , screenHeight = guiGetScreenSize ()
local blurStrength = 2
local myScreenSource = dxCreateScreenSource ( screenWidth , screenHeight )
blurShader , blurTec = dxCreateShader ( "shaders/BlurShader.fx" )
sx , sy = guiGetScreenSize ()
xedit , yedit = ( sx / 1366 ), ( sy / 768 )
messages = {}
editBox = {}
editBox . __index = editBox
editBox . instances = {}
function renderblur ()
if blur == true then
dxUpdateScreenSource ( myScreenSource )
dxSetShaderValue ( blurShader , "ScreenSource" , myScreenSource );
dxSetShaderValue ( blurShader , "BlurStrength" , blurStrength );
dxSetShaderValue ( blurShader , "UVSize" , screenWidth , screenHeight );
dxDrawImage ( 0 , 0 , screenWidth , screenHeight , blurShader )
end
end
addEventHandler ( "onClientRender" , root , renderblur )
addEventHandler ( "onClientResourceStop" , resourceRoot ,
function()
if ( blurShader ) and blur then
destroyElement ( blurShader )
blurShader = nil
end
end )
local sx , sy = guiGetScreenSize ()
local data ={ showed = nil , button ={}, info = nil , misc = nil , tick = getTickCount () }
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 = 400
local angler = 0
function getPointFromDistanceRotation ( x , y , dist , angler )
local a = math . rad ( 270 - angler )
local dx = math . cos ( a ) * dist ;
local dy = math . sin ( a ) * dist ;
return x + dx , y + dy ;
end
mojeW , mojeH = 1366 , 768
sW , sH = guiGetScreenSize ()
w , h = ( sW / mojeW ), ( sH / mojeH )
aktualnie = "glowny"
function renderLoginBox ()
setTime ( 6 , 0 )
blur = false
if aktualnie == "glowny" then
if isMouseIn ( screenW * 2.3014 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 ) then
window ( screenW * 2.3014 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 , tocolor ( 0 , 0 , 0 , 170 ), false )
else
roundedRectangle ( screenW * 22.3014 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 , tocolor ( 0 , 0 , 0 , 170 ), false )
end
if isMouseIn ( screenW * 2.4361 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 ) then
window ( screenW * 2.4361 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 , tocolor ( 0 , 0 , 0 , 170 ), false )
else
roundedRectangle ( screenW * 22.4361 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 , tocolor ( 0 , 0 , 0 , 170 ), false )
end
if isMouseIn ( screenW * 2.5708 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 ) then
window ( screenW * 2.5708 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 , tocolor ( 0 , 0 , 0 , 170 ), false )
else
roundedRectangle ( screenW * 22.5708 , screenH * 0.4633 , screenW * 0.1278 , screenH * 0.0744 , tocolor ( 0 , 0 , 0 , 170 ), false )
end
dxDrawImage ( 0 * w , 0 * h , 1380 * w , 820 * h , "img/tlo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 0 * w , 0 * h , 1280 * w , 720 * h , "img/glowna.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
elseif aktualnie == "logowanie" then
dxDrawImage ( 0 * w , 0 * h , 1380 * w , 820 * h , "img/tlo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 0 * w , 0 * h , 1280 * w , 720 * h , "img/log.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Login" , screenW * 0.3022 , screenH * 0.4789 , screenW * 0.4451 , screenH * 0.3889 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Has?o" , screenW * 0.3022 , screenH * 0.5256 , screenW * 0.4451 , screenH * 0.4756 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "center" , "center" , false , false , false , false , false )
-- dxDrawText ( "has?ox2" , screenW * 0.2922 , screenH * 0.5833 , screenW * 0.4451 , screenH * 0.5633 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "center" , "center" , false , false , false , false , false )
elseif aktualnie == "rejestracja" then
dxDrawImage ( 0 * w , 0 * h , 1380 * w , 820 * h , "img/tlo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 0 * w , 0 * h , 1280 * w , 720 * h , "img/rej.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Login" , screenW * 0.3022 , screenH * 0.4789 , screenW * 0.4451 , screenH * 0.3889 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Has?o" , screenW * 0.3022 , screenH * 0.5256 , screenW * 0.4451 , screenH * 0.4756 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "center" , "center" , false , false , false , false , false )
dxDrawText ( "has?ox2" , screenW * 0.2922 , screenH * 0.5833 , screenW * 0.4451 , screenH * 0.5633 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "center" , "center" , false , false , false , false , false )
elseif aktualnie == "regulamin" then
dxDrawImage ( 0 * w , 0 * h , 1380 * w , 820 * h , "img/tlo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( 0 * w , 0 * h , 1280 * w , 720 * h , "img/reg.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "tu cos dac" , screenW * 0.3688 , screenH * 0.3222 , screenW * 0.6299 , screenH * 0.6344 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , czcionka3 , "left" , "top" , false , false , false , false , false )
end
if getTickCount ()< data . tick then
dxDrawText ( data . info , screenW * 0.3626 , screenH * 0.5734 , screenW * 0.6376 , screenH * 0.6368 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , czcionka4 , "center" , "center" , false , false , false , false , false )
dxDrawText ( data . info , screenW * 0.3625 , screenH * 0.5733 , screenW * 0.6375 , screenH * 0.6367 , tocolor ( 255 , 0 , 0 , 255 ), 1.00 , czcionka4 , "center" , "center" , false , false , false , false , false )
end
local x , y = getPointFromDistanceRotation (- 1351.51 , 514.52 , dist , angler )
setCameraMatrix ( x , y , 80 + 0.9 , 1207.76 , - 1249.49 , 80 + 0.9 )
angler =( angler + 0.1 )
for k , self in pairs ( editBox . instances ) do
if self . visible then
local px , py , pw , ph = self : getPosition ()
local text = self . masked and string . gsub ( self . text , "." , "•" ) or self . text
local alignX = dxGetTextWidth ( text , self . scale , self . font ) <= pw and "left" or "right"
roundedRectangle ( px , py , pw , ph , tocolor ( unpack ( self . color )), tocolor ( 255 , 0 , 40 , 255 ))
dxDrawText ( text , px + xedit * 5 , py , px - xedit * 5 + pw , py + ph , tocolor ( unpack ( self . textColor )), self . scale , czcionka3 , alignX , "center" , true )
if self . input and dxGetTextWidth ( text , self . scale , self . font ) <= pw then
local lx = dxGetTextWidth ( text , self . scale , czcionka3 )+ px + xedit * 8
local lx = dxGetTextWidth ( text , self . scale , czcionka3 )+ px + xedit * 8
dxDrawLine ( lx , py + yedit * 10 , lx , py + ph - yedit * 10 , tocolor ( 255 , 255 , 255 , math . abs ( math . sin ( getTickCount ()/ 300 ))* 200 ), 2 )
end
end
end
if getKeyState ( "backspace" ) then
for k , self in pairs ( editBox . instances ) do
if self . visible and self . input then
if not keyState then
keyState = getTickCount () + 400
self . text = string . sub ( self . text , 1 , string . len ( self . text )- 1 )
elseif keyState and keyState < getTickCount () then
keyState = getTickCount ()+ 100
self . text = string . sub ( self . text , 1 , string . len ( self . text )- 1 )
end
return
end
end
keyState = nil
end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
if isMouseIn ( screenW * 0.3092 , screenH * 0.6244 , screenW * 0.1125 , screenH * 0.0578 ) and data . showed then
if aktualnie == "logowanie" then
local login = g . user . text
local pass = g . pass . text
if string . len ( login ) > 22 or string . len ( pass ) > 22 and string . len ( login ) < 3 or string . len ( pass ) < 3 then
data . info = "Login/haslo musza miec od 3 do 22 znakow."
data . tick = getTickCount ()+ 3500
return
end
triggerServerEvent ( "logging:checkAccount" , resourceRoot , login , pass )
end
if aktualnie == "rejestracja" then
local login = g . user . text
local pass = g . pass . text
local pass2 = g . pass2 . text
if string . len ( login ) > 22 or string . len ( pass ) > 22 and string . len ( login ) < 3 or string . len ( pass ) < 3 then
data . info = "Login/haslo musza miec od 3 do 22 znakow."
data . tick = getTickCount ()+ 3500
return
end
if pass ~= pass2 then
data . info = "Podane has?a nie zgadzaj? si?!"
data . tick = getTickCount ()+ 3500
return
end
triggerServerEvent ( "logging:newAccount" , resourceRoot , login , pass )
end
elseif isMouseIn ( screenW * 0.5304 , screenH * 0.6244 , screenW * 0.1125 , screenH * 0.0578 ) and data . showed and aktualnie ~= "glowny" then
aktualnie = "glowny"
g . user . visible = false
g . pass . visible = false
g . pass2 . visible = false
elseif isMouseIn ( screenW * 0.3514 , screenH * 0.0500 , screenW * 0.1178 , screenH * 0.1644 ) and aktualnie == "glowny" then
aktualnie = "logowanie"
g . user . visible = true
g . pass . visible = true
-- g . pass2 . visible = true
elseif isMouseIn ( screenW * 0.4861 , screenH * 0.0500 , screenW * 0.1178 , screenH * 0.1644 ) and aktualnie == "glowny" then
aktualnie = "rejestracja"
g . user . visible = true
g . pass . visible = true
g . pass2 . visible = true
elseif isMouseIn ( screenW * 0.4108 , screenH * 0.1000 , screenW * 0.1178 , screenH * 0.1644 ) and aktualnie == "glowny" then
aktualnie = "regulamin"
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 )
-- Usuwamy elementy
local time = getRealTime ()
setTime ( time . hour , time . minute )
g . user . visible = false
g . pass . visible = false
g . pass2 . visible = false
removeEventHandler ( "onClientRender" , root , renderLoginBox )
else
data . info = info
data . tick = getTickCount ()+ 5000
end
end )
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
g = {}
g . user = editBox .new()
g . user : setPosition ( screenW * 0.3951 , screenH * 0.4089 , screenW * 0.1535 , screenH * 0.0500 )
g . user . color = { 255 , 255 , 255 , 220 }
-- g . user . font = czcionka3
g . user . onInput = function()
g . user . color = { 255 , 0 , 40 , 240 }
end
g . user . onOutput = function()
g . user . color = { 255 , 255 , 255 , 220 }
end
g . pass = editBox .new()
g . pass : setPosition ( screenW * 0.3951 , screenH * 0.4756 , screenW * 0.1535 , screenH * 0.0500 )
g . pass . color = { 255 , 255 , 255 , 220 }
-- g . pass . font = czcionka3
g . pass . masked = true
g . pass . onInput = function()
g . pass . color = { 255 , 0 , 40 , 240 }
end
g . pass . onOutput = function()
g . pass . color = { 255 , 255 , 255 , 220 }
end
g . pass2 = editBox .new()
g . pass2 : setPosition ( screenW * 0.3951 , screenH * 0.5433 , screenW * 0.1535 , screenH * 0.0500 )
g . pass2 . color = { 255 , 255 , 255 , 220 }
-- g . pass2 . font = czcionka3
g . pass2 . masked = true
g . pass2 . onInput = function()
g . pass2 . color = { 255 , 0 , 40 , 240 }
end
g . pass2 . onOutput = function()
g . pass2 . color = { 255 , 255 , 255 , 220 }
end
showChat ( false )
showCursor ( true )
fadeCamera ( true )
data . showed = true
setElementAlpha ( localPlayer , 0 )
data . misc = playSound ( "misc/intro.mp3" , true )
setSoundVolume ( data . misc , 0.5 )
showPlayerHudComponent ( "all" , false )
guiSetInputMode ( "no_binds_when_editing" )
setElementData ( localPlayer , "status" , "Loguje siê" )
-- setElementData ( localPlayer , "player:logged" , false )
-- data . button [ 1 ]= guiCreateEdit ( 552 * w , 350 * h , 157 * w , 27 * h , "" , false )
-- data . button [ 2 ]= guiCreateEdit ( 752 * w , 350 * h , 157 * w , 27 * h , "" , false )
-- guiEditSetMasked ( data . button [ 2 ], true )
addEventHandler ( "onClientRender" , root , renderLoginBox )
end )
-- custom editboxy
function onClientClick ( button , state , cX , cY )
if not isCursorShowing () then
return
end
if button == "left" and state == "up" then
for k , self in pairs ( editBox . instances ) do
if self . visible then
if self . input then
self . input = nil
self . onOutput ()
end
local x , y , w , h = self : getPosition ()
if isMouseIn ( x , y , w , h ) then
self . input = true
self . onInput ()
end
end
end
end
end
addEventHandler ( "onClientClick" , root , onClientClick )
function onClientCharacter ( character )
if not isCursorShowing () then
return
end
for k , self in pairs ( editBox . instances ) do
if self . visible and self . input then
if ( string . len ( self . text )) < self . maxLength then
self . text = self . text .. character
end
end
end
end
addEventHandler ( "onClientCharacter" , root , onClientCharacter )
function editBox .new()
local self = setmetatable ({}, editBox )
self . text = ""
self . maxLength = 20
self . scale = yedit * 0.8
self . state = "normal"
self . font = "sans"
self . color = { 255 , 255 , 255 , 220 }
self . textColor = { 255 , 255 , 255 , 220 }
table . insert ( editBox . instances , self )
return self
end
function editBox : getPosition ()
return self . x , self . y , self . w , self . h
end
function editBox : setPosition ( x , y , w , h )
self . x , self . y , self . w , self . h = x , y , w , h
return true
end
-- koniec editboxow
function roundedRectangle ( x , y , w , h , color )
dxDrawRectangle ( x , y , w , h , color , false )
dxDrawRectangle ( x + 2 , y - 1 , w - 4 , 1 , color , false )
dxDrawRectangle ( x + 2 , y + h , w - 4 , 1 , color , false )
dxDrawRectangle ( x - 1 , y + 2 , 1 , h - 4 , color , false )
dxDrawRectangle ( x + w , y + 2 , 1 , h - 4 , color , false )
end
function window ( x , y , w , h , color )
local color2 = tocolor ( 255 , 0 , 0 )
roundedRectangle ( x - 2 , y - 2 , w + 4 , h + 4 , color2 , false )
roundedRectangle ( x , y , w , h , color , false )
end
Wysłany: 2019-01-12, 11:21
Query
SyndicateMTA
Wiek: 24 Na forum: 3072 dni Posty: 319
Nick w MP: Query
Piwa : 5257
ten warunek odpowiada za to co si? pojawia po kliknieciu w logowanie
elseif aktualnie == "logowanie" then
ten warunek odpowiada za to co si? pojawia po kliknieciu w rejestrowanie
elseif aktualnie == "rejestracja" then
to odpowiada za przęłączanie si? miedzy dzia?ami
elseif isMouseIn ( screenW * 0.5304 , screenH * 0.6244 , screenW * 0.1125 , screenH * 0.0578 ) and data . showed and aktualnie ~= "glowny" then
aktualnie = "glowny"
g . user . visible = false
g . pass . visible = false
g . pass2 . visible = false
elseif isMouseIn ( screenW * 0.3514 , screenH * 0.0500 , screenW * 0.1178 , screenH * 0.1644 ) and aktualnie == "glowny" then
aktualnie = "logowanie"
g . user . visible = true
g . pass . visible = true
-- g . pass2 . visible = true
elseif isMouseIn ( screenW * 0.4861 , screenH * 0.0500 , screenW * 0.1178 , screenH * 0.1644 ) and aktualnie == "glowny" then
aktualnie = "rejestracja"
g . user . visible = true
g . pass . visible = true
g . pass2 . visible = true
elseif isMouseIn ( screenW * 0.4108 , screenH * 0.1000 , screenW * 0.1178 , screenH * 0.1644 ) and aktualnie == "glowny" then
aktualnie = "regulamin"
end
end
end )
Wysłany: 2019-01-12, 12:02
Fl!k
Wiek: 26 Na forum: 3593 dni Posty: 162
Piwa : 18
Dzieki ale teraz nie dzia?a zaloguj , rejestruj
Wysłany: 2019-01-12, 12:08
Query
SyndicateMTA
Wiek: 24 Na forum: 3072 dni Posty: 319
Nick w MP: Query
Piwa : 5257
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
g = {}
g . user = editBox .new()
g . user : setPosition ( screenW * 0.3951 , screenH * 0.4089 , screenW * 0.1535 , screenH * 0.0500 )
g . user . color = { 255 , 255 , 255 , 220 }
-- g . user . font = czcionka3
g . user . onInput = function()
g . user . color = { 255 , 0 , 40 , 240 }
end
g . user . onOutput = function()
g . user . color = { 255 , 255 , 255 , 220 }
end
g . pass = editBox .new()
g . pass : setPosition ( screenW * 0.3951 , screenH * 0.4756 , screenW * 0.1535 , screenH * 0.0500 )
g . pass . color = { 255 , 255 , 255 , 220 }
-- g . pass . font = czcionka3
g . pass . masked = true
g . pass . onInput = function()
g . pass . color = { 255 , 0 , 40 , 240 }
end
g . pass . onOutput = function()
g . pass . color = { 255 , 255 , 255 , 220 }
end
g . pass2 = editBox .new()
g . pass2 : setPosition ( screenW * 0.3951 , screenH * 0.5433 , screenW * 0.1535 , screenH * 0.0500 )
g . pass2 . color = { 255 , 255 , 255 , 220 }
-- g . pass2 . font = czcionka3
g . pass2 . masked = true
g . pass2 . onInput = function()
g . pass2 . color = { 255 , 0 , 40 , 240 }
end
g . pass2 . onOutput = function()
g . pass2 . color = { 255 , 255 , 255 , 220 }
end za to odpowiadaja editboxy
Tagi: panel :: logowania
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: