Jump to content

O que fazer quando isso acontece?


Recommended Posts

Posted

Eu preciso de ajuda, peguei de base um sistema de sedex que eu tinha, e nesse estou tentando fazer outro para entregar butijão de gás nas casas...

Mas até quando eu vou pegar o botijão, o uniforme ou o carro, ele usa as informações do sistema do Sedex, mesmo eu mudando o ElementData...

Aqui está o código normal, do próprio Sedex, queria saber as mudanças para que ele fique praticamente um outro sistema (entregar gás) com o mesmo código

Eu só preciso trocar o objectid dps, até pq no mod do sedex ele pega uma caixa, aí estava pensando em usar o object id (1370), que no caso é o botijão...

Se alguém me ajudar ficaria muito grato, dou fav no que me ajudar ;) 

Server:

Marker_Aleatorios = -- ADICIONE AQUI OS LOCAIS QUE O JOGADOR DEVE PASSAR
 {   
   {2068.24609, -1731.58191, 13.87616},
   {2068.04126, -1656.60168, 13.54688},
   {2244.13843, -1638.71289, 15.90741},
   {2362.96875, -1644.05603, 13.53448},
   {2495.21948, -1686.87842, 13.51452},
   {2402.39307, -1716.66272, 13.63514},
   {2636.39722, -2012.44897, 13.81386},
   {2523.80981, -1998.94214, 13.78261},
   {2241.90771, -1885.28027, 13.54688},
   {1936.28735, -1923.59924, 13.54688},
   {1830.26245, -1173.45874, 23.82813},
   {1335.48645, -1065.77051, 27.91941},
   {880.21442, -1423.76440, 14.48554},
   {648.45441, -1694.37317, 14.79229},
   {766.98206, -1746.01270, 12.53445},
 }

local Painel_Open = createMarker(784.00983, -1333.99451, 13.54025 -1, "cylinder", 1.2, 16, 111, 231, 90)
local Blip_Emprego = createBlip(784.00983, -1333.99451, 13.54025, 38 )
setBlipVisibleDistance(Blip_Emprego, 150)

function Abrir_Painel (source)
	local Emprego = getElementData ( source, "Emprego" )
    if isElementWithinMarker(source, Painel_Open) then
		if Emprego == "Entregador de Gas" then
			if getElementData ( source, "Entrega_Acionada" ) == false then
				triggerClientEvent(source, "DNL:Abrir_Correios", source)	
			else
				triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê já está em uma viagem e não pode pegar outra", "info")
			end
		else 
			triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffApenas Motoristas do Sedex pode pegar correiros", "info")
		end
	end
