AssasiPlayGames
Wiek: 22 Na forum: 3757 dni Posty: 176
Nick w MP: NiFeKpL
Piwa : 909
Witam mam problem z logowanie z og v2 jak si? zarejestruje/zaloguje mam czarny ekran i nic w db3
c_login.lua
Kod: --[[
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/intro.mp3');
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)
setElementData(localPlayer,"player:spawn",{1202.56,157.92,20.45})
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)
Login.lua
Kod: --[[
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)
s_base.lua z og-core
Kod: --[[
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.
]]
-- Settings
toggleControles={
'fire',
'action',
'aim_weapon'
}
-- Functions
addEventHandler('onPlayerConnect', root, function(playerNick)
if playerNick:find('#')~=nil then
cancelEvent(true, 'Jest ca?kowity zakaz wej?cia z kolorowym nickiem.')
end
end)
addEventHandler('onPlayerChangeNick', root, function()
cancelEvent()
source:outputChat('* Na serwerze jest zakaz zmiany pseudonimu.', 255, 0, 0)
end)
addEventHandler('onPlayerJoin', root, function()
local result=exports['og-db']:getRekord('SELECT * FROM og_bans WHERE active=1 AND serial=? AND time>NOW() LIMIT 1;', source:getSerial())
if #result > 0 then
outputConsole(' ', source)
outputConsole(' ', source)
outputConsole(' ', source)
outputConsole('Jeste? zbanowany na tym serwerze!', source)
outputConsole('Pow?d zbanowania: ' .. result[1].reason, source)
outputConsole('Czas bana: ' .. result[1].time, source)
outputConsole('Od kary mo?esz zaapelowa? na naszym forum! http://e-life.y0.pl/', source)
source:kick('Serwer', 'Wci?nij F8')
else
exports['og-db']:setRekord('DELETE FROM og_bans WHERE active=1 AND serial=?', source:getSerial())
end
end)
addEventHandler('onPlayerQuit', root, function()
savePlayerData(source)
end)
function onPlayerSpawn()
local pos=getElementData(source,"player:spawn")
if not pos then return end
fadeCamera(source, true)
spawnPlayer(source, pos[1], pos[2], pos[3])
setCameraTarget(source, source)
toggleControl(source,"fire", false)
toggleControl(source,"aim_weapon", false)
source:setAlpha(255)
source:setInterior(0)
source:setDimension(0)
local load=loadPlayerData(source)
end
addEvent('core:spawningPlayer', true)
addEventHandler('core:spawningPlayer', root, onPlayerSpawn)
addEventHandler('onPlayerWasted', root, function()
local gracz=source
fadeCamera(gracz, false)
Timer(function()
fadeCamera(gracz, true)
spawnPlayer(gracz, -1968.9000244141, 137.80000305176, 27.700000762939)
setCameraTarget(gracz, gracz)
end, 3000, 1)
end)
addEventHandler('onResourceStart', root, function()
setFPSLimit(60) -- zmiana na 60fpsow
setWaveHeight(1.5)
local realtime=getRealTime()
setTime(realtime.hour, realtime.minute)
setMinuteDuration(60000)
outputDebugString('[og-core]: Start resource, loaded script')
end)