radziowarsss
Wiek: 26 Na forum: 3331 dni Posty: 9
Nick w MP: radziowarsss
Piwa : 1
Witam, mam ma?y problem z serwerem, chodzi o panel logowania.
Serwer ma ju? wszystko wgrane.
Tylko jest taki problem, ?e przy panelu logowania i rejestracji, nie ma mo?liwo?ci utworzenia konta, tzn. jest ale nie mo?na tego zrobi?.
Wczoraj si? m?czy?em z tym ca?y dzie?, ale nie potrafi? rozwi?za? tego problemu. Prosz? o pomoc najlepiej przez ts3.
Adres do ts3: cut
Serwer postawiony jest na: serverproject.eu
O wi?cej informacji prosz? pisa? na forum, bo nie mam poj?cia co mo?e by? przydatne przy rozwi?zaniu tego.
Z g?ry wszystkim dzi?kuje za pomoc i pozdrawiam
Kody panelu logowania:
Kod: x,y = guiGetScreenSize()
sw,sh = guiGetScreenSize()
loginedit=guiCreateEdit(0.42, 0.51, 0.16, 0.05, "", true)
passedit=guiCreateEdit(0.42, 0.66, 0.16, 0.05, "", true)
guiEditSetMasked(passedit, true)
local data={ showed=nil, info=nil, misc=nil, }
local font = dxCreateFont("font.otf", 14)
local font2 = dxCreateFont("font.otf", 34)
function cursorPosition(x, y, w, h)
if (not isCursorShowing()) then
return false
end
local mx, my = getCursorPosition()
local fullx, fully = guiGetScreenSize()
cursorx, cursory = mx*fullx, my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
function drawDX()
local colorzaloguj = tocolor(0, 90, 255, 99)
local colorzaloguj2 = tocolor(0, 90, 255, 99)
--[[local x, y, x1, y1, z1 = getCursorPosition()
if x == 481 and y == 503 then
colorzaloguj = tocolor(41, 41, 41, 255)
elseif x == 670 and y == 502 then
colorzaloguj2 = tocolor(41, 41, 41, 255)
end--]]
if cursorPosition(sw * 0.4078, sh * 0.8097, sw * 0.1859, sh * 0.0556) then colorzaloguj = tocolor(0, 110, 255, 99) end
if cursorPosition(sw * 0.4078, sh * 0.7403, sw * 0.1859, sh * 0.0556) then colorzaloguj2 = tocolor(0, 110, 255, 99) end
if data.info then dxDrawText(data.info, sw*252/1024, sh*272/768, sw*800/1024, sh*255/768, tocolor(237, 0, 0, 255), 1.00, "default", "center", "center", false) end
dxDrawRectangle(sw * 0.3305, sh * 0.0000, sw * 0.3391, sh * 1.0000, tocolor(254, 254, 254, 32), false)
dxDrawText("Nazwa Gracza", (sw * 0.3289) + 1, (sh * 0.4347) + 1, (sw * 0.6695) + 1, (sh * 0.5000) + 1, tocolor(0, 0, 0, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawText("Nazwa Gracza", sw * 0.3289, sh * 0.4347, sw * 0.6695, sh * 0.5000, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawText("Haslo", (sw * 0.3289) + 1, (sh * 0.5833) + 1, (sw * 0.6695) + 1, (sh * 0.6486) + 1, tocolor(0, 0, 0, 255), 1.00, font, "center", "center", false, true, false, false, false)
dxDrawText("Haslo", sw * 0.3289, sh * 0.5833, sw * 0.6695, sh * 0.6486, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, true, false, false, false)
dxDrawRectangle(sw * 0.4078, sh * 0.8097, sw * 0.1859, sh * 0.0556, colorzaloguj, false)
dxDrawText("Utworz konto", (sw * 0.4078) + 1, (sh * 0.8097) + 1, (sw * 0.5945) + 1, (sh * 0.8653) + 1, tocolor(0, 0, 0, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawText("Utworz konto", sw * 0.4078, sh * 0.8097, sw * 0.5945, sh * 0.8653, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawRectangle(sw * 0.4078, sh * 0.7403, sw * 0.1859, sh * 0.0556, colorzaloguj2, false)
dxDrawText("Zaloguj", (sw * 0.4078) + 1, (sh * 0.7403) + 1, (sw * 0.5945) + 1, (sh * 0.7958) + 1, tocolor(0, 0, 0, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawText("Zaloguj", sw * 0.4078, sh * 0.7403, sw * 0.5945, sh * 0.7958, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawText("My New Stories", sw * 0.3305, sh * 0.1264, sw * 0.6695, sh * 0.2944, tocolor(255, 255, 255, 255), 1, font2, "center", "center", false, false, false, false, false)
--dxDrawText("Witajcie! Jest to 2 edycja serwera My New Stories!", sw * 0.3773, sh * 0.2458, sw * 0.6227, sh * 0.2875, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
--dxDrawText("My New Stories", 522, 245, 821, 289, tocolor(255, 255, 255, 255), 0.75, "bankgothic", "center", "center", false, false, false, false, false)
--[[dxDrawText("- Login", 670, 325, 842, 369, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "center", false, false, false, false, false)
dxDrawText("- Haslo", 670, 406, 842, 450, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "center", false, false, false, false, false)
dxDrawRectangle(481, 503, 179, 41, colorzaloguj, false)
dxDrawRectangle(670, 502, 179, 41, colorzaloguj2, false)
dxDrawText("Zaloguj", 480, 505, 660, 540, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, false, false, false)
dxDrawText("Zarejestruj", 669, 5\\\\\\\\\\\\\\\\\\\\\\\\\05, 849, 540, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, false, false, false)]]
--dxDrawText(" Panel logowania by tosti", 0/800*x, 304/600*y, 228/800*x, 326/600*y, tocolor(255, 255, 255, 10), 1.00, "default", "left", "center", false, false, false, false, false)
end
addEventHandler("onClientResourceStart", resourceRoot, function()
setCameraMatrix(-1884.7939453125,883.890625,58.3671875, -1913.4814453125,883.7119140625,35.325294494629)
showChat(false)
showCursor(true)
fadeCamera(true)
data.showed=true
setElementAlpha(localPlayer,0)
data.misc=playSound("intro.mp3",true)
setSoundVolume(data.misc, 0.5)
showPlayerHudComponent("all",false)
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"zalogowany",false)
addEventHandler("onClientRender", root, drawDX)
guiSetVisible(loginedit, true)
guiSetVisible(passedit, true)
end)
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if cursorPosition(sw * 0.4078, sh * 0.7403, sw * 0.1859, sh * 0.0556) and data.showed then
local login=guiGetText(loginedit)
local pass=guiGetText(passedit)
if string.len(login) < 2 or string.len(pass) < 2 then
data.info="Wype?nij wszystkie pola!"
return
end
triggerServerEvent("login", resourceRoot, login, pass)
end
if cursorPosition(sw * 0.4078, sh * 0.8097, sw * 0.1859, sh * 0.0556) and data.showed then
local login=guiGetText(loginedit)
local pass=guiGetText(passedit)
if string.len(login) < 2 or string.len(pass) < 2 then
data.info="Wype?nij wszystkie pola!"
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("register", resourceRoot, login, pass)
end
end
end)
--[[addEvent("outputInfo", true)
addEventHandler("outputInfo", getRootElement(), function(tekst)
guiSetText(infolabel, tekst)
guiLabelSetColor(infolabel, 255, 0, 0)
end)
addEvent("hideGUI", true)
addEventHandler("hideGUI", getRootElement(), function()
removeEventHandler("onClientRender", root, drawDX)
data.showed = false
setCameraTarget(localPlayer)
guiSetVisible(loginedit, false)
guiSetVisible(passedit, false)
showCursor(false)
end)]]
addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
if not info then info="" end
if value then
data.showed=false
stopSound(data.misc)
showPlayerHudComponent("all",true)
setElementAlpha(localPlayer, 255)
guiSetVisible(loginedit, false)
guiSetVisible(passedit, false)
showCursor(false)
setElementData(localPlayer,"zalogowany",true)
-- Usuwamy elementy
removeEventHandler("onClientRender", root, drawDX)
else
data.info=tostring(info)
setTimer(function() data.info=nil end, 3000, 1)
end
end)
Kod: --[[
Resource: RHARD LIVE V1
Developers: Split <split.programista@gmail.com>
You have no right to use this code without my permission.
(c) 2017 <split.programista@gmail.com>. All rights reserved.
]]
addEvent("login", true)
addEventHandler("login", resourceRoot, function(login,pass)
local result=exports["MNSDB"]:dbGet("SELECT * FROM konta WHERE login=?", login)
if result and #result > 0 then
if result[1].login == login and result[1].haslo == md5(pass) then
local query=exports["MNSDB"]:dbSet("UPDATE konta SET haslo=? WHERE login=?",teaEncode(pass,"Delsin"),login)
triggerClientEvent(client, "logging:result", resourceRoot, false, "Zaaktualizowano twoj profil! Zaloguj sie ponownie!.")
return
end
if result[1].login == login and result[1].haslo == teaEncode(pass,"Ryjek") then
setPlayerName(client, login)
setElementData(client, "UID", result[1].uid)
triggerClientEvent(client, "logging:result", resourceRoot, true, nil)
--triggerClientEvent(client, "hideGUI", client)
triggerClientEvent(client, "drawSpawn", client)
setElementData(client, "organizacja", "")
givePlayerMoney(client, result[1].hajs)
setElementData(client, "repka", result[1].reputacja)
setElementData(client, "prawkoA", result[1].prawkoA)
setElementData(client, "prawkoB", result[1].prawkoB)
setElementData(client, "prawkoC", result[1].prawkoC)
setElementData(client, "prawkoL", result[1].prawkoL)
--triggerEvent("SprawdzDom",root,client)
if result[1].serial == false then
local query=exports["MNSDB"]:dbSet("UPDATE konta SET serial=? WHERE login=?",getPlayerSerial(client),login)
end
--local logs=exports["MNSDB"]:dbSet("INSERT INTO ogrpg_logs_login (name,serial,data) VALUES (?,?,NOW())", string.format(login.."("..result[1].id..")"),getPlayerSerial(client))
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("register", true)
addEventHandler("register", resourceRoot, function(login,pass)
local result=exports["MNSDB"]:dbGet("SELECT * FROM konta 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["MNSDB"]:dbSet("INSERT INTO konta (login,serial,haslo, hajs, hajswbanku, reputacja, skin, prawkoA, prawkoB, prawkoC, prawkoL) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?)", tostring(login), getPlayerSerial(client), teaEncode(pass, "Ryjek"), 200, 0, 0, 0, 0, 0, 0, 0)
if query then
triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomy?lnie zarejestrowale?(a?) si?. Teraz sie zaloguj.")
end
end
end)
function savePlayerData()
if source:getData('zalogowany') then
local uid=source:getData('UID')
if not uid then return end
local money=source:getMoney()
local ogp=source:getData('repka')
local pja=source:getData('prawkoA')
local pjb=source:getData('prawkoB')
local pjc=source:getData('prawkoC')
local pjl=source:getData('prawkoL')
local skin=getElementModel(source)
exports['MNSDB']:dbSet('UPDATE konta SET hajs=?, reputacja=?, prawkoA=?, prawkoB=?, prawkoC=?, prawkoL=?, skin=? WHERE uid=? LIMIT 1;', money, ogp, pja, pjb, pjc, pjl, skin, uid)
end
end
addEventHandler("onPlayerQuit", getRootElement(), savePlayerData)
--[[addEvent("register", true)
addEventHandler("register", getRootElement(), function(login, haslo)
if login ~= "" and haslo ~= "" then
local sprawdz = exports.MNSDB:dbGet("SELECT * FROM konta WHERE login = ?", login)
if not getAccount(login, haslo) and sprawdz then
local que = exports.MNSDB:dbGet("INSERT INTO konta (login,serial,haslo, hajs, hajswbanku, reputacja, skin, prawkoA, prawkoB, prawkoC, licencjaL) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?)", tostring(login), getPlayerSerial(client), tostring(haslo), 200, 0, 0, 0, 0, 0, 0, 0)
if que and addAccount(tostring(login), tostring(haslo)) then
outputChatBox("Zarejestrowano pomy?lnie! Login: #00ff00"..login.." #ffffffHas?o: #00ff00"..haslo.." #ffffffZapami?taj je!", client, 255, 255, 255, true)
outputChatBox("Aby zobaczy? #00ff00panel pomocy #ffffffwci?nij klawisz #00ff00F1", client, 255, 255, 255, true)
local que1 = exports.MNSDB:dbGet("SELECT uid FROM konta WHERE login=?", login)
local que2 = exports.MNSDB:dbGet("SELECT login FROM konta WHERE login=?", login)
logIn(client, getAccount(login), tostring(haslo))
setElementData(client, "UID", que1[1].uid)
givePlayerMoney(client, 200)
outputChatBox("Zosta?e? automatycznie zalogowany! ?yczymy mi?ej gry!", client, 255, 255, 255, true)
triggerClientEvent(client, "hideGUI", client)
triggerClientEvent(client, "drawSpawn", client)
setPlayerName(client, que2[1].login)
setElementData(client, "repka", 0)
else
triggerClientEvent(client, "outputInfo", client, "B??d przy dodawaniu konta!")
end
else
triggerClientEvent(client, "outputInfo", client, "Podaj login i has?o!")
end
else
triggerClientEvent(client, "outputInfo", client, "Takie konto juz istnieje!")
end
end)]]
--[[addEvent("login", true)
addEventHandler("login", getRootElement(), function(login, haslo)
if login ~= "" and haslo ~= "" then
local que = exports.MNSDB:dbGet("SELECT * FROM konta WHERE login=?", login)
if #que >0 and (getAccount(login) ~= false) then
if (tostring(que[1].login) == tostring(login)) and (tostring(que[1].haslo) == tostring(haslo)) then
if logIn(client, getAccount(login), tostring(haslo)) then
outputChatBox("Zalogowano pomy?lnie! Witaj ponownie "..login.."!", client, 255, 255, 255, true)
triggerClientEve\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nt(client, "hideGUI", client)
triggerClientEvent(client, "drawSpawn", client)
setElementData(client, "UID", que[1].uid)
setElementData(client, "organizacja", "")
setPlayerName(client, que[1].login)
givePlayerMoney(client, que[1].hajs)
setElementData(client, "repka", que[1].reputacja)\\\\\\\\\\\\
setElementData(client, "prawkoA", que[1].prawkoA)
setElementData(client, "prawkoB", que[1].prawkoB)
setElementData(client, "prawkoC", que[1].prawkoC)
setElementData(client, "licencjaL", que[1].licencjaL)
else
triggerClientEvent(client, "outputInfo", client, "B??d bazy danych!")
end
else
triggerClientEvent(client, "outputInfo", client, "Z?y login lub has?o!")
end
else
triggerClientEvent(client, "outputInfo", client, "Takie konto nie istnieje!")
end
else
triggerClientEvent(client, "outputInfo", client, "Wype?nij wszystkie pola!")
end
end)]]
Kod: executeSQLQuery("CREATE TABLE IF NOT EXISTS konta (uid INTEGER PRIMARY KEY AUTOINCREMENT, login TEXT, haslo TEXT, premium INTEGER, youtuber INTEGER, reputacja INTEGER, hajs INTEGER, skin INTEGER)")
addEvent("login", true)
addEventHandler("login", getRootElement(), function(login, haslo)
if login ~= "" and haslo ~= "" then
local que = executeSQLQuery("SELECT * FROM konta WHERE login=?", login)
if #que >0 and (getAccount(login) ~= false) then
if (tostring(que[1].login) == tostring(login)) and (tostring(que[1].haslo) == tostring(haslo)) then
if logIn(client, getAccount(login), tostring(haslo)) then
outputChatBox("Zalogowano pomy?lnie! Witaj ponownie "..login.."!", client, 255, 255, 255, true)
triggerClientEvent(client, "hideGUI", client)
triggerClientEvent(client, "drawSpawn", client)
setElementData(client, "UID", que[1].uid)
setPlayerName(client, que[1].login)
givePlayerMoney(client, que[1].hajs)
setElementData(client, "repka", que[1].reputacja)
if tonumber(que[1].premium) > 0 then
setElementData(client, "premium", true)
end
if tonumber(que[1].youtuber) > 0 then
setElementData(client, "youtube", true)
end
else
triggerClientEvent(client, "outputInfo", client, "B??d bazy danych!")
end
else
triggerClientEvent(client, "outputInfo", client, "Z?y login lub has?o!")
end
else
triggerClientEvent(client, "outputInfo", client, "Takie konto nie istnieje!")
end
else
triggerClientEvent(client, "outputInfo", client, "Wype?nij wszystkie pola!")
end
end)
addEvent("register", true)
addEventHandler("register", getRootElement(), function(login, haslo)
if login ~= "" and haslo ~= "" then
local sprawdz = executeSQLQuery("SELECT * FROM konta WHERE login = ?", login)
if not getAccount(login, haslo) and sprawdz then
local que = executeSQLQuery("INSERT INTO konta (login, haslo, premium, youtuber, reputacja, skin, hajs) VALUES (?, ?, ?, ?, ?, ?, ?)", tostring(login), tostring(haslo), 0, 0, 0, 0, 200)
if que and addAccount(tostring(login), tostring(haslo)) then
outputChatBox("Zarejestrowano pomy?lnie! Login: #00ff00"..login.." #ffffffHas?o: #00ff00"..haslo.." #ffffffZapami?taj je!", client, 255, 255, 255, true)
outputChatBox("Aby zobaczy? #00ff00panel pomocy #ffffffwci?nij klawisz #00ff00F9", client, 255, 255, 255, true)
local que1 = executeSQLQuery("SELECT uid FROM konta WHERE login=?", login)
local que2 = executeSQLQuery("SELECT login FROM konta WHERE login=?", login)
logIn(client, getAccount(login), tostring(haslo))
setElementData(client, "UID", que1[1].uid)
givePlayerMoney(client, 200)
outputChatBox("Zosta?e? automatycznie zalogowany! ?yczymy mi?ej gry!", client, 255, 255, 255, true)
triggerClientEvent(client, "hideGUI", client)
triggerClientEvent(client, "drawSpawn", client)
setPlayerName(client, que2[1].login)
setElementData(client, "repka", 0)
else
triggerClientEvent(client, "outputInfo", client, "B??d przy dodawaniu konta!")
end
else
triggerClientEvent(client, "outputInfo", client, "Podaj login i has?o!")
end
else
triggerClientEvent(client, "outputInfo", client, "Takie konto juz istnieje!")
end
end)
function Quit()
plr = source
executeSQLQuery("UPDATE konta SET premium='?', reputacja='?', youtuber='?', hajs='?', skin='?' WHERE login = ?", getElementData(plr, "premium"), getElementData(plr, "repka") or 0, getElementData(plr, "youtube"), getPlayerMoney(plr), getElementModel(plr), getPlayerName(plr))
end
addEventHandler("onPlayerQuit", getRootElement(), Quit)
Ostatnio zmieniony przez marcin778 2017-04-22, 14:41, w całości zmieniany 4 razy