Sign in to follow this  
Black09

[ajuda] Painel VIP

Recommended Posts

eu sou novo no script,estou tentando fazer um painel Abrir Com acl "VIP"

esse é o lado do client.Lua

addEventHandler("onClientResourceStart", resourceRoot,
    function VIP()
        Painel = guiCreateWindow(258, 158, 484, 470, "Painel VIP", false)
        guiWindowSetSizable(Painel, false)
		
        PegarArmas = guiCreateButton(0.04, 0.16, 0.27, 0.11, "armas", true, Painel)
        guiSetFont(PegarArmas, "default-bold-small")
        guiSetProperty(PegarArmas, "NormalTextColour", "E947F9AB")
        pegarCarro = guiCreateButton(0.04, 0.39, 0.27, 0.12, "carro", true, Painel)
        guiSetFont(pegarCarro, "default-bold-small")
        guiSetProperty(pegarCarro, "NormalTextColour", "E947F9AB")
        PegarJetpack = guiCreateButton(0.05, 0.67, 0.27, 0.13, "jetpack", true, Painel)
        guiSetFont(PegarJetpack, "default-bold-small")
        guiSetProperty(PegarJetpack, "NormalTextColour", "E947F9AB")
	    botaodestruir = guiCreateButton(0.38, 0.80, 0.30, 0.10, "destruir", true,Painel)
        guiSetFont(botaodestruir, "default-bold-small")
        guiSetProperty(botaodestruir, "NormalTextColour", "FF0AF468")  
      addEventHandler("onClientGUIClick",PegarArmas,ClicarNoBotao)
	  addEventHandler("onClientGUIClick",PegarJetpack,CliaBotao)
	  addEventHandler("onClientGUIClick",pegarCarro,ClicaBotao)
	  addEventHandler("onClientGUIClick",botaodestruir,CliaBot)
      	  
end)
addEvent ("mostratVIP", true)
addEventHandler ("mostratVIP", getRootElement(), VIP)

function cclose()
	if (source == ) then
		destroyElement (Painel)
  showCursor (false)
end
end
addEventHandler("onClientGUIClick",getRootElement(), cclose)

function ClicarNoBotao(button,state)
if(button == "left")then
triggerServerEvent("criarArmasEvento",localPlayer)
end
end

function ClicaBotao(button,state)
if(button == "left")then
triggerServerEvent("criarCarroEvento",localPlayer)
end
end

function CliaBotao(button,state)
if(button == "left")then
triggerServerEvent("criarJatEvento",localPlayer)
end
end

function CliaBot(button,state)
if(button == "left")then
triggerServerEvent("DestroirEvento",localPlayer)
end
end

 

Share this post


Link to post

Envie um trigger do client > server verificando lá se o jogador esta na acl vip ou não.

Não entendi o medo de mostrar os 2 lados inteiros, aqui no fórum a maioria tem conhecimento suficiente pra fazer essas coisas simples.

Alias, seu código esta bem mal feito, daria pra deixar um código bem mais compacto e bem feito.

Edited by Jonas^
  • Thanks 1

Share this post


Link to post

Desculpe é que sou novo no Forum, e em Script também.

function VIP ( thePlayer , commandName )
   local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then
   triggerClientEvent ( thePlayer, "mostrarVIP", thePlayer)
	 showCursor (thePlayer, true)
   else
   outputChatBox ( "You are not VIP!",thePlayer)
end
end
addCommandHandler ( "vip", VIP )

function EventoArma ()

giveWeapon(source, 31 , 9999)
giveWeapon(source, 27 , 9999)
giveWeapon(source, 34 , 9999)
giveWeapon(source, 16 , 9999)
giveWeapon(source, 4 , 9999)
giveWeapon(source, 24 , 9999)
giveWeapon(source, 28 , 9999)
giveWeapon(source, 31 , 9999)
end
addEvent("criarArmasEvento",true)
addEventHandler("criarArmasEvento",root,EventoArma)

function EventoJat ()
    if ( doesPedHaveJetPack ( source ) ) then     -- if the player has a jetpack
        removePedJetPack ( source )               -- remove it
    else
 givePedJetPack ( source )                 -- otherwise give him oneend
