TAYHI
Wiek: 29 Na forum: 5470 dni Posty: 10
Nick w MP: TAYHI
Mam problem jak dodac przycisk logowania i poprawic te napisy logowania
Cytat: local sm = {}
sm.moov = 0
sm.object1,sm.object2 = nil,nil
local function removeCamHandler()
if(sm.moov == 1)then
sm.moov = 0
end
end
local function camRender()
if (sm.moov == 1) then
local x1,y1,z1 = getElementPosition(sm.object1)
local x2,y2,z2 = getElementPosition(sm.object2)
setCameraMatrix(x1,y1,z1,x2,y2,z2)
end
end
addEventHandler("onClientPreRender",root,camRender)
function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time)
if(sm.moov == 1)then return false end
sm.object1 = createObject(1337,x1,y1,z1)
sm.object2 = createObject(1337,x1t,y1t,z1t)
setElementAlpha(sm.object1,0)
setElementAlpha(sm.object2,0)
setObjectScale(sm.object1,0.01)
setObjectScale(sm.object2,0.01)
moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad")
moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad")
sm.moov = 1
setTimer(removeCamHandler,time,1)
setTimer(destroyElement,time,1,sm.object1)
setTimer(destroyElement,time,1,sm.object2)
return true
end
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage )
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
addEventHandler("onClientResourceStart", resourceRoot,
function( )
smoothMoveCamera ( 1266.0865478516, -1658.5220947266, 73.064628601074, -1658.5220947266, -1287.0975341797, 73.064628601074, 366.80706787109, -1598.6693115234, 69.612487792969, 337.96209716797, -1620.0395507813, 106.43092346191, 130000)
setTimer(function()
smoothMoveCamera(2113.8352050781,1209.8538818359,60.945999145508,2114.2651367188,1208.9752197266,60.738212585449,2122.6770019531,1245.2310791016,56.893001556396,2121.8374023438,1245.7521972656,56.738994598389,130000)
end, 130000, 1)
end
)
function centrerElement(element)
local ecranL, ecranH = guiGetScreenSize()
local largeur, hauteur = guiGetSize(element, false)
guiSetPosition(element, ecranL/2-largeur/2, ecranH/2-hauteur/2, false)
end
function resourceStart()
panelConnexion()
end
addEventHandler( "onClientResourceStart", getResourceRootElement (getThisResource() ), resourceStart)
function centrerElement(element)
local ecranL, ecranH = guiGetScreenSize()
local largeur, hauteur = guiGetSize(element, false)
guiSetPosition(element, ecranL/2-largeur/2, ecranH/2-hauteur/2, false)
end
function panelConnexion()
local panel = guiCreateStaticImage(0, 0, 0.811, 0.827, "img/bg.png", true)
centrerElement(panel)
-- Panel (texte
local information_texte = guiCreateLabel(0, 0, 0.411, 0.827, "Logowanie :", true, panel)
local verdana_16px = guiCreateFont("text/Roboto.ttf", 16)
guiSetFont(information_texte, verdana_32px)
-- Opis Logowania
local information_texte = guiCreateLabel(0.150, 0.013, 0.520, 0.820, "Logowanie :", true, panel)
local verdana_16px = guiCreateFont("text/Roboto.ttf", 16)
guiSetFont(information_texte, verdana_16px)
-- Logowanie
bouton_connexion = guiCreateStaticImage(0.477, 0.783, 0.3846, 0.12, "images/mix.png", true, panel)
guiLabelSetHorizontalAlign(bouton_texte, "center")
guiLabelSetVerticalAlign(bouton_texte, "center")
local verdana_14px = guiCreateFont("text/Roboto.ttf", 14)
guiSetFont(bouton_texte, verdana_14px)
end
addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(sx*256/1024, sy*458/768, sx*226/1024, sy*45/768) 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*573/1024, sy*407/768, sx*226/1024, sy*45/768) 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
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("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?") usuni?te w wersji v1.1
setElementData(localPlayer,"player:logged",false)
addEventHandler("onClientRender", root, renderLoginBox)
data.button[1]=guiCreateEdit(0.395, 0.41, 0.19, 0.04, "", true)
data.button[2]=guiCreateEdit(0.395, 0.5101, 0.19, 0.04, "", true)
end)