Witam ot?? bawi? si? w robienie serwera, znaczy w wolnej chwili szlifuje swoje umiej?tno?ci, lecz mam problem z panelem logowania, ot?z jest on podpi?ty pod baz? mysql, oczywi?cie po rejestracji, dodaje gracza do tabelki, lecz gdy pr?buj? si? logowa?, jest animacja przej?cia kamery i kappa, szary ekran i nic si? nie da zrobic, mam nadzieje, ?e zrozumiale wyt?umaczy?em b??d. Pozdrawiam i licz? na wasz? pomoc.
Ps: Tak jak m?wi?em, na 100% wszystko jest dobrze podpi?te, poniewa? dodaje gracza do tabelki, skrypt ma te? uprawnienia, czyli jest dodane w acl jako resource.
no a o to logi
A tutaj ca?y skrypt
c_zone.lua
local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }
local czcionka = dxCreateFont("font/1.ttf", 15)
local screenW, screenH = guiGetScreenSize()
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 roundedRectangle(x, y, w, h, color)
dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
local x,y = guiGetScreenSize()
local f = x / 1024
local nY = y*f
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(screenW * 0.7562, screenH * 0.0244, screenW * 0.2222, screenH * 0.0822) and data.showed then
setElementData(localPlayer,"player:spawn",{-1971.47, 137.93, 27.69+0.1})
closeZones()
end
if isMouseIn(screenW * 0.7562, screenH * 0.1178, screenW * 0.2222, screenH * 0.0822) and data.showed then
setElementData(localPlayer,"player:spawn",{-1952.34, 614.99, 35.02+0.1})
closeZones()
end
if isMouseIn(screenW * 0.7562, screenH * 0.2111, screenW * 0.2222, screenH * 0.0822) and data.showed then
setElementData(localPlayer,"player:spawn",{-1914.24, -850.26, 32.17+0.1})
closeZones()
end
end
end)
function showZones(misc)
data.misc=misc
data.showed=true
showPlayerHudComponent("all",false)
guiSetInputMode("no_binds_when_editing")
triggerServerEvent("antyLost", localPlayer)
addEventHandler("onClientRender", root, renderZoneBox)
end
c_logging.lua
if getElementData(localPlayer, "player:uid") then return end
local root = getRootElement()
local blur = exports['blur']
local czcionka = dxCreateFont("font/1.ttf", 25)
local czcionka2 = dxCreateFont("font/1.ttf", 16)
local czcionka3 = dxCreateFont("font/1.ttf", 12)
local czcionka4 = dxCreateFont("font/1.ttf", 10)
local resourceRoot = getResourceRootElement(getThisResource())
local screenW, screenH = guiGetScreenSize()
local screenWidth, screenHeight = guiGetScreenSize()
local blurStrength = 2
local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")
dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
end
end
addEventHandler("onClientRender", root, renderblur)
addEventHandler("onClientResourceStop", resourceRoot,
function()
if (blurShader) and blur then
destroyElement(blurShader)
blurShader = nil
end
end)
local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, tick=getTickCount() }
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 = 400
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
for k,self in pairs(editBox.instances) do
if self.visible then
local px,py,pw,ph = self:getPosition()
local text = self.masked and string.gsub(self.text,".","?€?") or self.text
local alignX = dxGetTextWidth(text,self.scale,self.font) <= pw and "left" or "right"
roundedRectangle(px, py, pw, ph, tocolor(unpack(self.color)),tocolor(255, 0, 40, 255))
dxDrawText(text,px+xedit*5, py,px-xedit*5+pw, py+ph,tocolor(unpack(self.textColor)),self.scale, czcionka3, alignX,"center",true)
if self.input and dxGetTextWidth(text,self.scale,self.font) <= pw then
local lx = dxGetTextWidth(text,self.scale,czcionka3)+px+xedit*8
local lx = dxGetTextWidth(text,self.scale,czcionka3)+px+xedit*8
dxDrawLine(lx, py+yedit*10, lx, py+ph-yedit*10, tocolor(255,255,255,math.abs(math.sin(getTickCount()/300))*200), 2)
end
end
end
if getKeyState("backspace") then
for k,self in pairs(editBox.instances) do
if self.visible and self.input then
if not keyState then
keyState = getTickCount() + 400
self.text = string.sub(self.text,1,string.len(self.text)-1)
elseif keyState and keyState < getTickCount() then
keyState = getTickCount()+100
self.text = string.sub(self.text,1,string.len(self.text)-1)
end
return
end
end
keyState = nil
end
end
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(screenW * 0.3792, screenH * 0.6444, screenW * 0.1125, screenH * 0.0578) and data.showed then
if aktualnie=="logowanie" then
local login = g.user.text
local pass = g.pass.text
if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
data.info = "Login/haslo musza miec od 3 do 22 znakow."
data.tick = getTickCount()+3500
return
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if aktualnie=="rejestracja" then
local login = g.user.text
local pass = g.pass.text
local pass2 = g.pass2.text
if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
data.info = "Login/haslo musza miec od 3 do 22 znakow."
data.tick = getTickCount()+3500
return
end
if pass ~= pass2 then
data.info = "Podane has?‚a nie zgadzaj?… si?™!"
data.tick = getTickCount()+3500
return
end
triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
end
elseif isMouseIn(screenW * 0.5104, screenH * 0.6444, screenW * 0.1125, screenH * 0.0578) and data.showed and aktualnie ~= "glowny" then
aktualnie = "glowny"
g.user.visible = false
g.pass.visible = false
g.pass2.visible = false
elseif isMouseIn(screenW * 0.3014, screenH * 0.4633, screenW * 0.1278, screenH * 0.0744) and aktualnie == "glowny" then
aktualnie = "logowanie"
g.user.visible = true
g.pass.visible = true
--g.pass2.visible = true
elseif isMouseIn(screenW * 0.4361, screenH * 0.4633, screenW * 0.1278, screenH * 0.0744) and aktualnie == "glowny" then
aktualnie = "rejestracja"
g.user.visible = true
g.pass.visible = true
g.pass2.visible = true
elseif isMouseIn(screenW * 0.5708, screenH * 0.4633, screenW * 0.1278, screenH * 0.0744) and aktualnie == "glowny" then
aktualnie = "regulamin"
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)
-- Usuwamy elementy
local time = getRealTime()
setTime(time.hour,time.minute)
g.user.visible = false
g.pass.visible = false
g.pass2.visible = false
removeEventHandler("onClientRender", root, renderLoginBox)
else
data.info=info
data.tick=getTickCount()+5000
end
end)
function onClientClick(button,state,cX,cY)
if not isCursorShowing() then
return
end
if button == "left" and state == "up" then
for k,self in pairs(editBox.instances) do
if self.visible then
if self.input then
self.input = nil
self.onOutput()
end
local x,y,w,h = self:getPosition()
if isMouseIn(x,y,w,h) then
self.input = true
self.onInput()
end
end
end
end
end
addEventHandler("onClientClick", root, onClientClick)
function onClientCharacter(character)
if not isCursorShowing() then
return
end
for k,self in pairs(editBox.instances) do
if self.visible and self.input then
if (string.len(self.text)) < self.maxLength then
self.text = self.text..character
end
end
end
end
addEventHandler("onClientCharacter", root, onClientCharacter)
function editBox:getPosition()
return self.x, self.y, self.w, self.h
end
function editBox:setPosition(x,y,w,h)
self.x, self.y, self.w, self.h = x,y,w,h
return true
end
-- koniec editboxow
function roundedRectangle(x, y, w, h, color)
dxDrawRectangle(x, y, w, h, color, false)
dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
function window(x, y, w, h, color)
local color2 = tocolor(255, 0, 0)
roundedRectangle(x-2, y-2, w+4, h+4, color2, false)
roundedRectangle(x, y, w, h, color, false)
end
Dobrze b??dy nie wywalaj?, gracz si? respi, lecz po zrespieniu si? gracza nie loguje go, czyli, ja mam admina i mam panel P, gdy mnie panel logowanie dopu?ci do spawnu, to i tak musz? wpisywa? /login has?o, nic a nic si? nie zapisuj?.
[ Dodano: 2018-06-20, 18:59 ]
Upora?em si? z tym wystarczy?o lekko pogrzeba? w mysql, do zamkni?cia, oczywi?cie po piwku za pomoc.
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach