Wysłany: 2016-04-30, 09:42
amama5
Wiek: 39 Na forum: 4745 dni Posty: 57
Nick w MP: kamiloooswas
Piwa : 2
Witam mam problem jak zrobi? aby w logowaniu OGRPG po rejerstracji by? komunikat "Pomy?lnie za?o?ono konto, mo?esz si? teraz zalogowa?"? Bo niestety u mnie jest ?e od razu wchodzi do gry i nie wczytuje mi UID i reszte rzeczy z mysql. Jak to zrobi??
za pomoc i
Server
--[[
Resource : OURGame
Developers : Split < split . programista @ gmail . com >
Copyright < split . programista @ gmail . com > 2015 - 2016
You have no right to use this code without my permission .
@ updates
- Dodano porawk ? przy sprawdzaniu loginu
]]
addEvent ( 'onServerPlayerLogin' , true )
addEventHandler ( 'onServerPlayerLogin' , root , function( login , pass )
local result = exports [ 'og-db' ]: getRekord ( 'SELECT * FROM og_users WHERE login=? AND pass=MD5(?)' , login , pass )
if result [ 1 ] and result [ 1 ]. id then
source : setName ( result [ 1 ]. login )
source : setData ( 'player:uid' , result [ 1 ]. id )
local organizations = exports [ 'og-db' ]: getRekord ( 'SELECT * FROM og_orgplayers WHERE uid=?' , result [ 1 ]. id )
if organizations [ 1 ] and organizations [ 1 ]. id then
local organizationsPlayer = exports [ 'og-db' ]: getRekord ( 'SELECT * FROM og_organizations WHERE id=?' , organizations [ 1 ]. id )
if organizationsPlayer [ 1 ] and organizationsPlayer [ 1 ]. Shortcut then
if organizationsPlayer [ 1 ]. Shortcut then
source : setData ( 'organization:ShroutName' , organizationsPlayer [ 1 ]. Shortcut )
end
end
end
triggerClientEvent ( source , 'onClientLoginRequestResponse' , resourceRoot , { success = true , komunikat = '' })
else
triggerClientEvent ( source , 'onClientLoginRequestResponse' , resourceRoot , { success = false , komunikat = 'Podane dane s? nieprawid?owe' })
end
end )
addEvent ( 'onServerPlayerRegister' , true )
addEventHandler ( 'onServerPlayerRegister' , root , function( login , pass )
local result = exports [ 'og-db' ]: getRekord ( 'SELECT * FROM og_users WHERE login=?' , login )
if result [ 1 ] and result [ 1 ]. id then
triggerClientEvent ( source , 'onClientLoginRequestResponse' , resourceRoot , { success = false , komunikat = 'Podany login ju? istnieje' })
else
local result = exports [ 'og-db' ]: getRekord ( 'SELECT * FROM og_users WHERE serial=?' , getPlayerSerial ( source ))
if result [ 1 ] and result [ 1 ]. id then
triggerClientEvent ( source , 'onClientLoginRequestResponse' , resourceRoot , { success = false , komunikat = 'Konto na tym serialu ju? istnieje' })
else
local result = exports [ 'og-db' ]: setRekord ( 'INSERT INTO og_users (login, pass, serial) VALUES (?,MD5(?),?)' , login , pass , getPlayerSerial ( source ))
if result then
triggerClientEvent ( source , 'onClientLoginRequestResponse' , resourceRoot , { success = true , komunikat = 'Pomy?lnie za?o?ono konto' })
else
triggerClientEvent ( source , 'onClientLoginRequestResponse' , resourceRoot , { success = false , komunikat = 'Nie uda?o si? stworzy? konta\nPowiadom administratora' })
end
end
end
end )
client
--[[
Resource : og - login
Developers : Split < split . programista @ gmail . com >
Copyright < split . programista @ gmail . com > 2015 - 2016
You have no right to use this code without my permission .
@ update
- Dodano poprawke trigger ? w
]]
local data ={}
data . textShowbox = ''
data . GUI ={}
data . music = false
data . guiLU = getTickCount ()
data . infoLU = getTickCount ()
local intro_step = math . random ( 1000 , 10000 )
local font = dxCreateFont ( 'opensans.ttf' , 11 )
local function render ()
local zone1 = math . sin ( intro_step / 100 )* 1500
local zone2 = math . cos ( intro_step / 100 )* 1500
setCameraMatrix ( zone1 , zone2 , 120 , zone1 , zone2 , 120 )
intro_step = intro_step - 0.01
if data . GUI [ 1 ] then
local height = interpolateBetween (- 0.3 * 2 , 0.0 , 0.0 , 0.3 , 0.0 , 0.0 , ( getTickCount ()- data . guiLU )/ 1500 , 'OutBounce' )
data . GUI [ 1 ]: setPosition ( 0.32 , height , true )
end
if data . textShowbox : len ()< 3 then return end
local height = interpolateBetween (- 0.050 * 2 , 0.0 , 0.0 , 0.050 , 0.0 , 0.0 , ( getTickCount ()- data . infoLU )/ 700 , 'OutBounce' )
dxDrawRelativeRectangle ( 0.7 , height , 0.25 , 0.15 , tocolor ( 58 , 129 , 196 , 196 ), false )
dxDrawRelativeText ( data . textShowbox , 0.65 , height + 0.1 , 1 , 0.1 , white , 1.30 , font , 'center' , 'center' )
end
local function intro_fadeInGUI ()
if not data . GUI [ 1 ] then return end
local alpha = data . GUI [ 1 ]: getAlpha ()
alpha = alpha + 0.050
if alpha >= 1 then
showCursor ( true )
return
else
data . GUI [ 1 ]: setAlpha ( alpha )
Timer ( intro_fadeInGUI , 80 , 1 )
end
end
local function intro_fadeOutAudio ()
local vol = data . music : getVolume ()
vol = vol - 0.05
data . music : setVolume ( vol )
if vol <= 0 then
data . music : destroy ()
else
Timer ( intro_fadeOutAudio , 150 , 1 )
end
end
addEventHandler ( 'onClientGUIClick' , resourceRoot , function()
local login = data . GUI [ 4 ]: getText ()
local pass = data . GUI [ 5 ]: getText ()
if source == data . GUI [ 2 ] then
if login : len ()< 3 and pass : len ()< 6 then
data . textShowbox = 'Login jak i has?o jest wymagane'
data . infoLU = getTickCount ()
Timer (function()
data . textShowbox = ''
end , 2000 , 1 )
return
end
triggerServerEvent ( 'onServerPlayerLogin' , localPlayer , login , pass )
end
if source == data . GUI [ 3 ] then
if login : len ()< 3 and pass : len ()< 6 then
data . textShowbox = 'Odnotowano ma?? liczb? znak?w\nw ha?le i w loginie'
data . infoLU = getTickCount ()
Timer (function()
data . textShowbox = ''
end , 2000 , 1 )
return
elseif login : len ()> 24 and pass : len ()> 20 then
data . textShowbox = 'Odnotowano zbyt du?? liczb? znak?w\nw ha?le i w loginie'
data . infoLU = getTickCount ()
Timer (function()
data . textShowbox = ''
end , 2000 , 1 )
return
end
triggerServerEvent ( 'onServerPlayerRegister' , localPlayer , login , pass )
end
end )
addEventHandler ( 'onClientResourceStart' , resourceRoot , function()
if localPlayer : getData ( 'player:logged' ) then return end
showChat ( true ); showCursor ( true ); fadeCamera ( true )
guiSetInputMode ( 'no_binds_when_editing' )
data . GUI [ 1 ]= guiCreateStaticImage ( 0.32 , 0.3 , 0.36 , 0.26 , 'img/bg.png' , true )
data . GUI [ 2 ]= guiCreateStaticImage ( 0.7 , 0.38 , 0.28 , 0.18 , 'img/btnlogin.png' , true , data . GUI [ 1 ])
data . GUI [ 3 ]= guiCreateStaticImage ( 0.7 , 0.62 , 0.28 , 0.18 , 'img/btnregister.png' , true , data . GUI [ 1 ])
data . GUI [ 4 ]= guiCreateEdit ( 0.090 , 0.4 , 0.5 , 0.16 , '' , true , data . GUI [ 1 ])
data . GUI [ 4 ]: setMaxLength ( 24 )
data . GUI [ 5 ]= guiCreateEdit ( 0.090 , 0.7 , 0.5 , 0.16 , '' , true , data . GUI [ 1 ])
data . GUI [ 4 ]: setMaxLength ( 16 )
data . GUI [ 5 ]: setMasked ( true )
data . GUI [ 1 ]: setAlpha ( 1 )
-- intro_fadeInGUI ()
data . infoLU = getTickCount ()
data . guiLU = getTickCount ()
-- intro music
data . music = playSound ( 'audio/a_intro.ogg' );
data . music : setVolume ( 0.5 )
addEventHandler ( 'onClientRender' , root , render )
outputDebugString ( '[og-login]: was initiated on ' .. localPlayer : getName ())
end )
addEvent ( 'onClientLoginRequestResponse' , true )
addEventHandler ( 'onClientLoginRequestResponse' , resourceRoot , function( response )
if response . success then
intro_fadeOutAudio ();
showChat ( true ); showCursor ( false ); fadeCamera ( false )
data . GUI [ 1 ]: destroy ()
removeEventHandler ( 'onClientRender' , root , render )
Timer (function()
triggerServerEvent ( 'core:spawningPlayer' , localPlayer )
end , 3000 , 1 )
else
if not response . komunikat then return end
data . textShowbox = response . komunikat
data . infoLU = getTickCount ()
Timer (function()
data . textShowbox = ''
end , 2000 , 1 )
end
end )
Wysłany: 2016-04-30, 09:56
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
A dobrze wgra?e? baz? msql ?
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2016-04-30, 10:59
amama5
Wiek: 39 Na forum: 4745 dni Posty: 57
Nick w MP: kamiloooswas
Piwa : 2
barcioo , Tak, wszystko jest dobrze tylko chodzi mi o to ?e po rejerstacji nie wczytuje UID. itd, ale po reconnect ju? wszystko jest ok.
Wysłany: 2016-04-30, 11:28
Barcioo
Kiedyś to było ST
Wiek: 26 Na forum: 4048 dni Posty: 458
Nick w MP: Bartek.
Piwa : 1887
A db jest jakie? ?
Podpis
Kanał Youtube;
A tu zapraszam
[you]
, pomogłem Ci? Wynagrodź mnie
SUPPORT TEAM - 2016-09-03 do 2018-05-25
Test Mod - 2018-05-25
1k dni na Forum - 2018-01-28
GG: 62111935
Wysłany: 2016-04-30, 11:36
Komel123
Wiek: 21 Na forum: 3722 dni Posty: 54
Nick w MP: incognito
barcioo, czy mozesz poda? skype? sprawe mam
Wysłany: 2016-04-30, 13:48
amama5
Wiek: 39 Na forum: 4745 dni Posty: 57
Nick w MP: kamiloooswas
Piwa : 2
Tagi: logowanie :: ogrpg
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: