NeroNix
Wiek: 27 Na forum: 3614 dni Posty: 69
Piwa : 1
Witam, posiadam Gamemoda OGRPG v2 i mam problem z panelem logowania. Ot??, wgra?em ten z gtao i nie dzia?a mi . Nie wczytuje kont ju? zajerejerstrowanych tylko nowe po rejerstracji jak to naprawi??.
Za pomoc i
C_logging:
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 )
S_logging:
addEvent ( "onClientSendRegisterDataToServer" , true )
addEventHandler ( "onClientSendRegisterDataToServer" , getRootElement (), dodaj )
addEvent ( "logging:checkAccount" , true )
addEventHandler ( "logging:checkAccount" , resourceRoot , function( login , pass )
local result = exports [ "og-db" ]: getRekord ( "SELECT * FROM og_users WHERE login=?" , login )
if result and #result > 0 then
if result [ 1 ]. login == login and result [ 1 ]. pass == md5 ( pass ) then
setPlayerName ( client , login )
setElementData ( client , "player:uid" , result [ 1 ]. id )
triggerClientEvent ( client , "logging:result" , resourceRoot , true , nil )
else
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Podane dane s? nieprawid?owe." )
end
else
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Podany login nie istnieje w bazie." )
end
end )
addEvent ( "onClientSendRegisterDataToServer" , true )
addEventHandler ( "onClientSendRegisterDataToServer" , getRootElement (), dodaj )
addEvent ( "logging:newAccount" , true )
addEventHandler ( "logging:newAccount" , resourceRoot , function( login , pass )
local result = exports [ "og-db" ]: getRekord ( "SELECT * FROM og_users WHERE login=?" , login )
if result and #result > 0 then
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Podany login ju? istnieje w bazie." )
else
local query = exports [ "og-db" ]: setRekord ( "INSERT INTO og_users (login,pass) VALUES (?,?)" , login , md5 ( pass ))
if query then
triggerClientEvent ( client , "logging:result" , resourceRoot , false , "Pomy?lnie zalogowa?e?(a?) si?" )
end
end
end )
addEvent ( "core:spawnPlayer" , true )
addEventHandler ( "core:spawnPlayer" , resourceRoot , function()
local pozycja = getElementData ( source , "player:spawn" )
spawnPlayer ( source , - 1936.2734375 , 882.55859375 , 38.51273727417 , 270.0 , 0 )
fadeCamera ( source , false )
end )
function setCameraOnPlayerJoin ()
fadeCamera ( source , true , 5 )
setCameraMatrix ( source , 1254.14 , 155.18 , 66.37 )
spawnPlayer ( source , 0.0 , 0.0 , 5.0 , 90.0 , 0 )
end
addEventHandler ( "onPlayerJoin" , getRootElement (), setCameraOnPlayerJoin )
c_zone:
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
function renderZoneBox ()
dxDrawImage ( 0 / 1440 * sx , 0 / 900 * sy , 1440 / 1440 * sx , 900 / 900 * sy , "tlo.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
if data . info then dxDrawText ( data . info , sx * 252 / 1024 , sy * 232 / 768 , sx * 800 / 1024 , sy * 255 / 768 , tocolor ( 237 , 0 , 0 , 255 ), 1.00 , "default" , "center" , "center" , false ) end
dxDrawText ( "Wyb?r Spawnu" , sx * 555 / 1024 , sy * 215 / 768 , sx * 288 / 1024 , sy * 48 / 768 , tocolor ( 0 , 155 , 200 , 193 ), 3.25 , "defualt-bold" , "center" , "center" , false )
-- dxDrawText ( "Wyb?r Spawnu" , sx * 0 / 1024 , sy * 157 / 768 , sx * 1024 / 1024 , sy * 237 / 768 , tocolor ( 0 , 155 , 200 , 193 ), 3.25 , "defualt-bold" , "center" , "center" , false )
if not isMouseIn ( sx * 98 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 ) then dxDrawRectangle ( sx * 98 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 , tocolor ( 35 , 35 , 35 , 193 ), false )
else dxDrawRectangle ( sx * 98 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 , tocolor ( 0 , 155 , 200 , 193 ), false ) end
if not isMouseIn ( sx * 415 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 ) then dxDrawRectangle ( sx * 415 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 , tocolor ( 35 , 35 , 35 , 193 ), false )
else dxDrawRectangle ( sx * 415 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 , tocolor ( 0 , 155 , 200 , 193 ), false ) end
if not isMouseIn ( sx * 710 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 ) then dxDrawRectangle ( sx * 710 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 , tocolor ( 35 , 35 , 35 , 193 ), false )
else dxDrawRectangle ( sx * 710 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 , tocolor ( 0 , 155 , 200 , 193 ), false ) end
dxDrawText ( "San Fierro" , sx * 98 / 1024 , sy * 293 / 768 , sx * 323 / 1024 , sy * 386 / 768 , white , 1.00 , "default-bold" , "center" , "center" , false )
dxDrawText ( "Przechowywalnia" , sx * 416 / 1024 , sy * 293 / 768 , sx * 641 / 1024 , sy * 386 / 768 , white , 1.00 , "default-bold" , "center" , "center" , false )
dxDrawText ( "Urz?d" , sx * 712 / 1024 , sy * 293 / 768 , sx * 937 / 1024 , sy * 386 / 768 , white , 1.00 , "default-bold" , "center" , "center" , false )
dxDrawImage ( 505 , 200 , 352 , 82 , "og.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if btn == "left" and state == "down" then
if isMouseIn ( sx * 98 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 ) and data . showed then
setElementData ( localPlayer , "player:spawn" ,{- 1936.03 , 883.51 , 38.51 })
closeZones ()
end
if isMouseIn ( sx * 415 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 ) and data . showed then
setElementData ( localPlayer , "player:spawn" ,{- 2058.26 , 466.36 , 35.17 })
closeZones ()
end
if isMouseIn ( sx * 710 / 1024 , sy * 294 / 768 , sx * 225 / 1024 , sy * 92 / 768 ) and data . showed then
setElementData ( localPlayer , "player:spawn" ,{- 1903.52 , 486.86 , 35.17 })
closeZones ()
end
end
end )
function closeZones ()
showChat ( true );
showCursor ( false );
fadeCamera ( false );
setCameraTarget ( localPlayer )
stopSound ( data . misc )
showPlayerHudComponent ( "all" , true )
showPlayerHudComponent ( "money" , false )
data . showed = false
setTimer ( triggerServerEvent , 2000 , 1 , "core:spawningPlayer" , localPlayer )
removeEventHandler ( "onClientRender" , root , renderZoneBox )
end
function showZones ( misc )
data . misc = misc
data . showed = true
showPlayerHudComponent ( "all" , false )
guiSetInputMode ( "no_binds_when_editing" )
addEventHandler ( "onClientRender" , root , renderZoneBox )
end