Jump to content

Ajuda Aqui n sei qual e a funcao


Recommended Posts

Nao To sabendo como posso tirar essa camera do fundo e colocar uma imagem no login ja tentei essa funcao  mais n funcionou

	Image = guiCreateStaticImage( 0, 0, 1920, 1200, "login_bg.png", false )
	guiSetEnabled (Image, false)

aqui ajudem eu como add a imagem de fundo do painel de login

--[[                               ################################################
                                   #                                              #                                                  
                                   #             SCRIPT PRODUZIDO POR:            #
                                   #                   DaNiLiN                    #
                                   #                                              #
                                   ################################################
--]]


local screenW,screenH = guiGetScreenSize()
local resW,resH = 1366,768
local x,y =  (screenW/resW), (screenH/resH)
DGS = exports.dgs

local Font_1 = dxCreateFont("font/fontNick.ttf", 11)
local Font_2 = dxCreateFont("font/OpenSans-Bold.ttf", 12)
local Font_3 = dxCreateFont("font/font.ttf", 10)
local Font_4 = dxCreateFont("font/font1.ttf", 12)

addEventHandler("onClientKey", root, 
	function (button, press)
    if isEventHandlerAdded("onClientRender", getRootElement(), DxLoginCPG) then  
			if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "t" or  button == "m" then
				cancelEvent()
			end
		end
	end
)

local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted", "radar", "area_name", "radio", "vehicle_name" }

--local iCameraLogin = 1 -- Cam Inicial
local dxLogin = 0.0 -- Cam Inicial

