Jump to content

Painel Dx


Recommended Posts

Ola bom fiz um painel dx com marker e o player quando ele passa a primeira vez ele n aparece mais na 2 aparece pode me ajudar pra fazer o painel dx aparecer na primeira tentativa n na segunda

esses sao os 2 codicos 

Quote

Server


desv = createMarker (1584.6145019531,-1678.8831787109,5.8976788520813 -1, "cylinder", 2, 254 ,0 ,0, 255)
myMarker = createMarker (1571.0413818359,-1682.8901367188,16.191499710083 -1, "cylinder", 1.5, 254 ,0 ,0, 255)

function showPanellr(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("PMF")) then ---So Mude  "PCC" Grupo que vai poder abrir o painel !
    triggerClientEvent(thePlayer, "painelpmf", getRootElement())
  end
end






veh = {}
function vtr1 ()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    veh[source] = createVehicle(596, 1598.3981933594,-1676.1922607422,5.8913125991821)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("vtr1",true)
addEventHandler("vtr1",root,vtr1)


veh = {}
function vtr2 ()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    veh[source] = createVehicle(401, 1598.3981933594,-1676.1922607422,5.8913125991821)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("vtr2",true)
addEventHandler("vtr2",root,vtr2)

veh = {}
function vtr3 ()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    veh[source] = createVehicle(523, 1598.3981933594,-1676.1922607422,5.8913125991821)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("vtr3",true)
addEventHandler("vtr3",root,vtr3)



function skin1 ()
     setPedSkin ( source, 281 )
	 outputChatBox ('( #00ff00INFO#ffffff )#ffff00Voce Pegou #00ff00Skin !',source,255,255,255,true)
end
addEvent("skin1",true)
addEventHandler ( "skin1", getRootElement(), skin1 )

function skin2 ()
     setPedSkin ( source, 280 )
   outputChatBox ('( #00ff00INFO#ffffff )#ffff00Voce Pegou #00ff00Skin !',source,255,255,255,true)
end
addEvent("skin2",true)
addEventHandler ( "skin2", getRootElement(), skin2 )


function apss ()
  takeAllWeapons ( source )
   setPedSkin ( source, 17 )
   giveWeapon( source, 24, 999, true )
   outputChatBox ('( #00ff00INFO#ffffff )#ffff00Voce Esta Apaisana !',source,255,255,255,true)
end
addEvent("apais",true)
addEventHandler ( "apais", getRootElement(), apss )

function xs()
triggerClientEvent(source, "painelpmf", getRootElement())
end
addEvent("xxxxxx",true)
addEventHandler ( "xxxxxx", getRootElement(), xs )




function armas ()
   giveWeapon( source, 23, 999, true )
   giveWeapon( source, 29, 999, true )
   giveWeapon( source, 31, 999, true )
	 outputChatBox ('( #00ff00INFO#ffffff )#ffff00Voce Pegou #00ff00Armas !',source,255,255,255,true)
end
addEvent("armsss",true)
addEventHandler ( "armsss", getRootElement(), armas )

function abrir2 (thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("PMF")) then ---So Mude  "PCC" Grupo que vai poder abrir o painel !
    triggerClientEvent(thePlayer, "painelpmf", getRootElement())
  end
end
addEventHandler( "onMarkerHit", myMarker, abrir2 )




veh = {}
function destroy()
    if isPedInVehicle(source) == true then
    destroyElement(veh[source])
    else
	outputChatBox ('( #00ff00INFO#ffffff )#ffff00Você não está em nenhum veiculo !',source,255,255,255,true)
    end
end
addEventHandler("onMarkerHit", desv, destroy)
Quote

client




local screenW,screenH = guiGetScreenSize()
local resW, resH = 1365,767
local x, y = (screenW/resW), (screenH/resH)

