Jump to content

como fazer para o painel dx abrir no marker ?


Recommended Posts

eu tinha feito com bind no "k", mas quero passar o painel para o marker.

  • Marker
glock = createMarker(297.947, -80.809, 1000.600, "cylinder", 1, 255, 0, 0, 40)
setElementInterior(glock, 4)
  • Server
function showPanellr(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Porte")) then 
    triggerClientEvent(thePlayer, "painelglock", getRootElement())
  end
end
function onResStartlr()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "k", "down", showPanellr)
  end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr)
function onPlayerJoinlr()
  bindKey(source, "k", "down", showPanellr)
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr)
function cleanAlllr(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "k", "down", showPanellr)
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr)

function arma ()
	 giveWeapon( source, 22, 300, true )
	 outputChatBox ('( #ff0000INFO#ffffff ) #ffff00Você comprou #00ff00Glock-18 !',source,255,255,255,true)
end
addEvent("glock",true)
addEventHandler ( "glock", getRootElement(), arma )
  • Client
local screenW,screenH = guiGetScreenSize()
local resW, resH = 1365,767
local x, y = (screenW/resW), (screenH/resH)

function Pdx ()
          dxDrawLine(333 - 1, 194 - 1, 333 - 1, 574, tocolor(38, 237, 11, 254), 1, false)
        dxDrawLine(691, 194 - 1, 333 - 1, 194 - 1, tocolor(38, 237, 11, 254), 1, false)
        dxDrawLine(333 - 1, 574, 691, 574, tocolor(38, 237, 11, 254), 1, false)
        dxDrawLine(691, 574, 691, 194 - 1, tocolor(38, 237, 11, 254), 1, false)
        dxDrawRectangle((screenW - 358) / 2, (screenH - 380) / 2, 358, 380, tocolor(0, 0, 0, 138), false)
        dxDrawImage(333, 194, 358, 380, ":GUI/images/examples/new_city_sfundo.png", 0, 0, 0, tocolor(254, 254, 254, 50), false)
        dxDrawImage(417, 257, 202, 160, ":GUI/images/examples/G-18.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(333, 194, 358, 53, tocolor(21, 133, 6, 111), false)
        dxDrawRectangle(359, 468, 310, 80, tocolor(21, 133, 6, 111), false)
        dxDrawText("R$15.000", 346, 417, 681, 463, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Glock-18", 338, 203, 681, 237, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("comprar", 372, 481, 659, 538, tocolor(255, 255, 255, 255), 2.00, "pricedown", "center", "center", false, false, false, false, false)
    end

function abrir (_,state)
if painel == false then
showCursor(true)
addEventHandler("onClientRender", root, Pdx)
painel = true
else
showCursor(false)
removeEventHandler("onClientRender", root, Pdx)
painel = false
end
end
addEvent("painelglock", true)
addEventHandler("painelglock", root , abrir)

function togglePanel()
	if getElementData(localPlayer,nomeDaACL_Comandante) then
		if not isEventHandlerAdded("onClientRender",root,onClientRender) then
			guiGridListClear(playerList)
			for id, player in ipairs(getElementsByType("player")) do
				guiGridListSetItemText(playerList, guiGridListAddRow(playerList), 1, getPlayerName(player):gsub('#%x%x%x%x%x%x', ''), false, false)
			end
			guiSetVisible(playerList,true)
			guiSetVisible(edit,true)
			aVisible = true
			rVisible = true
			addEventHandler("onClientRender",root,onClientRender)
			showCursor(true)
		else
			guiSetVisible(playerList,false)
			guiSetVisible(edit,false)
			removeEventHandler("onClientRender",root,onClientRender)
			showCursor(false)			
		end
	end
end

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 arma (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(372, 481, 659, 538) then
triggerServerEvent ("glock", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, arma)

preciso só da introdução do comando o resto deixa cmg (faz tempo que não mexo com isso, ja esqueci de muitas coisas)

quero por o painel de comprar a glock no marker indicado....

Link to comment
10 hours ago, DNL291 said:

Percebi que ambas as contas pertencem ao mesmo IP, Por que usar outra conta pra mesma pergunta sendo que já foi respondido no outro tópico?

A outra n ta aceitando a senha, vou deixar essa como principal!

 

10 hours ago, DNL291 said:

Percebi que ambas as contas pertencem ao mesmo IP, Por que usar outra conta pra mesma pergunta sendo que já foi respondido no outro tópico?

Mas obrigado por encaminhar! eu n tava achando o topico ❤️

Link to comment
  • Other Languages Moderators
3 hours ago, MatheusWW said:

A outra n ta aceitando a senha, vou deixar essa como principal!

Solicite a remoção da outra conta, ou então para juntar o conteúdo daquela nesta conta.

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