Jump to content

Agencia ilegal por ACL


Recommended Posts

E aí galera, tudo ok?

Seguinte, estava tentando por uma agencia de empregos ilegais por ACL. Ela é da Net, porém não consegui

Client side:

local screenW, screenH = guiGetScreenSize()
local x, y = (screenW/1366), (screenH/768)


local dxfont0_icons = dxCreateFont("font/icons.ttf", x*12)
local dxfont1_icons = dxCreateFont("font/icons.ttf", x*13)

painel4 = false

setTimer(function()
    local PED_Agencia = createPed(SkinPED2, pedX2, pedY2, pedZ2)
	local myBlip = createBlip( pedX2, pedY2, pedZ2, blipID2)
	setBlipVisibleDistance(myBlip, 300)
setPedRotation(PED_Agencia,0)
setElementData(PED_Agencia, "TS:Agencia", true)
setElementData(PED_Agencia, "TS:AnuncioAgencia", TextoPED2)
setElementFrozen(PED_Agencia,true)
setPedAnimation(PED_Agencia, "COP_AMBIENT", "Coplook_loop")
function Cancel_Damage ()
	cancelEvent() 
end
addEventHandler("onClientPedDamage", PED_Agencia, Cancel_Damage)

function Ped_Click (_, state)
	if getElementData(PED_Agencia, "TS:Agencia") then
		if state == "down" then
			local x, y, z = getElementPosition(getLocalPlayer())
			local wx, wy, wz = getElementPosition(PED_Agencia)
			if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <= 5 then 
				AbrirAgenciaIlegal ()
			end
		end
	end
end
addEventHandler("onClientClick", getRootElement(), Ped_Click)

end, 1000, 1)

