Wysłany: 2021-01-29, 15:48
NoNamik
Wiek: 35 Na forum: 2186 dni Posty: 289
Nick w MP: JestemNoNamem
Piwa : 374
Witam robie panel logowania i niestety lecz nie dziala mi guiGetText wyskakuje taki blad tutaj kod if getElementData ( localPlayer , "player:sid" ) then return end
local sx , sy = guiGetScreenSize ()
local font = dxCreateFont ( "font.ttf" , 10 )
local actual = false
local root = getRootElement ()
local tick = getTickCount ()
local resourceRoot = getResourceRootElement ( getThisResource ())
local screenWidth , screenHeight = guiGetScreenSize ()
addEventHandler ( "onClientResourceStop" , resourceRoot ,
function()
if ( blurShader ) then
destroyElement ( blurShader )
blurShader = nil
end
end )
local sm = {}
sm . moov = 0
sm . object1 , sm . object2 = nil , nil
local function removeCamHandler ()
if( sm . moov == 1 ) then
sm . moov = 0
end
end
local function camRender ()
if ( sm . moov == 1 ) then
local x1 , y1 , z1 = getElementPosition ( sm . object1 )
local x2 , y2 , z2 = getElementPosition ( sm . object2 )
setCameraMatrix ( x1 , y1 , z1 , x2 , y2 , z2 )
end
end
addEventHandler ( "onClientPreRender" , root , camRender )
function smoothMoveCamera ( x1 , y1 , z1 , x1t , y1t , z1t , x2 , y2 , z2 , x2t , y2t , z2t , time )
if( sm . moov == 1 ) then return false end
sm . object1 = createObject ( 1337 , x1 , y1 , z1 )
sm . object2 = createObject ( 1337 , x1t , y1t , z1t )
setElementAlpha ( sm . object1 , 0 )
setElementAlpha ( sm . object2 , 0 )
setObjectScale ( sm . object1 , 0.01 )
setObjectScale ( sm . object2 , 0.01 )
moveObject ( sm . object1 , time , x2 , y2 , z2 , 0 , 0 , 0 , "InOutQuad" )
moveObject ( sm . object2 , time , x2t , y2t , z2t , 0 , 0 , 0 , "InOutQuad" )
sm . moov = 1
setTimer ( removeCamHandler , time , 1 )
setTimer ( destroyElement , time , 1 , sm . object1 )
setTimer ( destroyElement , time , 1 , sm . object2 )
return true
end
x , y = 2313.58 , 1282.80 -- my width
intro_step = math . random ( 0 , 850 )
local muzyka = false
local sw , sh = guiGetScreenSize ()
local zoom = 1
if sw < 1920 then
zoom = math . min ( 2 , 1920 / sw )
end
function getCenter ( x , y )
x , y = x / zoom , y / zoom
return ( sw / 2 ) - ( x / 2 ), ( sh / 2 ) - ( y / 2 )
end
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 = 200
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
function renderLoginBox ()
if actual == 'login' then
dxDrawImage ( 0 , 0 , sx , sy , "img/login.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Kliknij aby przejsc do rejestracji" , 783 , 785 , 1138 , 823 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "ZALOGUJ" , 881 , 580 , 1039 , 630 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default-bold" , "center" , "center" , false , false , true , false , false )
end
if actual == 'register' then
dxDrawImage ( 0 , 0 , sx , sy , "img/register.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawText ( "Kliknij aby przejsc do logowania" , 783 , 785 , 1138 , 823 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "ZAREJESTRUJ" , 881 , 580 , 1039 , 630 , tocolor ( 255 , 255 , 255 , 255 ), 1.50 , "default-bold" , "center" , "center" , false , false , true , false , false )
dxDrawText ( guiGetText ( login ), 802 , 350 , 322 , 68 , tocolor ( 255 , 255 , 255 , 255 ), 1.0 , "default" , "left" , "center" , false )
end
if isMouseIn ( 853 , 579 , 214 , 53 ) then
dxDrawImage ( 853 , 579 , 214 , 53 , ":psrpg-logging/img/click2.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else
dxDrawImage ( 853 , 579 , 214 , 53 , ":psrpg-logging/img/click.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
if data . info then
dxDrawText ( "" .. data . info , 730 , 826 , 1193 , 1047 , tocolor ( 255 , 255 , 0 , 255 ), 1.3 , "default-bold" , "center" , "center" , false , false , false , false , false )
end
end
function math . round ( number , decimals , method )
decimals = decimals or 0
local factor = 10 ^ decimals
if ( method == "ceil" or method == "floor" ) then return math [ method ]( number * factor ) / factor
else return tonumber (( "%." .. decimals .. "f" ): format ( number )) end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
local x_2 , y_2 = getCenter ( 328 ,- 115 )
local x_4 , y_4 = getCenter ( 300 , 800 )
if isMouseIn ( 853 , 579 , 214 , 53 ) and data . showed and actual == 'login' then
local login = guiGetText ( zaloguj )
local pass = guiGetText ( zarejestruj )
if string . len ( login ) < 2 or string . len ( pass ) < 2 then
data . info = "Aby si? zalogowa? nale?y wype?ni? wszystkie pola."
return
end
triggerServerEvent ( "logging:checkAccount" , resourceRoot , login , pass )
elseif isMouseIn ( 853 , 579 , 214 , 53 ) and data . showed and actual == 'register' then
local login = guiGetText ( zaloguj )
local pass = guiGetText ( zarejestruj )
if string . len ( login ) > 22 or string . len ( pass ) > 22 and string . len ( login ) < 3 or string . len ( pass ) < 3 then
data . info = "Nazwa/Has?o U?ytkownika musi zawiera? od 3 do 22 znak?w"
return
end
triggerServerEvent ( "logging:newAccount" , resourceRoot , login , pass )
elseif isMouseIn ( 864 , 784 , 195 , 34 ) and data . showed and actual == 'login' then
actual = 'register'
elseif isMouseIn ( 864 , 784 , 195 , 34 ) and data . showed and actual == 'register' then
actual = 'login'
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 ( muzyka )
-- Usuwamy elementy
destroyElement ( zaloguj )
destroyElement ( zarejestruj )
removeEventHandler ( "onClientRender" , root , renderLoginBox )
removeEventHandler ( "onClientPreRender" , root , camRender )
local tick = getTickCount ()
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
setElementAlpha ( localPlayer , 0 )
local tick = getTickCount ()
muzyka = playSound ( "misc/intro.mp3" , true )
actual = 'login'
setSoundVolume ( muzyka , 1.0 )
showPlayerHudComponent ( "all" , false )
showPlayerHudComponent ( "radar" , false )
showPlayerHudComponent ( "crosshair" , true )
showPlayerHudComponent ( "weapon" , false )
showPlayerHudComponent ( "radar" , false )
showPlayerHudComponent ( "health" , false )
showPlayerHudComponent ( "breath" , false )
showPlayerHudComponent ( "clock" , false )
showPlayerHudComponent ( "ammo" , false )
guiSetInputMode ( "no_binds_when_editing" )
setElementData ( localPlayer , "status" , "Loguje si?" )
-- setElementData ( localPlayer , "player:logged" , false )
addEventHandler ( "onClientRender" , root , renderLoginBox )
zaloguj = guiCreateEdit ( 802 , 350 , 322 , 68 , "" , false )
zarejestruj = guiCreateEdit ( 802 , 458 , 322 , 68 , "" , false )
guiEditSetMasked ( zarejestruj , true )
guiEditSetMaxLength ( zaloguj , 22 )
guiEditSetMaxLength ( zarejestruj , 22 )
guiSetAlpha ( zaloguj , 0.0 )
guiSetAlpha ( zarejestruj , 0.0 )
guiSetVisible ( zaloguj , true )
guiSetVisible ( zarejestruj , true )
end )
tutaj jest blad
dxDrawText ( guiGetText ( login ), 802 , 350 , 322 , 68 , tocolor ( 255 , 255 , 255 , 255 ), 1.0 , "default" , "left" , "center" , false )
Wysłany: 2021-01-29, 15:57
MrVip615
witam
Wiek: 22 Na forum: 4307 dni Posty: 167
Nick w MP: ramzes
Piwa : 207
dxDrawText ( guiGetText ( zaloguj ), 802 , 350 , 322 , 68 , tocolor ( 255 , 255 , 255 , 255 ), 1.0 , "default" , "left" , "center" , false )
Nie powinno to wygladac tak, lub tak?:
dxDrawText ( login , 802 , 350 , 322 , 68 , tocolor ( 255 , 255 , 255 , 255 ), 1.0 , "default" , "left" , "center" , false )
Wysłany: 2021-01-29, 15:58
NoNamik
Wiek: 35 Na forum: 2186 dni Posty: 289
Nick w MP: JestemNoNamem
Piwa : 374
MrVip615 , dziala lecz jest jeden problem bo jak wpisuje haslo to powinny byc *** a widac wszystko
Wysłany: 2021-01-29, 16:37
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
dxDrawText ( string . rep ( "*" , string . len ( login )), ...
Tagi: guigettext
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: