Jump to content

bug dx


Recommended Posts

Opa tudo bom é que o script só manda a mensagem dx tanto para o policial quanto para o player sómente na hora de dar os comandos /revistar , porem na outra parte caso o player mostre a identidade ou ele se recuse a mostrar n ta executando a função de mostrar a mensagem dx mostrando que foi recusado ou que foi mostrado a identidade


cmd0 = "verificar"
cmd1 = "revistar"
cmd2 = "recusar"
cmd3 = "mostrar"

--------------------------------------------------------------------

function BuscarIDVTR (source, cmd, pname)
    if getElementData ( source, "ocupacao" ) == "Policial" then
		local vehicle = getPedOccupiedVehicle (source)
		local cliente = getPlayerFromPartialName(pname)
		if isElement(cliente) then
		if cliente == source then exports.Scripts_Dxmessages:outputDx(source, "Você não Pode Verificar sua Propria Ficha!", "error") return end
		if getElementData ( cliente, "AirNew_BuscaID_Perm" ) == "Sim" then
			if isElement(vehicle) then
        		if (getElementType(vehicle) == "vehicle" ) then			
					if (getVehicleType(vehicle) == "Automobile") or (getVehicleType(vehicle) == "Bike") then
				  		local id = getElementModel ( vehicle )
                  		if id == 433 or id == 579 or id == 427 or id == 490 or id == 528 or id == 523 or id == 470 or id == 596 or id == 598 or id == 599 or id == 597 or id == 432 or id == 601 then
						local RG = getElementData ( cliente, "AirNew_RG" ) or "N/C"
                        setElementData ( source, "PM_AirNew_RG", RG )
						local Data = getElementData ( cliente, "AirNew_DataExpedicao" ) or "N/C"
                        setElementData ( source, "PM_AirNew_DataExpedicao", Data )
						local Nome = getElementData ( cliente, "Nome" ) or "N/C"
                        setElementData ( source, "PM_AirNew_RG_NomeCompleto", Nome )
						local DataNas = getElementData ( cliente, "Ano" ) or "N/C"
                        setElementData ( source, "PM_AirNew_RG_DataDeNascimento", DataNas )
						local LocalNas = getElementData ( cliente, "AirNew_RG_LocalDeNascimento" ) or "N/C"
				        setElementData ( source, "PM_AirNew_RG_LocalDeNascimento", LocalNas )
						local ProcuradoNivel = getPlayerWantedLevel ( cliente )
						setElementData ( source, "PM_AirNew_RG_Procurado", ProcuradoNivel )
						local Drogas = getElementData ( cliente, "drogas" ) or "N/C"
						setElementData ( source, "PM_AirNew_Drogas", Drogas )
						local Dinheiro_AirNewSCR = getElementData ( cliente, "Dinheiro_AirNewSCR" ) or "N/C"
				        setElementData ( source, "Dinheiro_AirNewSCR_Abordado", Dinheiro_AirNewSCR )
						local AirNewSCR_Porte_de_Armas = getElementData ( cliente, "AirNewSCR_Porte_de_Armas" ) or "N/C"
						setElementData ( source, "PM_AirNewSCR_Porte_de_Armas", AirNewSCR_Porte_de_Armas )
						
						setElementData ( source, "AirNew_SolicitarAbrirFicha", "Sim" ) -- Abrir Ficha
						
						end
         			end
      			end
   			else
	  		   exports.Scripts_Dxmessages:outputDx(source, "Entre Dentro da Viatura para Poder Utilizar esse Comando!", "error")
   		    end
		else
		    exports.Scripts_Dxmessages:outputDx(source, "Você não pode puxar uma Ficha sem a Identidade do Jogador!", "error")
		end
	end
end
end
addCommandHandler ( cmd0, BuscarIDVTR )

--------------------------------------------------------------------

canceltimer={}
function fix(source,cmd,pname)
	if getElementData(source, "ocupacao" ) == "Policial" then
		local cliente = getPlayerFromPartialName(pname)
		if isElement(cliente) then
			if cliente == source then exports.Scripts_Dxmessages:outputDx(source, "Você não Pode Pedir sua Propria Identidade!", "error") return end
			local policial = getElementData(cliente,"cliente:policial")
			if isElement(policial) then
				exports.Scripts_Dxmessages:outputDx(source, "O Jogador "..getPlayerName(cliente).." Ja Esta Sendo Atendido Por um Policial!", "error")
			else
				local cx,cy,cz = getElementPosition(cliente)
				local x,y,z = getElementPosition(source)
				local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
				if dist <= 7 then
					setElementData(cliente,"cliente:policial",source)
					exports.Scripts_Dxmessages:outputDx(source, "Você Solicitou a Identidade do Jogador "..getPlayerName(cliente), "warning")
					exports.Scripts_Dxmessages:outputDx(cliente, "O Policial "..getPlayerName(source).." Pediu sua Identidade, Digite /Mostrar ou /Recusar.", "warning")
					canceltimer[cliente] = setTimer(cancelfix,15000,1,cliente)
				end
			end
		else
		    exports.Scripts_Dxmessages:outputDx(source, "O Jogador Não Foi Encontrado", "error")
		end
	end
