Jump to content

EU QUERIA CRIAR PAINEL DE CORP POR MARKER DE PEGAR SKIN ARMAMENTOS ?


Recommended Posts

EU TENTEI CRIAR 1 MARKER QUE QUANDO PASSASE EM CIMA ABRISSI O PAINEL DO GUI SO QUE A PESSOA PODIA ABRIR O PAINE FORA DO MARKER E QUANDO EU RETIREI O BOTÃO DE ABRIR O PAINEL E FECHAR DAVA ERRO POIS NÃO TINAH COMO FEIXAR O PAINEL QUANDO PASSAVA NO MARKER ALGUEM PODERIA ME AJUDAR COMEÇEI A ESTUDA SCRIPT A POUCO TEMPO TO NO BASICO AINDA 

Link to comment

EU CRIEI UMA FUNÇÃO DE APERTA K  SO QUE EU QUEIRA A FUNÇÃO SO PARA FECHAR O PAINEL

 function onResStartlr()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
    end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr)
function onPlayerJoinlr()
  bindKey(source, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr)
function cleanAlllr(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr)

Link to comment

e por server e  client 

server

function showPanellr(thePlayer)
  accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("PMESP")) then ---So Mude  "PCC" Grupo que vai poder abrir o painel !
    triggerClientEvent(thePlayer, "painelpmesp", getRootElement())
  end
end
function onResStartlr()
  for index, player in ipairs(getElementsByType("player")) do
    bindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
	end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr)
function onPlayerJoinlr()
  bindKey(source, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
end
addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr)
function cleanAlllr(player)
  for index, player in ipairs(getElementsByType("player")) do
    unbindKey(player, "k", "down", showPanellr)------"K" Botao Para Abrir O Painel
  end
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr)

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

function armas ()
     giveWeapon( source, 33, 999, true )
	 giveWeapon( source, 22, 999, true )
	 giveWeapon( source, 31, 999, true )
	 giveWeapon( source, 29, 999, true )
	 giveWeapon( source, 25, 999, true )
	 giveWeapon( source, 18, 999, true )
	 giveWeapon( source, 1, 999, true )
	 outputChatBox ('( #00ff00INFO#ffffff )#ffff00Voce Pegou #00ff00Armas !',source,255,255,255,true)
end
addEvent("armaspmesp",true)
addEventHandler ( "armaspmesp", getRootElement(), armas )

client 




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

function Pdx ()
        dxDrawRectangle(503, 187, 348, 437, tocolor(0, 0, 0, 90), false)
        dxDrawRectangle(505, 190, 346, 46, tocolor(254, 254, 254, 255), false)
        dxDrawText("[BLACK] PMESP", 504, 190, 851, 236, tocolor(17, 6, 236, 255), 2.50, "sans", "center", "center", false, false, false, false, false)
        dxDrawRectangle(503, 266, 348, 53, tocolor(29, 1, 240, 255), false)
        dxDrawText("", 502, 266, 502, 266, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        dxDrawText("ARMAMENTOS", 502, 267, 851, 319, tocolor(254, 254, 254, 255), 3.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawRectangle(410, 285, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(504, 338, 347, 52, tocolor(0, 32, 226, 255), false)
        dxDrawRectangle(503, 418, 348, 56, tocolor(226, 0, 0, 255), false)
        dxDrawRectangle(503, 518, 131, 41, tocolor(255, 255, 255, 255), false)
        dxDrawText("SKIN", 503, 339, 851, 390, tocolor(255, 255, 255, 255), 3.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText("APAISANA", 502, 418, 851, 474, tocolor(255, 255, 255, 255), 4.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText("FECHAR", 503, 518, 634, 559, tocolor(0, 0, 0, 255), 2.00, "sans", "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("painelpmesp", true)
addEventHandler("painelpmesp", 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 skin (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(504, 338, 347, 52) then
triggerServerEvent ("skinspmesp", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, skin)

function armas (_,state)
if painel == true then
if  state == "down"  then
if  isCursorOnElement(503, 266, 348, 53) then
triggerServerEvent ("armaspmesp", localPlayer)
end
end
end
end
addEventHandler ("onClientClick", root, armas)

 

Edited by Lord Henry
Removido quote desnecessário.
Link to comment
9 hours ago, Lord Henry said:

Você está usando a função útil isEventHandlerAdded. Por se tratar de uma useful function, falta o código-fonte dela.

tem como eu transformar o codico de abrir o e fechar o painel em só fechar. porque eu criri um marker saparado com a função de abrir . 

Edited by WENBLECK
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...