EmpregosTabel = {
	{"Fabricante de armas", 5}, ---- Emprego, Level
	{"Assassino de aluguel", 10}, ---- Emprego, Level
	{"Traficante De Orgaos", 15}, ---- Emprego, Level
	{"Transportador De Cocaina", 5}, ---- Emprego, Level
	{"Produtor de maconha", 20}, ---- Emprego, Level
}

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><          Painel Inicial            ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function PainelAgencia ()
        exports["Blur"]:dxDrawBluredRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.4844, tocolor(255, 255, 255, 230))	
        dxDrawRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.4844, tocolor(0, 0, 0, 131), false)
        dxDrawRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.0625, tocolor(0, 0, 0, 150), false)
        dxDrawLine(screenW * 0.3353, screenH * 0.3203, screenW * 0.6654, screenH * 0.3203, tocolor(0, 45, 215, 255), 3, false)
        dxDrawText("Agência Ilegal", screenW * 0.4627, screenH * 0.2708, screenW * 0.5388, screenH * 0.2982, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
		if isCursorOnElement(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then
		dxDrawImage(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 255), false)
		else
			dxDrawImage(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 154), false)
		end
		if isCursorOnElement(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then
		dxDrawImage(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 255), false)
		else
			dxDrawImage(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 154), false)
		end
        dxDrawText("Pegar Emprego", screenW * 0.3902, screenH * 0.6380, screenW * 0.4663, screenH * 0.6654, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
        dxDrawText("Fechar Painel", screenW * 0.5300, screenH * 0.6380, screenW * 0.6061, screenH * 0.6654, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
    end

addEventHandler("onClientResourceStart", resourceRoot,
  function ()
    ListaAgencia = dxGridW:Create(468, 256, 427, 204)
    ListaAgencia:AddColumn("Empregos", 200)
    ListaAgencia:AddColumn("Level", 130)
    ListaAgencia:SetVisible(false)	
	for i,EmpregosAgencia in ipairs (EmpregosTabel) do
	ListaAgencia:AddItem(1, tostring(EmpregosAgencia[1]))
	ListaAgencia:AddItem(2, tostring(EmpregosAgencia[2]))
	end
end)


--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><      Configurações N Altere        ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function convertTime(ms) 
    local min = math.floor ( ms/60000 ) 
    local sec = math.floor( (ms/1000)%60 ) 
    return min, sec 
end

function AbrirAgenciaIlegal ()
if painel4 == false then
  addEventHandler ( "onClientRender", root, PainelAgencia )
  painel4 = true
  showCursor ( true )
 playSoundFrontEnd ( 43 )
  ListaAgencia:SetVisible(true)
end
end

function FecharAgencia ()
if painel4 == true then
if isCursorOnElement(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then 
ListaAgencia:SetVisible(false)
    painel4 = false
    removeEventHandler ( "onClientRender", root, PainelAgencia )
    showCursor (false)
    playSoundFrontEnd ( 43 )
end
end
end
addEventHandler ( "onClientClick", root, FecharAgencia )

function PegarEmprego ( _,state )
	if painel4 == true then  
		if state == "down" then 
			if isCursorOnElement(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then 
				if ListaAgencia:GetSelectedItem() then
					local Emprego = ListaAgencia:GetItemDetails(1, ListaAgencia:GetSelectedItem())
					local Level = ListaAgencia:GetItemDetails(2, ListaAgencia:GetSelectedItem())
					playSoundFrontEnd(12)
					triggerServerEvent("TS:AgenciaEmpregos", getLocalPlayer(), localPlayer, Emprego, Level)
				else
					triggerEvent("addNotification", root, "#ffffff#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff #ffffffSelecione o Emprego que Você Deseja", "info")
				end 
			end
		end
	end
end
addEventHandler ( "onClientClick", root, PegarEmprego )

function renderIng( )
	local x, y, z = getCameraMatrix( )
	local dimension = getElementDimension( localPlayer )	
	for key, ped in ipairs ( getElementsByType( "ped" ) ) do
		if getElementDimension( ped ) == dimension then
			local px, py, pz = getElementPosition( ped )
			local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
			if distance <= 7 then
				local text = getElementData( ped, "TS:AnuncioAgencia" )	
				if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
					local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 )
					if sx and sy then
						local w = dxGetTextWidth( tostring( text ) )
						local h = ( text and 2 or 1 ) * dxGetFontHeight( )
						dxDrawText( tostring( text ), sx +30, sy +50, sx, sy, tocolor( 255, 255, 255, 255 ), 1.00, dxfont1_icons, "center", "center", false, false, false, true, false )
					end
				end
			end
		end
	end	
end
addEventHandler( "onClientRender", getRootElement( ),renderIng)

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

Server side:

function AgenciaEmpregos (source, Emprego, Level)
    local Level = tonumber(Level)
    local Level2 = tonumber(getElementData(source,"Level")) or 0
	if Level2 >= Level then
	setElementData(source, "Emprego", Emprego)
    triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê agora é um "..Emprego..", cuidado com a policia!", "info")
	else
   triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê não tem level suficiente para este trabalho!", "info")
end
end
addEvent ("TS:AgenciaEmpregos", true)
addEventHandler ("TS:AgenciaEmpregos", root, AgenciaEmpregos)

 

Link to comment

Boa noite, tente:

 

Server-side.

 

local ACL = "ilegal"

function AgenciaEmpregos (source, Emprego, Level)
    local Level = tonumber(Level)
    local Level2 = tonumber(getElementData(source,"Level")) or 0
	if Level2 >= Level then
	setElementData(source, "Emprego", Emprego)
    triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê agora é um "..Emprego..", cuidado com a policia!", "info")
	else
   triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê não tem level suficiente para este trabalho!", "info")
end
end
addEvent ("TS:AgenciaEmpregos", true)
addEventHandler ("TS:AgenciaEmpregos", root, AgenciaEmpregos)

function VerificarACL ()
    local Conta = getAccountName ( getPlayerAccount ( source ) ) 
     if isObjectInACLGroup ("user."..Conta, aclGetGroup ( ""..ACL ) ) then 
	     triggerClientEvent(source, "AbrirPainelAgencia", root)
	 end 
end
addEvent ("VerificarACL", true)
addEventHandler ("VerificarACL", root, VerificarACL)

 

Client-Side:

 

local screenW, screenH = guiGetScreenSize()
local x, y = (screenW/1366), (screenH/768)


local dxfont0_icons = dxCreateFont("font/icons.ttf", x*12)
local dxfont1_icons = dxCreateFont("font/icons.ttf", x*13)

painel4 = false

setTimer(function()
    local PED_Agencia = createPed(SkinPED2, pedX2, pedY2, pedZ2)
	local myBlip = createBlip( pedX2, pedY2, pedZ2, blipID2)
	setBlipVisibleDistance(myBlip, 300)
setPedRotation(PED_Agencia,0)
setElementData(PED_Agencia, "TS:Agencia", true)
setElementData(PED_Agencia, "TS:AnuncioAgencia", TextoPED2)
setElementFrozen(PED_Agencia,true)
setPedAnimation(PED_Agencia, "COP_AMBIENT", "Coplook_loop")
function Cancel_Damage ()
	cancelEvent() 
end
addEventHandler("onClientPedDamage", PED_Agencia, Cancel_Damage)

function Ped_Click (_, state)
	if getElementData(PED_Agencia, "TS:Agencia") then
		if state == "down" then
			local x, y, z = getElementPosition(getLocalPlayer())
			local wx, wy, wz = getElementPosition(PED_Agencia)
			if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <= 5 then 
				triggerServerEvent("VerificarACL", getLocalPlayer())
			end
		end
	end
end
addEventHandler("onClientClick", getRootElement(), Ped_Click)

end, 1000, 1)

EmpregosTabel = {
	{"Fabricante de armas", 5}, ---- Emprego, Level
	{"Assassino de aluguel", 10}, ---- Emprego, Level
	{"Traficante De Orgaos", 15}, ---- Emprego, Level
	{"Transportador De Cocaina", 5}, ---- Emprego, Level
	{"Produtor de maconha", 20}, ---- Emprego, Level
}

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><          Painel Inicial            ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function PainelAgencia ()
        exports["Blur"]:dxDrawBluredRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.4844, tocolor(255, 255, 255, 230))	
        dxDrawRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.4844, tocolor(0, 0, 0, 131), false)
        dxDrawRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.0625, tocolor(0, 0, 0, 150), false)
        dxDrawLine(screenW * 0.3353, screenH * 0.3203, screenW * 0.6654, screenH * 0.3203, tocolor(0, 45, 215, 255), 3, false)
        dxDrawText("Agência Ilegal", screenW * 0.4627, screenH * 0.2708, screenW * 0.5388, screenH * 0.2982, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
		if isCursorOnElement(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then
		dxDrawImage(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 255), false)
		else
			dxDrawImage(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 154), false)
		end
		if isCursorOnElement(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then
		dxDrawImage(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 255), false)
		else
			dxDrawImage(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 154), false)
		end
        dxDrawText("Pegar Emprego", screenW * 0.3902, screenH * 0.6380, screenW * 0.4663, screenH * 0.6654, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
        dxDrawText("Fechar Painel", screenW * 0.5300, screenH * 0.6380, screenW * 0.6061, screenH * 0.6654, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
    end

addEventHandler("onClientResourceStart", resourceRoot,
  function ()
    ListaAgencia = dxGridW:Create(468, 256, 427, 204)
    ListaAgencia:AddColumn("Empregos", 200)
    ListaAgencia:AddColumn("Level", 130)
    ListaAgencia:SetVisible(false)	
	for i,EmpregosAgencia in ipairs (EmpregosTabel) do
	ListaAgencia:AddItem(1, tostring(EmpregosAgencia[1]))
	ListaAgencia:AddItem(2, tostring(EmpregosAgencia[2]))
	end
end)


--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><      Configurações N Altere        ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function convertTime(ms) 
    local min = math.floor ( ms/60000 ) 
    local sec = math.floor( (ms/1000)%60 ) 
    return min, sec 
end

function AbrirAgenciaIlegal ()
if painel4 == false then
  addEventHandler ( "onClientRender", root, PainelAgencia )
  painel4 = true
  showCursor ( true )
 playSoundFrontEnd ( 43 )
  ListaAgencia:SetVisible(true)
end
end
addEvent("AbrirPainelAgencia", true)
addEventHandler("AbrirPainelAgencia", getRootElement(), AbrirAgenciaIlegal)



function FecharAgencia ()
if painel4 == true then
if isCursorOnElement(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then 
ListaAgencia:SetVisible(false)
    painel4 = false
    removeEventHandler ( "onClientRender", root, PainelAgencia )
    showCursor (false)
    playSoundFrontEnd ( 43 )
end
end
end
addEventHandler ( "onClientClick", root, FecharAgencia )

function PegarEmprego ( _,state )
	if painel4 == true then  
		if state == "down" then 
			if isCursorOnElement(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then 
				if ListaAgencia:GetSelectedItem() then
					local Emprego = ListaAgencia:GetItemDetails(1, ListaAgencia:GetSelectedItem())
					local Level = ListaAgencia:GetItemDetails(2, ListaAgencia:GetSelectedItem())
					playSoundFrontEnd(12)
					triggerServerEvent("TS:AgenciaEmpregos", getLocalPlayer(), localPlayer, Emprego, Level)
				else
					triggerEvent("addNotification", root, "#ffffff#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff #ffffffSelecione o Emprego que Você Deseja", "info")
				end 
			end
		end
	end
end
addEventHandler ( "onClientClick", root, PegarEmprego )

function renderIng( )
	local x, y, z = getCameraMatrix( )
	local dimension = getElementDimension( localPlayer )	
	for key, ped in ipairs ( getElementsByType( "ped" ) ) do
		if getElementDimension( ped ) == dimension then
			local px, py, pz = getElementPosition( ped )
			local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
			if distance <= 7 then
				local text = getElementData( ped, "TS:AnuncioAgencia" )	
				if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
					local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 )
					if sx and sy then
						local w = dxGetTextWidth( tostring( text ) )
						local h = ( text and 2 or 1 ) * dxGetFontHeight( )
						dxDrawText( tostring( text ), sx +30, sy +50, sx, sy, tocolor( 255, 255, 255, 255 ), 1.00, dxfont1_icons, "center", "center", false, false, false, true, false )
					end
				end
			end
		end
	end	
end
addEventHandler( "onClientRender", getRootElement( ),renderIng)

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

 

  • Thanks 1
Link to comment

Para evitar problemas, crie uma tecla para fechar (Coloquei como padrão o x)

 

local screenW, screenH = guiGetScreenSize()
local x, y = (screenW/1366), (screenH/768)
local LetraFechar = "X"

local dxfont0_icons = dxCreateFont("font/icons.ttf", x*12)
local dxfont1_icons = dxCreateFont("font/icons.ttf", x*13)

painel4 = false

setTimer(function()
    local PED_Agencia = createPed(SkinPED2, pedX2, pedY2, pedZ2)
	local myBlip = createBlip( pedX2, pedY2, pedZ2, blipID2)
	setBlipVisibleDistance(myBlip, 300)
setPedRotation(PED_Agencia,0)
setElementData(PED_Agencia, "TS:Agencia", true)
setElementData(PED_Agencia, "TS:AnuncioAgencia", TextoPED2)
setElementFrozen(PED_Agencia,true)
setPedAnimation(PED_Agencia, "COP_AMBIENT", "Coplook_loop")
function Cancel_Damage ()
	cancelEvent() 
end
addEventHandler("onClientPedDamage", PED_Agencia, Cancel_Damage)

function Ped_Click (_, state)
	if getElementData(PED_Agencia, "TS:Agencia") then
		if state == "down" then
			local x, y, z = getElementPosition(getLocalPlayer())
			local wx, wy, wz = getElementPosition(PED_Agencia)
			if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <= 5 then 
				triggerServerEvent("VerificarACL", getLocalPlayer())
			end
		end
	end
end
addEventHandler("onClientClick", getRootElement(), Ped_Click)

end, 1000, 1)

EmpregosTabel = {
	{"Fabricante de armas", 5}, ---- Emprego, Level
	{"Assassino de aluguel", 10}, ---- Emprego, Level
	{"Traficante De Orgaos", 15}, ---- Emprego, Level
	{"Transportador De Cocaina", 5}, ---- Emprego, Level
	{"Produtor de maconha", 20}, ---- Emprego, Level
}

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><          Painel Inicial            ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function PainelAgencia ()
        exports["Blur"]:dxDrawBluredRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.4844, tocolor(255, 255, 255, 230))	
        dxDrawRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.4844, tocolor(0, 0, 0, 131), false)
        dxDrawRectangle(screenW * 0.3353, screenH * 0.2578, screenW * 0.3302, screenH * 0.0625, tocolor(0, 0, 0, 150), false)
        dxDrawLine(screenW * 0.3353, screenH * 0.3203, screenW * 0.6654, screenH * 0.3203, tocolor(0, 45, 215, 255), 3, false)
        dxDrawText("Agência Ilegal", screenW * 0.4627, screenH * 0.2708, screenW * 0.5388, screenH * 0.2982, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
		if isCursorOnElement(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then
		dxDrawImage(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 255), false)
		else
			dxDrawImage(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 154), false)
		end
		if isCursorOnElement(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then
		dxDrawImage(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 255), false)
		else
			dxDrawImage(screenW * 0.5146, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586, "0.png", 0, 0, 0, tocolor(0, 45, 215, 154), false)
		end
        dxDrawText("Pegar Emprego", screenW * 0.3902, screenH * 0.6380, screenW * 0.4663, screenH * 0.6654, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
        dxDrawText("Fechar Painel", screenW * 0.5300, screenH * 0.6380, screenW * 0.6061, screenH * 0.6654, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false)
    end

addEventHandler("onClientResourceStart", resourceRoot,
  function ()
    ListaAgencia = dxGridW:Create(468, 256, 427, 204)
    ListaAgencia:AddColumn("Empregos", 200)
    ListaAgencia:AddColumn("Level", 130)
    ListaAgencia:SetVisible(false)	
	for i,EmpregosAgencia in ipairs (EmpregosTabel) do
	ListaAgencia:AddItem(1, tostring(EmpregosAgencia[1]))
	ListaAgencia:AddItem(2, tostring(EmpregosAgencia[2]))
	end
end)


--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><      Configurações N Altere        ><
         ><><><><><><><><><><><><><><><><><><><><
--]]