--cameraLogin = {
	--[1] = { 2371.42188, -1581.38745, 78.49046,   1148.85803, -830.92462, 158.90762,    1623.01135, -883.07489, 102.41587}, -- Inicio Tutorial
--}
function TodoInterfaceLogin()
timer = setTimer (function()  
showChat(false)
end,2000,1) 
function DxLoginCPG ()
	if iCameraLogin == 1 then
		dxLogin = dxLogin + 0.00005
		--local ix, iy, iz = interpolateBetween(cameraLogin[iCameraLogin][1], cameraLogin[iCameraLogin][2], cameraLogin[iCameraLogin][3], cameraLogin[iCameraLogin][4], cameraLogin[iCameraLogin][5], cameraLogin[iCameraLogin][6], dxLogin, "Linear")
		--setCameraMatrix(ix, iy, iz, cameraLogin[iCameraLogin][7], cameraLogin[iCameraLogin][8], cameraLogin[iCameraLogin][9] )
	end
		exports["Blur"]:dxDrawBluredRectangle(479, 268, 409, 247, tocolor(255, 255, 255, 200))
        dxDrawRectangle(x*479, y*268, x*409, y*247, tocolor(0, 0, 0, 160), false) -- Cabecario
        dxDrawLine(x*479 - 1, y*268 - 1, x*479 - 1, y*515, tocolor(0, 139, 0, 255), x*1, false)  -- Line Fundo
        dxDrawLine(x*888, y*268 - 1, x*479 - 1, y*268 - 1, tocolor(0, 139, 0, 255), x*1, false)  -- Line Fundo
        dxDrawLine(x*479 - 1, y*515, x*888, y*515, tocolor(0, 139, 0, 255), x*1, false)  -- Line Fundo
        dxDrawLine(x*888, y*515, x*888, y*268 - 1, tocolor(0, 139, 0, 255), x*1, false)  -- Line Fundo
        dxDrawRectangle(x*479, y*268, x*409, y*247, tocolor(0, 0, 0, 124), false) --Fundo
		
        dxDrawLine(x*479 - 1, y*268 - 1, x*479 - 1, y*297, tocolor(0, 139, 0, 255), x*1, false)  -- Line Cabecario
        dxDrawLine(x*888, y*268 - 1, x*479 - 1, y*268 - 1, tocolor(0, 139, 0, 255), x*1, false)  -- Line Cabecario
        dxDrawLine(x*479 - 1, y*297, x*888, y*297, tocolor(0, 139, 0, 255), x*1, false)  -- Line Cabecario
        dxDrawLine(x*888, y*297, x*888, y*268 - 1, tocolor(0, 139, 0, 255), x*1, false)  -- Line Cabecario
        dxDrawRectangle(x*479, y*268, x*409, y*29, tocolor(0, 0, 0, 148), false) -- Cabecario
        dxDrawText("Painel Login", x*645, y*273, x*730, y*290, tocolor(0, 139, 0, 255), x*1.00, Font_3, "left", "top", false, false, false, false, false)
		
        dxDrawLine(x*575 - 1, y*337 - 1, x*575 - 1, y*365, tocolor(0, 139, 0, 255), x*1, false) -- Line ChatBox (Login)
        dxDrawLine(x*838, y*337 - 1, x*575 - 1, y*337 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Line ChatBox (Login)
        dxDrawLine(x*575 - 1, y*365, x*838, y*365, tocolor(0, 139, 0, 255), x*1, false) -- Line ChatBox (Login)
        dxDrawLine(x*838, y*365, x*838, y*337 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Line ChatBox (Login)
		
        dxDrawLine(x*544 - 1, y*337 - 1, x*544 - 1, y*365, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Login)
        dxDrawLine(x*573, y*337 - 1, x*544 - 1, y*337 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Login)
        dxDrawLine(x*544 - 1, y*365, x*573, y*365, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Login)
        dxDrawLine(x*573, y*365, x*573, y*337 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Login)
        dxDrawRectangle(x*544, y*337, x*29, y*28, tocolor(0, 0, 0, 255), false) -- Quadrado Icone (Login)
        dxDrawImage(x*544, y*339, x*28, y*27, "img/iconta.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
		
        dxDrawLine(x*575 - 1, y*393 - 1, x*575 - 1, y*421, tocolor(0, 139, 0, 255), x*1, false)  -- Line ChatBox (Register)
        dxDrawLine(x*838, y*393 - 1, x*575 - 1, y*393 - 1, tocolor(0, 139, 0, 255), x*1, false)  -- Line ChatBox (Register)
        dxDrawLine(x*575 - 1, y*421, x*838, y*421, tocolor(0, 139, 0, 255), x*1, false)  -- Line ChatBox (Register)
        dxDrawLine(x*838, y*421, x*838, y*393 - 1, tocolor(0, 139, 0, 255), x*1, false)  -- Line ChatBox (Register)
		
        dxDrawLine(x*544 - 1, y*393 - 1, x*544 - 1, y*421, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Register)
        dxDrawLine(x*573, y*393 - 1, x*544 - 1, y*393 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Register)
        dxDrawLine(x*544 - 1, y*421, x*573, y*421, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Register)
        dxDrawLine(x*573, y*421, x*573, y*393 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Line Icone (Register)
        dxDrawRectangle(x*544, y*393, x*29, y*28, tocolor(0, 0, 0, 255), false) -- Quadrado Icone (Register)
        dxDrawImage(x*544, y*394, x*28, y*27, "img/isenha.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
		
        dxDrawLine(x*560 - 1, y*462 - 1, x*560 - 1, y*490, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Logar
        dxDrawLine(x*669, y*462 - 1, x*560 - 1, y*462 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Logar
        dxDrawLine(x*560 - 1, y*490, x*669, y*490, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Logar
        dxDrawLine(x*669, y*490, x*669, y*462 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Logar
        dxDrawRectangle(x*560, y*462, x*109, y*28, corBotaoLogar, false) -- Botao Logar
		corBotaoLogar = tocolor(0, 0, 0, 183)   
		if cursorPosition(x*560, y*462, x*109, y*28) then
        corBotaoLogar = tocolor(0, 255, 0, 255)
		end
        dxDrawText("Logar", x*593, y*465, x*636, y*483, tocolor(0, 139, 0, 255), x*1.00, Font_2, "left", "top", false, false, false, false, false)
	
        dxDrawLine(x*704 - 1, y*462 - 1, x*704 - 1, y*490, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Register
        dxDrawLine(x*813, y*462 - 1, x*704 - 1, y*462 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Register
        dxDrawLine(x*704 - 1, y*490, x*813, y*490, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Register
        dxDrawLine(x*813, y*490, x*813, y*462 - 1, tocolor(0, 139, 0, 255), x*1, false) -- Liner Botao Register
        dxDrawRectangle(x*704, y*462, x*109, y*28, corBotaoRegistrar, false) -- Botao Register
		corBotaoRegistrar = tocolor(0, 0, 0, 183)   
		if cursorPosition(x*704, y*462, x*109, y*28) then
        corBotaoRegistrar = tocolor(0, 255, 0, 255)
		end
        dxDrawText("Registrar", x*724, y*465, x*793, y*483, tocolor(0, 139, 0, 255), x*1.00, Font_2, "left", "top", false, false, false, false, false)
		
        dxDrawLine(x*575, y*337, x*575, y*365, tocolor(0, 139, 0, 255), x*2, false)
        dxDrawLine(x*575, y*393, x*575, y*421, tocolor(0, 139, 0, 255), x*2, false)
end
addEventHandler("onClientRender", root, DxLoginCPG)

  editUsername = DGS:dgsCreateEdit(x*575, y*337, x*263, y*28,"",false)
  DGS:dgsSetAlpha(editUsername,1)
  DGS:dgsEditSetMaxLength(editUsername, 50)
	
  editPassword = DGS:dgsCreateEdit(x*575, y*393, x*263, y*28,"",false)
  DGS:dgsSetAlpha(editPassword,1)
  DGS:dgsEditSetMasked(editPassword, true)
  DGS:dgsEditSetMaxLength(editPassword, 50)
	
  buttonLogin = guiCreateButton(x*560, y*462, x*109, y*28,"",false) -- Botão Logar (Mude as cordenadas aqui e na DX)
  guiSetAlpha(buttonLogin,0) -- Botao Logar = 0 Invisivel
	
  buttonRegister = guiCreateButton(x*704, y*462, x*109, y*28,"Registrar",false) -- Botao Registrar
  guiSetAlpha(buttonRegister,0) -- Botao Registrar = 0 Invisivel
	
  addEventHandler("onClientGUIClick", buttonLogin, clientSubmitLogin, false) -- Click Botao Login Aciona função clientSubmitLogin
  addEventHandler ("onClientGUIClick", buttonRegister, clientSubmitRegister, false ) -- Click Botao Registrar Aciona Função clientSubmitRegister
  
for _, component in ipairs( components ) do
		setPlayerHudComponentVisible( component, false )
end
triggerServerEvent ("MLoginSS", getLocalPlayer())
end

function clientSubmitLogin(button, state)
	if button == "left" and state == "up" then
		local username = DGS:dgsGetText(editUsername)
		local password = DGS:dgsGetText(editPassword)
		if username and password then
		triggerServerEvent("setCameraOff", localPlayer)
		triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password)
		end
	end
end

function clientSubmitRegister(button, state)
if button == "left" and state == "up" then
	local usernamer = DGS:dgsGetText(editUsername)
	local passwordr = DGS:dgsGetText(editPassword)
	if usernamer and passwordr then
		triggerServerEvent("submitRegister", getRootElement(), localPlayer, usernamer, passwordr)
		end
	end
end

function resourceStart()
	TodoInterfaceLogin()
	if (editUsername ~= nil) then
	elseif (editPassword ~= nil) then
		addEventHandler("onClientRender", root, DxLoginCPG)
		DGS:dgsSetVisible(editUsername, true)
        DGS:dgsSetVisible(editPassword, true)
	else
		exports.Scripts_Dxmessages:outputDx("Ocorreu um erro.!", "error")
	end
	showCursor(true)
	showChat(false)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStart)
addEventHandler ( "onPlayerLogin", root, resourceStart)

function OffDxlogin ()
	DGS:dgsSetVisible(editUsername, false)
    DGS:dgsSetVisible(editPassword, false)
    guiSetVisible(buttonLogin, false)
    guiSetVisible(buttonRegister, false)
	showCursor(false)
	showChat(true)
	triggerServerEvent("MLoginSSOFF", localPlayer)
	removeEventHandler("onClientRender", root, DxLoginCPG)
for _, component in ipairs( components ) do
		setPlayerHudComponentVisible( component, true )
end
end
addEvent("login", true)
addEventHandler("login", getRootElement(), OffDxlogin)


function DxRegisterSkin ()
	DGS:dgsSetVisible(editUsername, false)
    DGS:dgsSetVisible(editPassword, false)
    guiSetVisible(buttonLogin, false)
    guiSetVisible(buttonRegister, false)
	showCursor(false)
	showChat(true)
	removeEventHandler("onClientRender", root, DxLoginCPG)
for _, component in ipairs( components ) do
		setPlayerHudComponentVisible( component, true )
end
end
addEvent("DxRegisterOFF", true)
addEventHandler("DxRegisterOFF", getRootElement(), DxRegisterSkin)

function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
	if 
		type( sEventName ) == 'string' and 
		isElement( pElementAttachedTo ) and 
		type( func ) == 'function' 
	then
		local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
		if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
			for i, v in ipairs( aAttachedFunctions ) do
				if v == func then
					return true
				end
			end
		end
	end

	return false
end

local x,y = guiGetScreenSize()
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

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...