end
addCommandHandler(cmd1,fix)

--------------------------------------------------------------------

function recusar(source)
	local policial = getElementData(source,"cliente:policial")
	if isElement(policial) then
	    exports.Scripts_Dxmessages:outputDx(policial, "O Jogador "..getPlayerName(source).." Se Recusou a Mostrar a Identidade, +1 Nivel de Procurado!", "error") -- Policial
		exports.Scripts_Dxmessages:outputDx(source, "Você se Recusou a Entregar a Identidade, e Agora esta Procurado!", "warning")
		Procurado = getPlayerWantedLevel ( source )
		setPlayerWantedLevel ( source, Procurado+1 )
	end
	setElementData(source,"cliente:policial",nil)	
	if isTimer(canceltimer[source]) then
		killTimer(canceltimer[source])
	end
end
addCommandHandler(cmd2,recusar)

--------------------------------------------------------------------

function aceitar(source)
	local policial = getElementData(source,"cliente:policial")
	if isElement(policial) then
		exports.Scripts_Dxmessages:outputDx(policial, "O Jogador "..getPlayerName(source).." Lhe mostrou a Identidade, Verifique Dentro da Viatura /Verificar Nick. (Você tem 60 Segundos)", "success")
		exports.Scripts_Dxmessages:outputDx(source, "Você mostrou sua identidade ao Policial "..getPlayerName(policial).." #ffffff( ele tem tem 60 Segundos pra verificar na viatura!)", "success")
		local cx,cy,cz = getElementPosition(policial)
		local x,y,z = getElementPosition(source)
		local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
		if dist <= 7 then	
			--setElementData ( policial, "AirNew_BuscaID", ""..getPlayerName(source).."" )
			setElementData ( source, "AirNew_BuscaID_Perm", "Sim" )
			setTimer ( function() setElementData ( source, "AirNew_BuscaID_Perm", "Não" ) end, 60000, 1 )
		else
		    exports.Scripts_Dxmessages:outputDx(source, "O Policial Esta Muito Longe!", "error")
			exports.Scripts_Dxmessages:outputDx(policial, "Você Esta Muito Longe do Jogador Abordado!", "error")
		end
	end
	setElementData(source,"cliente:policial",nil)	
	if isTimer(canceltimer[source]) then
		killTimer(canceltimer[source])
	end
end
addCommandHandler(cmd3,aceitar)

--------------------------------------------------------------------

function cancelfix(source)
	local policial = getElementData(source,"cliente:policial")
	if isElement(policial) then
		exports.Scripts_Dxmessages:outputDx(policial, "O Jogador "..getPlayerName(source).." Demorou Para Mostrar ou Recusar a Identidade, +1 Nivel de Procurado!", "error")
	end
	exports.Scripts_Dxmessages:outputDx(source, "Você Demorou Demais Para Mostrar ou Recusou Mostrar Identidade e Agora esta Procurado!", "error")
	setElementData(source,"cliente:policial",nil)	
	Procurado = getPlayerWantedLevel ( source )
	setPlayerWantedLevel ( source, Procurado+1 )
end

--------------------------------------------------------------------

function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end

--------------------------------------------------------------------

 

Link to comment

s , essa parte aki funciona correta porem as outras não envia a mensagem  a que funciona  é esta aki

 

--------------------------------------------------------------------

canceltimer={}
function fix(source,cmd,pname)
	if getElementData(source, "ocupacao" ) == "Policial" then
		local cliente = getPlayerFromPartialName(pname)
		if isElement(cliente) then
			if cliente == source then exports.Scripts_Dxmessages:outputDx(source, "Você não Pode Pedir sua Propria Identidade!", "error") return end
			local policial = getElementData(cliente,"cliente:policial")
			if isElement(policial) then
				exports.Scripts_Dxmessages:outputDx(source, "O Jogador "..getPlayerName(cliente).." Ja Esta Sendo Atendido Por um Policial!", "error")
			else
				local cx,cy,cz = getElementPosition(cliente)
				local x,y,z = getElementPosition(source)
				local dist = getDistanceBetweenPoints3D(x,y,z,cx,cy,cz)
				if dist <= 7 then
					setElementData(cliente,"cliente:policial",source)
					exports.Scripts_Dxmessages:outputDx(source, "Você Solicitou a Identidade do Jogador "..getPlayerName(cliente), "warning")
					exports.Scripts_Dxmessages:outputDx(cliente, "O Policial "..getPlayerName(source).." Pediu sua Identidade, Digite /Mostrar ou /Recusar.", "warning")
					canceltimer[cliente] = setTimer(cancelfix,15000,1,cliente)
				end
			end
		else
		    exports.Scripts_Dxmessages:outputDx(source, "O Jogador Não Foi Encontrado", "error")
		end
	end
end
addCommandHandler(cmd1,fix)

 

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