end
addEventHandler( "onMarkerHit", Painel_Open, Abrir_Painel )

 --[[
         ><><><><><><><><><><><><><><><><><><><><
         ><             Infos Trab             ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
local Blip_Marcar = createBlipAttachedTo( Blip_Emprego, 0 )
setElementVisibleTo ( Blip_Marcar, root, false )
function Infos_Emprego ( source )
	local Emprego = getElementData ( source, "Emprego" )
	if Emprego == "Entregador de Gas" then
		if isElementVisibleTo ( Blip_Marcar, source ) then
			setElementVisibleTo ( Blip_Marcar, source, false )
			triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffSeu Local de Trabalho foi Desmarcado do Mapa", "info")
		else
			setElementVisibleTo ( Blip_Marcar, source, true )
			triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffSeu Local de Trabalho foi Marcado no Mapa", "info")
		end
	end	
end    
addCommandHandler ( "infos", Infos_Emprego )
 --[[
         ><><><><><><><><><><><><><><><
         ><       Pegar Cargas       ><
         ><><><><><><><><><><><><><><><
--]]
function Pegar_Cargas (source)
	local Cargas = tonumber(getElementData(source, "DNL:Cargas")) or 0
	if Cargas < 25 then
		setElementData(source, "DNL:Cargas", Cargas +1)
		setElementData(source, "DNL:Entregar_Cargas", true)
		triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê Pegou Uma Caixa ("..Cargas.."/25)", "info")
	else		
		setElementData(source, "DNL:Cargas", 25)
		triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê já pegou o máximo de caixas para entregar", "info")
	end
end
addEvent("DNL:Pegar_Cargas", true)
addEventHandler("DNL:Pegar_Cargas", root, Pegar_Cargas)

--[[
         ><><><><><><><><><><><><><><><
         ><        Pegar Carro       ><
         ><><><><><><><><><><><><><><><
--]]
Carro = {}
function Pegar_Carro (source)
	if getElementData ( source, "DNL:Entregar_Cargas" ) == true then
		if isElement(Carro[source]) then destroyElement(Carro[source]) end
		Carro[source] = createVehicle(413, 777.72870, -1337.64941, 13.53258)
		setElementRotation(Carro[source], 0,0,0)
		setElementInterior(Carro[source], 0)
		setElementDimension(Carro[source], 0)
		warpPedIntoVehicle ( source, Carro[source] )
		setElementInterior(source, 0)
		setElementDimension(source, 0)
		triggerClientEvent(source, "DNL:Fechar_Correios", source)
		triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffDigite /entregarcaixas para começar a entregar as encomendas", "info")
	else
		triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê deve pegar encomendas para que pegue a van da empresa", "info")
	end
end
addEvent("DNL:Pegar_Carro", true)
addEventHandler("DNL:Pegar_Carro", root, Pegar_Carro)

--[[
         ><><><><><><><><><><><><><><><><><
         ><        Pegar Uniforme        ><
         ><><><><><><><><><><><><><><><><><
--]]
function Pegar_Uniforme (source)
	if getElementData ( source, "DNL:Entregar_Cargas" ) == true then
		setElementModel(source, 300)
		triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê pegou o uniforme da empresa", "info")
	else
		triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê deve pegar encomendas para que pegue o uniforme da empresa", "info")
	end
end
addEvent("DNL:Pegar_Uniforme(Sedex)", true)
addEventHandler("DNL:Pegar_Uniforme(Sedex)", root, Pegar_Uniforme)

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><              Trabalho              ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
Object_Caixa = {}
Marker_Entregar = {}
Blip_Entregar = {}
Marker_Van = {}

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><           Iniciar Entrega          ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
function Entregar_Caixas (source) 		
	local Emprego = getElementData ( source, "Emprego" )
	local Occupied_Veh = getPedOccupiedVehicle(source)
	local Cargas = tonumber(getElementData(source, "DNL:Cargas")) or 0
	local Random_Pos = math.random ( #Marker_Aleatorios )
	if isPedInVehicle ( source ) then
		if (getElementModel (Occupied_Veh) == 413) then
			if Cargas >= 1 then 		
				if Emprego == "Entregador de Gas" then
					if getElementData ( source, "Entrega_Acionada" ) == false then
						if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
						if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
						if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
						setElementData(source, "Entrega_Acionada", true)
						Marker_Entregar[source] = createMarker ( Marker_Aleatorios[Random_Pos][1], Marker_Aleatorios[Random_Pos][2], Marker_Aleatorios[Random_Pos][3] -1, "cylinder", 1.2, 0 ,255 ,0, 50)	
						Blip_Entregar[source] = createBlipAttachedTo( Marker_Entregar[source], 0 )								
						setElementVisibleTo ( Marker_Entregar[source], root, false )
						setElementVisibleTo ( Marker_Entregar[source], source, true )			
						setElementVisibleTo ( Blip_Entregar[source], root, false )
						setElementVisibleTo ( Blip_Entregar[source], source, true )
						addEventHandler("onMarkerHit", Marker_Entregar[source], Entregar_Caixa_Casa)
						triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffEntregue todas as Caixas que você pegou no correio", "info")
					else
						triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê já está em uma corrida, Entregue todas as caixas primeiro", "info")
					end
				else
					triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffApenas Motorisas do Sedex pode trabalhar aqui", "info")
				end
			else
				triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê não tem caixas para entregar", "info")
			end
		end
	end
end	
addCommandHandler("entregarcaixas", Entregar_Caixas)

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><      Criar/Destruir Marker Van     ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
function Pegar_Caixa_Carro (source)
	local Occupied_Veh = getPedOccupiedVehicle(source)
	local Veiculo = getPedOccupiedVehicle(source)
	if isPedInVehicle ( source ) then
		if (getElementModel (Occupied_Veh) == 413) then
			if getElementData ( source, "Entrega_Acionada" ) == true then                        
				Marker_Van[source] = createMarker ( 0, 0, 0, "cylinder", 1.2, 16, 111, 231, 90)
				attachElements (  Marker_Van[source], Veiculo, 0, -3.3, -1 )						
				setElementVisibleTo ( Marker_Van[source], root, false )
				setElementVisibleTo ( Marker_Van[source], source, true )
				addCommandHandler("caixa", Pegar_Caixa_Object)
				addEventHandler("onMarkerHit", Marker_Van[source], Mensagem_Aviso)
			end
		end
	end
end
addEventHandler ( "onVehicleStartExit", root, Pegar_Caixa_Carro )

function Destroy_Marker_VanEnter (source)
	local Occupied_Veh = getPedOccupiedVehicle(source)
	local Veiculo = getPedOccupiedVehicle(source)
	local Cargas = tonumber(getElementData(source, "DNL:Cargas")) or 0
	if isPedInVehicle ( source ) then
		if (getElementModel (Occupied_Veh) == 413) then
			if getElementData ( source, "Entrega_Acionada" ) == true then  
				if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end
			elseif Cargas >= 1 then
				triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffDigite /entregarcaixas para começar a entregar as encomendas", "info")
			end	
		end
	end
end
addEventHandler ( "onVehicleEnter", root, Destroy_Marker_VanEnter )

-- Destruir Emprego
Tempo = {}
function Exit_Veh (source)
	if (Carro[source]) and isElement(Carro[source]) then	
		Tempo[source] = setTimer ( function()
			if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
			if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
			if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
			if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end
			destroyElement (Carro[source])
			removeCommandHandler("caixa", Pegar_Caixa_Object)
			setElementData(source, "Entrega_Acionada", false)
			setElementData(source, "DNL:Entregar_Cargas", false)
			setElementData( source, "DNL:Cargas", 0 )	
			triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffSua van foi destruida e seu emprego foi encerrado", "info")
		end, 300000, 1 )
	end
end
addEventHandler ("onVehicleExit", root, Exit_Veh)

function Enter_Veh (source)
	if (Carro[source]) and isElement(Carro[source]) then	
		if isTimer(Tempo[source]) then
			killTimer(Tempo[source])
		end
	end
end
addEventHandler ("onVehicleEnter", root, Enter_Veh)

-- Aviso Pegar Caixa
function Mensagem_Aviso (source)
	if getElementData ( source, "Entrega_Acionada" ) == true then  
		if isElementWithinMarker(source, Marker_Van[source]) then
			triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffDigite /caixa para que pegue uma caixa", "info")
		end
	end
end

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><          Pegar Caixa Van           ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
function Pegar_Caixa_Object (source)
	local Caixa_Correios = getElementData( source, "Caixa" )  
	local Px, Py, Pz = getElementPosition(Marker_Van[source])
	if not isPedInVehicle ( source ) then
		if isElementWithinMarker(source, Marker_Van[source]) then
			if Caixa_Correios == false then
				setPedAnimation( source, "CARRY", "liftup", 1.0, false )
				setTimer(function()
					if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
					setElementData(source, "Recompensa", 0)
					setPedAnimation( source, nil )
					setElementData( source, "Caixa", true )
					toggleControl( source, "jump", false )
					toggleControl( source, "fire", false )
					toggleControl(source, "aim_weapon", false)
					setPedAnimation( source, "CARRY", "crry_prtial", 4.1, true, true, true )
					Object_Caixa[source] = createObject( 1271, Px, Py, Pz )		
					exports.bone_attach:attachElementToBone(Object_Caixa[source], source, 4, 0, 0.4, - 0.6, -90, 0, 0 )
					triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffLeve a Caixa no Marker Criado", "info")
				end, 1000, 1)
			end
		end
	end
end

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><         Entregar Caixa Casa        ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
function Entregar_Caixa_Casa (source)
	local Random_Pos = math.random ( #Marker_Aleatorios )
	local Xp = tonumber(getElementData(source, "Exp")) or 0
	local Cargas = tonumber(getElementData(source, "DNL:Cargas")) or 0
	local Caixa_Caixa = getElementData( source, "Caixa" )	
	local Recompensa = math.random(580, 1330)
	if isElementWithinMarker(source, Marker_Entregar[source]) then
		if not isPedInVehicle ( source ) then 
			if Caixa_Caixa == true then    
				if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
				if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
				if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
				setPedAnimation( source, "CARRY", "putdwn", 1.0, false, false, false, true ) 
				setElementData( source, "DNL:Cargas", Cargas -1 )	
				setTimer(function()
					setElementData( source, "Caixa", false )	
					toggleControl( source, "jump", true )
					toggleControl( source, "fire", true )
					toggleControl(source, "aim_weapon", true)
					setPedAnimation( source, "CARRY", "liftup", 0.0, false, false, false, false )						
					Marker_Entregar[source] = createMarker ( Marker_Aleatorios[Random_Pos][1], Marker_Aleatorios[Random_Pos][2], Marker_Aleatorios[Random_Pos][3] -1, "cylinder", 1.2, 0 ,255 ,0, 50)	
					Blip_Entregar[source] = createBlipAttachedTo( Marker_Entregar[source], 0 )								
					setElementVisibleTo ( Marker_Entregar[source], root, false )
					setElementVisibleTo ( Marker_Entregar[source], source, true )			
					setElementVisibleTo ( Blip_Entregar[source], root, false )
					setElementVisibleTo ( Blip_Entregar[source], source, true )
					addEventHandler("onMarkerHit", Marker_Entregar[source], Entregar_Caixa_Casa)
					if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Vip2")) then
						setElementData(source, "Recompensa", Recompensa *2)
						setElementData(source, "Exp", Xp + getElementData(source, "Recompensa"))
						givePlayerMoney(source, getElementData(source, "Recompensa"))
						triggerClientEvent(source, "addNotification2", root, "#10EB6F( #ffffffVIP#10EB6F ) #ffffffVocê entregou a encomenda e ganhou R$:"..getElementData(source, "Recompensa")..", vá para próxima casa", "info")
					elseif isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Vip")) then
						setElementData(source, "Recompensa", Recompensa *2)
						setElementData(source, "Exp", Xp + getElementData(source, "Recompensa"))
						givePlayerMoney(source, Recompensa)
						triggerClientEvent(source, "addNotification2", root, "#10EB6F( #ffffffVIP#10EB6F ) #ffffffVocê entregou a encomenda e ganhou R$:"..getElementData(source, "Recompensa")..", vá para próxima casa", "info")
					elseif isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then
						setElementData(source, "Recompensa", Recompensa)
						setElementData(source, "Exp", Xp + getElementData(source, "Recompensa"))
						givePlayerMoney(source, Recompensa)
						triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê entregou a encomenda e ganhou R$:"..getElementData(source, "Recompensa")..", vá para próxima casa", "info")
					end
					if Cargas <= 1 then					
						if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
						if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
						if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
						if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end
						removeCommandHandler("caixa", Pegar_Caixa_Object)
						setElementData(source, "Entrega_Acionada", false)
						setElementData(source, "DNL:Entregar_Cargas", false)
						setElementData( source, "DNL:Cargas", 0 )	
						triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffSuas caixas acabou e sua viagem foi encerrada", "info")
					end
				end, 1200, 1) 
			else			
				triggerClientEvent(source, "addNotification2", root, "#ffffffINFO: #ffffffVocê Deve Pegar Uma Cauxa em Sua Van", "info")
			end
		end
	end
end

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><              Anti_Bugs             ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
addEventHandler( "onPlayerQuit", root,
	function()
		if getElementData ( source, "Entrega_Acionada" ) == true then
			if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
			if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
			if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
			if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end
			if isElement(Carro[source]) then destroyElement(Carro[source]) end
		end
	end)
  

addEventHandler( "onPlayerWasted", root,
	function()
		if getElementData ( source, "Entrega_Acionada" ) == true then
			if isElement( Object_Caixa[source] ) then destroyElement( Object_Caixa[source] ) end
			if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
			if isElement( Blip_Entregar[source] ) then destroyElement( Blip_Entregar[source] ) end
			if isElement( Marker_Van[source] ) then destroyElement( Marker_Van[source] ) end
			if isElement(Carro[source]) then destroyElement(Carro[source]) end
			removeCommandHandler("caixa", Pegar_Caixa_Object)
			setElementData( source, "Caixa", false )	
			setElementData(source, "DNL:Entregar_Cargas", false)
			setElementData(source, "Entrega_Acionada", false)
			toggleControl( source, "jump", true )
			toggleControl( source, "fire", true )
			toggleControl(source, "aim_weapon", true)
		end
	end)

 

Client:

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

local Font_1 = dxCreateFont("font/font.ttf", y*11)
local Font_2 = dxCreateFont("font/font1.ttf", y*11)
local Font_3 = dxCreateFont("font/fontNick.ttf", y*10)
local Font_4 = dxCreateFont("font/OpenSans-Bold.ttf", y*11)

--[[
         ><><><><><><><><><><><><><><><
         ><       Abrir/Fechar       ><
         ><><><><><><><><><><><><><><><
--]]
function Abrir_Correios ()
	if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Correio) then return end
		showChat(false)
		showCursor(true)
		addEventHandler("onClientRender", root, Dx_Correio)
end
addEvent("DNL:Abrir_Correios", true)
addEventHandler("DNL:Abrir_Correios", root, Abrir_Correios)

function Fechar_Correios ()
	if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Correio) then  
		showChat(true)
		showCursor(false)
		removeEventHandler("onClientRender", root, Dx_Correio)
	end
end
addEvent("DNL:Fechar_Correios", true)
addEventHandler("DNL:Fechar_Correios", root, Fechar_Correios)

--[[
         ><><><><><><><><><><><><><><><><><
         ><       INTERFACE PAINEL       ><
         ><><><><><><><><><><><><><><><><><
--]]
function Dx_Correio ()
	local Cargas = tonumber(getElementData(localPlayer, "DNL:Cargas")) or 0
        dxDrawRectangle(x*469, y*254, x*426, y*242, tocolor(0, 0, 0, 209), false)
        dxDrawRectangle(x*469, y*254, x*426, y*35, tocolor(0, 0, 0, 200), false)
        dxDrawLine(x*469, y*288, x*895, y*288, tocolor(16, 111, 231, 255), x*2, false)
        dxDrawText("Correios", x*658, y*260, x*708, y*279, tocolor(255, 255, 255, 255), 1.00, Font_1, "left", "top", false, false, false, false, false)
		
        dxDrawRectangle(x*478, y*297, x*408, y*121, tocolor(0, 0, 0, 188), false)
	
	if isCursorOnElement(x*478, y*297, x*408, y*40) then
        dxDrawRectangle(x*478, y*297, x*408, y*40, tocolor(16, 111, 231, 150), false)
		
	elseif isCursorOnElement(x*478, y*337, x*408, y*40) then
        dxDrawRectangle(x*478, y*337, x*408, y*40, tocolor(16, 111, 231, 150), false)
		
	elseif isCursorOnElement(x*478, y*377, x*408, y*40) then
        dxDrawRectangle(x*478, y*377, x*408, y*40, tocolor(16, 111, 231, 150), false)
		
	elseif isCursorOnElement(x*598, y*435, x*169, y*45) then
		CorFechar = tocolor(16, 111, 231, 220)
	end
	
        dxDrawText("Butijão #106fe7(#ffffff"..Cargas.."/25#106fe7)", x*494, y*307, x*527, y*325, tocolor(255, 255, 255, 255), 1.00, Font_4, "left", "top", false, false, false, true, false)
        dxDrawText("Carro", x*494, y*347, x*527, y*365, tocolor(255, 255, 255, 255), 1.00, Font_4, "left", "top", false, false, false, false, false)
        dxDrawText("Uniforme", x*494, y*387, x*527, y*405, tocolor(255, 255, 255, 255), 1.00, Font_4, "left", "top", false, false, false, false, false)
		
        dxDrawImage(x*598, y*435, x*169, y*45, "Img/botao.png", 0, 0, 0, CorFechar, false)
		CorFechar = tocolor(16, 111, 231, 170)
        dxDrawText("Fechar", x*660, y*447, x*705, y*465, tocolor(255, 255, 255, 255), 1.00, Font_4, "left", "top", false, false, false, false, false)
end

--[[
         ><><><><><><><><><><><><><><><
         ><       Pegar Itens        ><
         ><><><><><><><><><><><><><><><
--]]
function Pegar_Itens ( _,state )
	if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Correio) then  
		if state == "down" then
			if isCursorOnElement(x*598, y*435, x*169, y*45) then
				Fechar_Correios ()
			end
			if isCursorOnElement(x*478, y*297, x*408, y*40) then -- Pizza
				triggerServerEvent("DNL:Pegar_Cargas", root, localPlayer)
				
			elseif isCursorOnElement(x*478, y*337, x*408, y*40) then -- Moto
				triggerServerEvent("DNL:Pegar_Carro", root, localPlayer)
				
			elseif isCursorOnElement(x*478, y*377, x*408, y*40) then -- Uniforme
				triggerServerEvent("DNL:Pegar_Uniforme(Sedex)", root, localPlayer)
			end
		end
	end
end
addEventHandler ( "onClientClick", root, Pegar_Itens )

                                   --=============================--
                                   ------------- IGNORA ------------
                                   --=============================--	
--==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-
						  
function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
	if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then
		local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
		if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
			for i, v in ipairs( aAttachedFunctions ) do
				if v == func then
					return true
				end
			end
		end
	end
	return false
end

--==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-

local x,y = guiGetScreenSize()
function isCursorOnElement(x, y, w, h)
	if (not isCursorShowing()) then
		return false
	end
	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

--==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-

 

  • Moderators
Posted

Troque os nomes dos eventos DNL:Pegar_Cargas, DNL:Pegar_Carro, DNL:Pegar_Uniforme(Sedex), DNL:Abrir_Correios e DNL:Fechar_Correios.

Você deveria aprender a fazer scripts do 0 em vez de apenas modificar scripts de terceiros.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

Posted

Na verdade eu paguei por esse script, então creio que eu tenha alguma permissão para me basear a fazer outro script a partir desse...

Mas agradeço a sugestão.

  • Sad 1

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