end
end
addEvent("criarJatEvento",true)
addEventHandler("criarJatEvento",root,EventoJat)


blip = createBlipAttachedTo(veiculo, 51, 3, 255, 0, 0, 255, 0, 65535)
-----------------------------------
veiculo = {}
function EventoCarro()
	if getPedOccupiedVehicle(source) then
		displayServerMessage(source, "Saia Do Veiculo Primeiro", "warning")
return
end
if veiculo[source] and isElement(veiculo[source]) then
		destroyElement(veiculo[source])
end
		local x, y, z = getElementPosition(source)
		veiculo[source] = createVehicle(402, x, y, z)
		warpPedIntoVehicle(source, veiculo[source])
		displayServerMessage(source, "Você Pegou carro Vip", "confirm")
end
addEvent("criarCarroEvento", true)
addEventHandler("criarCarroEvento", getRootElement(), EventoCarro)
--------------------------
function sair ()
if (irineu) and isElement(irineu) then
destroyElement (irineu)
destroyElement (blip)
end
end
addEvent("DestroirEvento",true)
addEventHandler ("DestroirEvento",root, sair)

espero que me ajuda...

Edited by Black09

Share this post


Link to post

Ta na mão chefe!

Adicione isso:

Server

addCommandHandler ("vip", function (thePlayer , cmd)
	if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (thePlayer)), aclGetGroup ("VIP")) then
		triggerClientEvent (thePlayer, "mostratVIP", thePlayer)
	else
		outputChatBox ("You are not VIP!", thePlayer)
	end
end)

Client

function abrirPainel ()
	if guiGetVisible (Painel) then
		guiSetVisible (Painel, false)
		showCursor (false)
	else
		guiSetVisible (Painel, true)
		showCursor (true)
	end
end
addEvent ("mostratVIP", true)
addEventHandler ("mostratVIP", getRootElement(), abrirPainel)

 

  • Thanks 1

Share this post


Link to post

Não consegui


client.Lua:


function ()
        Painel = guiCreateWindow(258, 158, 484, 470, "Painel VIP", false)
        guiWindowSetSizable(Painel, false)
		
        PegarArmas = guiCreateButton(0.04, 0.16, 0.27, 0.11, "armas", true, Painel)
        guiSetFont(PegarArmas, "default-bold-small")
        guiSetProperty(PegarArmas, "NormalTextColour", "E947F9AB")
        pegarCarro = guiCreateButton(0.04, 0.39, 0.27, 0.12, "carro", true, Painel)
        guiSetFont(pegarCarro, "default-bold-small")
        guiSetProperty(pegarCarro, "NormalTextColour", "E947F9AB")
        PegarJetpack = guiCreateButton(0.05, 0.67, 0.27, 0.13, "jetpack", true, Painel)
        guiSetFont(PegarJetpack, "default-bold-small")
        guiSetProperty(PegarJetpack, "NormalTextColour", "E947F9AB")
	    botaodestruir = guiCreateButton(0.38, 0.80, 0.30, 0.10, "destruir", true,Painel)
        guiSetFont(botaodestruir, "default-bold-small")
        guiSetProperty(botaodestruir, "NormalTextColour", "FF0AF468")  
      addEventHandler("onClientGUIClick",PegarArmas,ClicarNoBotao)
	  addEventHandler("onClientGUIClick",PegarJetpack,CliaBotao)
	  addEventHandler("onClientGUIClick",pegarCarro,ClicaBotao)
	  addEventHandler("onClientGUIClick",botaodestruir,CliaBot)
      	  
end

function abrirPainel ()
	if guiGetVisible (Painel) then
		guiSetVisible (Painel, false)
		showCursor (false)
	else
		guiSetVisible (Painel, true)
		showCursor (true)
end
end
addEvent ("mostratVIP", true)
addEventHandler ("mostratVIP", getRootElement(), abrirPainel)

function ClicarNoBotao(button,state)
if(button == "left")then
triggerServerEvent("criarArmasEvento",localPlayer)
end
end

function ClicaBotao(button,state)
if(button == "left")then
triggerServerEvent("criarCarroEvento",localPlayer)
end
end

function CliaBotao(button,state)
if(button == "left")then
triggerServerEvent("criarJatEvento",localPlayer)
end
end

