if getElementData(localPlayer, "player:uid") then return end
local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
local screenW, screenH = guiGetScreenSize()
local blurStrength = 20
local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")
function renderblur()
if blur == true then
dxUpdateScreenSource(myScreenSource)
dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);
dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
end
end
addEventHandler("onClientRender", root, renderblur)
addEventHandler("onClientResourceStop", resourceRoot,
function()
if (blurShader) then
destroyElement(blurShader)
blurShader = nil
end
end)
x,y=2313.58, 1282.80-- my width
intro_step=math.random(0,850)
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 = 100
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
local a = math.rad(90 - 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
function renderLoginBox()
blur = true
dxDrawRectangle(449, 88, 0, 66, tocolor(255, 255, 255, 255), false)
dxDrawLine(screenW * 1.0000, screenH * 0.6111, screenW * 1.0000, (screenH * 0.3156) - 1, tocolor(140, 0, 255, 255), 6, false)
if data.info then dxDrawText(data.info, sx*252/1024, sy*272/768, sx*800/1024, sy*255/768, tocolor(140, 0, 255, 255), 2.00, "default", "center", "center", false) end
dxDrawText("U?ytkownik", sx*280/1024, sy*270/768, sx*760/1024, sy*302/768, white, 1.30, "default-bold", "center", "center", false)
dxDrawText("Has?o", sx*-240/1024, sy*480/768, sx*1280/1024, sy*302/768, white, 1.30, "default-bold", "center", "center", false)
if not isMouseIn(sx*520, sy*280, sx*200, sy*200) then roundedRectangle(sx*305/2524, sy*506/1188, sx*200/1024, sy*45/768, tocolor(140, 5, 255, 170), false)
else roundedRectangle(sx*305/2524, sy*506/1188, sx*200/1024, sy*45/768, tocolor(140, 5, 255, 100), false) end
if not isMouseIn(sx*520, sy*380, sx*200, sy*200) then roundedRectangle(sx*535/764, sy*506/1200, sx*200/1024, sy*45/768, tocolor(140, 5, 255, 170), false)
else roundedRectangle(sx*535/764, sy*506/1200, sx*200/1024, sy*45/768, tocolor(140, 5, 255, 100), false) end
dxDrawImage(0.1, 0.1, 1300, 800, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
--dxDrawImage(sw/2-295,sh/2+70,594,307,"logo.png", angle, 0, -120 )
dxDrawImage(520, 280, 200, 200, "zalogujsie.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
--dxDrawImage(sw/2-295,sh/2+70,594,307,"zalogujsie.png", angle, 0, -120 )
dxDrawImage(520, 380, 200, 200, "zarejestruj.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
--dxDrawImage(sw/2-295,sh/2+70,594,307,"zarejestruj.png", angle, 0, -120 )
local x,y=getPointFromDistanceRotation(2313.58, 1282.80, dist, angler)
setCameraMatrix(x,y,107.72+0.9,2323.69, 1285.66, 107.72+0.9)
angler=(angler+0.1)
end
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(sx*520, sy*280, sx*200, sy*200) 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="Wype?nij wszystkie pola!"
return
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if isMouseIn(sx*520, sy*380, sx*200, sy*200) and data.showed then
local login=guiGetText(data.button[1])
local pass=guiGetText(data.button[2])
if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
data.info="Login/Has?o musz? mie? mniej ni? od 3 do 22 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)
-- Usuwamy elementy
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
setElementAlpha(localPlayer,0)
data.misc=playSound("misc/intro.mp3",true)
setSoundVolume(data.misc, 1.0)
showPlayerHudComponent("all",false)
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"status","Loguje si?")
--setElementData(localPlayer,"player:logged",false)
addEventHandler("onClientRender", root, renderLoginBox)
data.button[1]=guiCreateEdit(0.38, 0.40, 0.22, 0.04, "", true)
data.button[2]=guiCreateEdit(0.38, 0.53, 0.22, 0.04, "", true)
guiEditSetMasked(data.button[2],true)
end)