function Pdx ()
        dxDrawRectangle(25, 147, 319, 414, tocolor(0, 0, 0, 161), false)
        dxDrawRectangle(23, 147, 321, 55, tocolor(255, 255, 255, 255), false)
        dxDrawText("Policia Militar Fenix", 22, 147, 344, 202, tocolor(0, 0, 0, 255), 1.40, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(194, 212, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawRectangle(25, 212, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawText("SKIN 1", 23, 212, 175, 258, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("SKIN 2", 194, 212, 346, 258, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(194, 278, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawText("VTR 2", 192, 278, 344, 324, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(25, 278, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawText("VTR 1", 23, 278, 175, 324, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(85, 334, 199, 54, tocolor(64, 64, 64, 255), false)
        dxDrawText("ROCAM", 86, 334, 284, 384, tocolor(255, 255, 255, 255), 1.20, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(85, 404, 199, 54, tocolor(64, 64, 64, 255), false)
        dxDrawText("Armas", 86, 404, 284, 454, tocolor(255, 255, 255, 255), 1.20, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(85, 475, 199, 54, tocolor(64, 64, 64, 255), false)
        dxDrawText("APAISANA", 86, 475, 284, 525, tocolor(255, 255, 255, 255), 1.20, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(306, 530, 23, 21, tocolor(255, 255, 255, 255), false)
        dxDrawText("X", 306, 530, 334, 551, tocolor(0, 0, 0, 255), 1.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("painelpmf", true)
addEventHandler("painelpmf", 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 skin1 (_,state)
if painel == true then
if ( state == "down" ) then
if ( isCursorOnElement(194, 212, 150, 46)) then
triggerServerEvent ("skin1", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, skin1)

function skin2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(25, 212, 150, 46) then
triggerServerEvent ("skin2", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, skin2)

function xxxxxx2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(306, 530, 23, 21) then
triggerServerEvent ("xxxxxx", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, xxxxxx2)

function carro1 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(25, 278, 150, 46) then
triggerServerEvent ("vtr1", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, carro1)


function carro2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(194, 278, 150, 46) then
triggerServerEvent ("vtr2", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, carro2)


function moto (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(85, 334, 199, 54) then
triggerServerEvent ("vtr3", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, moto)


function armas (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(85, 404, 199, 54) then
triggerServerEvent ("armsss", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, armas)


function apais (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(85, 475, 199, 54) then
triggerServerEvent ("apais", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, apais)

 

Link to comment
  • Other Languages Moderators

Você está usando de maneira equivocada o botão de "quote" do fórum. Tome mais cuidado.

server-side: (substitua somente essa função)

function abrir2 (thePlayer)
	if (thePlayer) and (getElementType (thePlayer) == "player") then -- Se o elemento que colidiu no marker for um player, então:
		local accountname = getAccountName (getPlayerAccount(thePlayer))
		if isObjectInACLGroup ("user." .. accountname, aclGetGroup("PMF")) then -- So Mude "PCC" Grupo que vai poder abrir o painel!
			triggerClientEvent (thePlayer, "painelpmf", thePlayer) -- Não use getRootElement() em triggers.
		end
	end
end
addEventHandler ("onMarkerHit", myMarker, abrir2)

client-side: (substitua somente essa função)

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

 

  • Thanks 1
Link to comment
17 hours ago, Lord Henry said:

Você está usando de maneira equivocada o botão de "quote" do fórum. Tome mais cuidado.

server-side: (substitua somente essa função)


function abrir2 (thePlayer)	if (thePlayer) and (getElementType (thePlayer) == "player") then -- Se o elemento que colidiu no marker for um player, então:		local accountname = getAccountName (getPlayerAccount(thePlayer))		if isObjectInACLGroup ("user." .. accountname, aclGetGroup("PMF")) then -- So Mude "PCC" Grupo que vai poder abrir o painel!			triggerClientEvent (thePlayer, "painelpmf", thePlayer) -- Não use getRootElement() em triggers.		end	endendaddEventHandler ("onMarkerHit", myMarker, abrir2)

client-side: (substitua somente essa função)


function abrir ()	if (painel) then		showCursor(false)		removeEventHandler("onClientRender", root, Pdx)		painel = false	else		showCursor(true)		addEventHandler("onClientRender", root, Pdx)		painel = true	endendaddEvent ("painelpmf", true)addEventHandler ("painelpmf", root , abrir)

 

ata me desculpe eu não sabia vo testar aqui

Edited by zThyPvpTK
Link to comment

http://prntscr.com/ohk05g




local screenW,screenH = guiGetScreenSize()
local resW, resH = 1365,767
local x, y = (screenW/resW), (screenH/resH)

function Pdx ()
        dxDrawRectangle(25, 147, 319, 414, tocolor(0, 0, 0, 161), false)
        dxDrawRectangle(23, 147, 321, 55, tocolor(255, 255, 255, 255), false)
        dxDrawText("Policia Militar Fenix", 22, 147, 344, 202, tocolor(0, 0, 0, 255), 1.40, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(194, 212, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawRectangle(25, 212, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawText("SKIN 1", 23, 212, 175, 258, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("SKIN 2", 194, 212, 346, 258, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(194, 278, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawText("Heli", 192, 278, 344, 324, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(25, 278, 150, 46, tocolor(64, 64, 64, 255), false)
        dxDrawText("VTR 1", 23, 278, 175, 324, tocolor(246, 246, 246, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(85, 334, 199, 54, tocolor(64, 64, 64, 255), false)
        dxDrawText("ROCAM", 86, 334, 284, 384, tocolor(255, 255, 255, 255), 1.20, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(85, 404, 199, 54, tocolor(64, 64, 64, 255), false)
        dxDrawText("Armas", 86, 404, 284, 454, tocolor(255, 255, 255, 255), 1.20, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(85, 475, 199, 54, tocolor(64, 64, 64, 255), false)
        dxDrawText("APAISANA", 86, 475, 284, 525, tocolor(255, 255, 255, 255), 1.20, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawRectangle(306, 530, 23, 21, tocolor(255, 255, 255, 255), false)
        dxDrawText("X", 306, 530, 334, 551, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
    end





function abrir ()
    if (painel) then
        showCursor(false)
        removeEventHandler("onClientRender", root, Pdx)
        painel = false
    else
        showCursor(true)
        addEventHandler("onClientRender", root, Pdx)
        painel = true
    end
end
addEvent ("painelpmf", true)
addEventHandler ("painelpmf", 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 skin1 (_,state)
if painel == true then
if ( state == "down" ) then
if ( isCursorOnElement(194, 212, 150, 46)) then
triggerServerEvent ("skin1", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, skin1)

function skin2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(25, 212, 150, 46) then
triggerServerEvent ("skin2", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, skin2)

function xxxxxx2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(306, 530, 23, 21) then
triggerServerEvent ("xxxxxx", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, xxxxxx2)

function carro1 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(25, 278, 150, 46) then
triggerServerEvent ("vtr1", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, carro1)


function carro2 (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(194, 278, 150, 46) then
triggerServerEvent ("vtr2", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, carro2)


function moto (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(85, 334, 199, 54) then
triggerServerEvent ("vtr3", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, moto)


function armas (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(85, 404, 199, 54) then
triggerServerEvent ("armsss", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, armas)


function apais (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(85, 475, 199, 54) then
triggerServerEvent ("apais", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, apais)

 

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