function CliaBot(button,state)
if(button == "left")then
triggerServerEvent("DestroirEvento",localPlayer)
end
end

server.Lua:
 

addCommandHandler ("vip", function (thePlayer , cmd)
    if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (thePlayer)), aclGetGroup ("VIP")) then
        triggerClientEvent (thePlayer, "mostratVIP", thePlayer)
    else
        outputChatBox ("You are not VIP!", thePlayer)
end
end)

function EventoArma ()

giveWeapon(source, 31 , 9999)
giveWeapon(source, 27 , 9999)
giveWeapon(source, 34 , 9999)
giveWeapon(source, 16 , 9999)
giveWeapon(source, 4 , 9999)
giveWeapon(source, 24 , 9999)
giveWeapon(source, 28 , 9999)
giveWeapon(source, 31 , 9999)
end
addEvent("criarArmasEvento",true)
addEventHandler("criarArmasEvento",root,EventoArma)

function EventoJat ()
    if ( doesPedHaveJetPack ( source ) ) then     -- if the player has a jetpack
        removePedJetPack ( source )               -- remove it
    else
 givePedJetPack ( source )                 -- otherwise give him oneend
end
end
addEvent("criarJatEvento",true)
addEventHandler("criarJatEvento",root,EventoJat)


blip = createBlipAttachedTo(veiculo, 51, 3, 255, 0, 0, 255, 0, 65535)
-----------------------------------
veiculo = {}
function EventoCarro()
    if getPedOccupiedVehicle(source) then
        displayServerMessage(source, "Saia Do Veiculo Primeiro", "warning")
return
end
if veiculo[source] and isElement(veiculo[source]) then
        destroyElement(veiculo[source])
end
        local x, y, z = getElementPosition(source)
        veiculo[source] = createVehicle(402, x, y, z)
        warpPedIntoVehicle(source, veiculo[source])
        displayServerMessage(source, "Você Pegou carro Vip", "confirm")
end
addEvent("criarCarroEvento", true)
addEventHandler("criarCarroEvento", getRootElement(), EventoCarro)
--------------------------
function sair ()
if (irineu) and isElement(irineu) then
destroyElement (irineu)
destroyElement (blip)
end
end
addEvent("DestroirEvento",true)
addEventHandler ("DestroirEvento",root, sair)

 

oque estou fazendo de errado😩

Edited by Black09

Share this post


Link to post

Você tirou o evento do client "onClientResourceStart" do painel, por isso não abre pois, o painel não foi criado para o jogador.

Ex:

addEventHandler("onClientResourceStart", resourceRoot, function ()
        Painel = guiCreateWindow(258, 158, 484, 470, "Painel VIP", false)
        guiWindowSetSizable(Painel, false)
		
        PegarArmas = guiCreateButton(0.04, 0.16, 0.27, 0.11, "armas", true, Painel)
        guiSetFont(PegarArmas, "default-bold-small")
        guiSetProperty(PegarArmas, "NormalTextColour", "E947F9AB")
        pegarCarro = guiCreateButton(0.04, 0.39, 0.27, 0.12, "carro", true, Painel)
        guiSetFont(pegarCarro, "default-bold-small")
        guiSetProperty(pegarCarro, "NormalTextColour", "E947F9AB")
        PegarJetpack = guiCreateButton(0.05, 0.67, 0.27, 0.13, "jetpack", true, Painel)
        guiSetFont(PegarJetpack, "default-bold-small")
        guiSetProperty(PegarJetpack, "NormalTextColour", "E947F9AB")
        botaodestruir = guiCreateButton(0.38, 0.80, 0.30, 0.10, "destruir", true,Painel)
        guiSetFont(botaodestruir, "default-bold-small")
        guiSetProperty(botaodestruir, "NormalTextColour", "FF0AF468")  
        addEventHandler("onClientGUIClick",PegarArmas,ClicarNoBotao)
        addEventHandler("onClientGUIClick",PegarJetpack,CliaBotao)
        addEventHandler("onClientGUIClick",pegarCarro,ClicaBotao)
        addEventHandler("onClientGUIClick",botaodestruir,CliaBot)  
        guiSetVisible (Painel, false) --/> Adicionar !
end)

 

Edited by Angelo Pereira
  • Thanks 1

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.