function convertTime(ms) 
    local min = math.floor ( ms/60000 ) 
    local sec = math.floor( (ms/1000)%60 ) 
    return min, sec 
end

function AbrirAgenciaIlegal ()
if painel4 == false then
  addEventHandler ( "onClientRender", root, PainelAgencia )
  painel4 = true
  showCursor ( true )
 playSoundFrontEnd ( 43 )
  ListaAgencia:SetVisible(true)
end
end
addEvent("AbrirPainelAgencia", true)
addEventHandler("AbrirPainelAgencia", getRootElement(), AbrirAgenciaIlegal)



function FecharAgencia ()
if painel4 == true then
ListaAgencia:SetVisible(false)
    painel4 = false
    removeEventHandler ( "onClientRender", root, PainelAgencia )
    showCursor (false)
    playSoundFrontEnd ( 43 )
end
end
bindKey(LetraFechar, "down", FecharAgencia)


function PegarEmprego ( _,state )
	if painel4 == true then  
		if state == "down" then 
			if isCursorOnElement(screenW * 0.3763, screenH * 0.6250, screenW * 0.1076, screenH * 0.0586) then 
				if ListaAgencia:GetSelectedItem() then
					local Emprego = ListaAgencia:GetItemDetails(1, ListaAgencia:GetSelectedItem())
					local Level = ListaAgencia:GetItemDetails(2, ListaAgencia:GetSelectedItem())
					playSoundFrontEnd(12)
					triggerServerEvent("TS:AgenciaEmpregos", getLocalPlayer(), localPlayer, Emprego, Level)
				else
					triggerEvent("addNotification", root, "#ffffff#0037FF✘#ffffffINFO#0037FF✘➺ #ffffff #ffffffSelecione o Emprego que Você Deseja", "info")
				end 
			end
		end
	end
end
addEventHandler ( "onClientClick", root, PegarEmprego )

function renderIng( )
	local x, y, z = getCameraMatrix( )
	local dimension = getElementDimension( localPlayer )	
	for key, ped in ipairs ( getElementsByType( "ped" ) ) do
		if getElementDimension( ped ) == dimension then
			local px, py, pz = getElementPosition( ped )
			local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z )
			if distance <= 7 then
				local text = getElementData( ped, "TS:AnuncioAgencia" )	
				if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then
					local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 )
					if sx and sy then
						local w = dxGetTextWidth( tostring( text ) )
						local h = ( text and 2 or 1 ) * dxGetFontHeight( )
						dxDrawText( tostring( text ), sx +30, sy +50, sx, sy, tocolor( 255, 255, 255, 255 ), 1.00, dxfont1_icons, "center", "center", false, false, false, true, false )
					end
				end
			end
		end
	end	
end
addEventHandler( "onClientRender", getRootElement( ),renderIng)

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

 

  • Thanks 1
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...