Jump to content

painel dx loja de skins


Recommended Posts

client side: 

function onClientResourceStart()
    addEvent("painel", true)
    addEventHandler("painel", resourceRoot, abrir)
    addEvent("pagina2", true)
    addEventHandler("pagina2", resourceRoot, abrir2)
    addEvent("pagina3", true)
    addEventHandler("pagina3", resourceRoot, abrir3)
end
addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart)

local screenW, screenH = guiGetScreenSize()
local x, y = (screenW/1600), (screenH/900)


painel = false
function abrir ()


        dxDrawRectangle(screenW * 0.3937, screenH * 0.3289, screenW * 0.1975, screenH * 0.4822, tocolor(127, 127, 127, 255), false)
        dxDrawRectangle(screenW * 0.3937, screenH * 0.3000, screenW * 0.1975, screenH * 0.0289, tocolor(6, 51, 247, 255), false)
        dxDrawImage(screenW * 0.4113, screenH * 0.2722, screenW * 0.1569, screenH * 0.4333, ":skinshop/skin1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411, tocolor(6, 51, 247, 255), false)--comprar

        dxDrawRectangle(screenW * 0.4156, screenH * 0.7178, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--<
        dxDrawRectangle(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)-->


        dxDrawText("Comprar", screenW * 0.4519, screenH * 0.7167, screenW * 0.5238, screenH * 0.7578, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.5331, screenH * 0.7100, screenW * 0.0244, screenH * 0.0533, ":vpanel/fotos/seta1.png", 90, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.4175, screenH * 0.7100, screenW * 0.0250, screenH * 0.0533, ":vpanel/fotos/seta1.png", 273, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Valor: R$ 500", screenW * 0.4519, screenH * 0.7633, screenW * 0.5238, screenH * 0.7944, tocolor(255, 255, 255, 255), 1.40, "default", "left", "center", false, false, false, false, false)
        dxDrawText("Precione \"BackSpace\" para fechar!", screenW * 0.3937, screenH * 0.8156, screenW * 0.5913, screenH * 0.8478, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false)
        dxDrawText("Skin Shop  ", screenW * 0.3937, screenH * 0.3000, screenW * 0.5913, screenH * 0.3289, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.5188, screenH * 0.3178, screenW * 0.0825, screenH * 0.1511, ":hud/html/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

    end

pagina2 = false
function abrir2 ()

        dxDrawRectangle(screenW * 0.3937, screenH * 0.3289, screenW * 0.1975, screenH * 0.4822, tocolor(127, 127, 127, 255), false)
        dxDrawRectangle(screenW * 0.3937, screenH * 0.3000, screenW * 0.1975, screenH * 0.0289, tocolor(6, 51, 247, 255), false)
        dxDrawImage(screenW * 0.4113, screenH * 0.2722, screenW * 0.1569, screenH * 0.4333, ":skinshop/skin2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411, tocolor(6, 51, 247, 255), false)--comprar



        dxDrawRectangle(screenW * 0.4156, screenH * 0.7178, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--<
        dxDrawRectangle(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)-->

        dxDrawText("Comprar", screenW * 0.4519, screenH * 0.7167, screenW * 0.5238, screenH * 0.7578, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.5331, screenH * 0.7100, screenW * 0.0244, screenH * 0.0533, ":vpanel/fotos/seta1.png", 90, 0, 0, tocolor(255, 255, 255, 255), false)-->
        dxDrawImage(screenW * 0.4175, screenH * 0.7100, screenW * 0.0250, screenH * 0.0533, ":vpanel/fotos/seta1.png", 273, 0, 0, tocolor(255, 255, 255, 255), false)--<
        dxDrawText("Valor: R$ 500", screenW * 0.4519, screenH * 0.7633, screenW * 0.5238, screenH * 0.7944, tocolor(255, 255, 255, 255), 1.40, "default", "left", "center", false, false, false, false, false)
        dxDrawText("Precione \"BackSpace\" para fechar!", screenW * 0.3937, screenH * 0.8156, screenW * 0.5913, screenH * 0.8478, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false)
        dxDrawText("Skin Shop  ", screenW * 0.3937, screenH * 0.3000, screenW * 0.5913, screenH * 0.3289, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.5188, screenH * 0.3178, screenW * 0.0825, screenH * 0.1511, ":hud/html/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)


end

pagina3 = false
function abrir3 ()

        dxDrawRectangle(screenW * 0.3937, screenH * 0.3289, screenW * 0.1975, screenH * 0.4822, tocolor(127, 127, 127, 255), false)
        dxDrawRectangle(screenW * 0.3937, screenH * 0.3000, screenW * 0.1975, screenH * 0.0289, tocolor(6, 51, 247, 255), false)
        dxDrawImage(screenW * 0.4113, screenH * 0.2722, screenW * 0.1569, screenH * 0.4333, ":skinshop/skin3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411, tocolor(6, 51, 247, 255), false)--comprar



        dxDrawRectangle(screenW * 0.4156, screenH * 0.7178, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)--<
        dxDrawRectangle(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467, tocolor(255, 0, 0, 0), false)-->

        dxDrawText("Comprar", screenW * 0.4519, screenH * 0.7167, screenW * 0.5238, screenH * 0.7578, tocolor(255, 255, 255, 255), 1.30, "default", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.5331, screenH * 0.7100, screenW * 0.0244, screenH * 0.0533, ":vpanel/fotos/seta1.png", 90, 0, 0, tocolor(255, 255, 255, 255), false)-->
        dxDrawImage(screenW * 0.4175, screenH * 0.7100, screenW * 0.0250, screenH * 0.0533, ":vpanel/fotos/seta1.png", 273, 0, 0, tocolor(255, 255, 255, 255), false)--<
        dxDrawText("Valor: R$ 500", screenW * 0.4519, screenH * 0.7633, screenW * 0.5238, screenH * 0.7944, tocolor(255, 255, 255, 255), 1.40, "default", "left", "center", false, false, false, false, false)
        dxDrawText("Precione \"BackSpace\" para fechar!", screenW * 0.3937, screenH * 0.8156, screenW * 0.5913, screenH * 0.8478, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false)
        dxDrawText("Skin Shop  ", screenW * 0.3937, screenH * 0.3000, screenW * 0.5913, screenH * 0.3289, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.5188, screenH * 0.3178, screenW * 0.0825, screenH * 0.1511, ":hud/html/img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)


end


function abrirbind()
if painel == false then
showCursor (true)
addEventHandler ("onClientRender", root,abrir)
painel = true
else
if painel == true then
showCursor(false)
removeEventHandler("onClientRender",root,abrir)
painel = false
end
end
end
addEvent("lojaskinstt", true)
addEventHandler("lojaskinstt", getRootElement(), abrirbind)

function isCursorOnElement(x,y,w,h)
 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 fecharPainel(key)
    if painel and key == "backspace" then
        showCursor(false)
        removeEventHandler("onClientRender", root, abrir)
        painel = false
        showCursor(false)
    end
end
addEventHandler("onClientKey", root, fecharPainel)

---------------------------------------------------- CORPO

function skinpagina1 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(screenW * 0.4519, screenH * 0.7167, screenW * 0.0719, screenH * 0.0411) then
triggerServerEvent ("skinpagina1stt", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, skinpagina1)


-----------------------------------------------------fechar pagina 1 e abrir 2

function f1ab2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467) then
triggerServerEvent ("f1ab2stt", localPlayer)
removeEventHandler("onClientRender",root,abrir)
painel = false
addEventHandler ("onClientRender", root,abrir2)
pagina2 = true
end
end
end
end
addEventHandler ("onClientClick", root, f1ab2)



-----------------------------------------------------fechar pagina 2 e abrir 3

function f2ab3 (_, state)
    if painel == true and pagina2 == true and state == "down" then
        if isCursorOnElement(screenW * 0.5325, screenH * 0.7133, screenW * 0.0269, screenH * 0.0467) then
            triggerServerEvent("f2ab3stt", localPlayer)
            removeEventHandler("onClientRender", root, abrir2)
            painel = false
            addEventHandler("onClientRender", root, abrir3)
            pagina3 = true
        end
    end
end
addEventHandler("onClientClick", root, f2ab3)

client

server-side: 

function MarkerHit (hitElement)
	if (getElementType(hitElement)) == "player" then
		triggerClientEvent(hitElement, "lojaskinstt", getRootElement())
	end
end

function showPanel(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Everyone")) then -------- ACL DA SUA CORP
    triggerClientEvent(thePlayer, "lojaskinstt", getRootElement())
   else
  end
end
function onResStart()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "", "down", showPanel)
  end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart)
function onPlayerJoin()
  bindKey(source, "", "down", showPanel)
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoin)
function cleanAll(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "", "down", showPanel)
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAll)

---------------------------------------------------------------------------------------


function skinpagina1 ()
     if (getPlayerMoney(source) < 100) then
         outputChatBox("#000000[ #FF0000Fabrica #000000] #ffffffVoce nao tem dinheiro suficiente $100", source, 255, 255, 255, true)
     else
     takePlayerMoney(source, 100) --Remover Dinheiro
     setPedSkin ( source, 40 )
end
end
addEvent("skinpagina1stt",true)
addEventHandler ( "skinpagina1stt", getRootElement(), skinpagina1 )

----------------------------------------------------------------------------------fechar pagina 1 abrir 2

function f1ab2()
    triggerClientEvent(source, "pagina2", resourceRoot)
end
addEvent("f1ab2stt", true)
addEventHandler("f1ab2stt", getRootElement(), f1ab2)


----------------------------------------------------------------------------------fechar pagina 2 abrir 3

function f2ab3()
    triggerClientEvent(source, "pagina3", resourceRoot)
end
addEvent("f2ab3stt", true)
addEventHandler("f2ab3stt", getRootElement(), f2ab3)

server.  por algum motivo a pagina 1 e 2 funcionam corretamente porem ao adicionar uma 3 pagina para de funcionar help

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...