Jump to content

Como fazer um script trabalhar com outro?


Recommended Posts

Opa rapaziada, tudo blz? bom minha dúvida é a seguinte, eu queria saber qual a forma do script /revistar trabalhar com outro script, por exemplo, quando ele revistar aparece as informações do outro script, no caso o script de habilitação, que quando o policial revistar, aparecer a licença de carro e moto e ver se ele tem ou não.  

 

~~Server~~
------------------------------------------------
------		Sistema de Policia			  ------
------			By:MrDante			  	  ------
------------------------------------------------	
------		  Colaboração:				  ------
------		  #DR.VOODKA				  ------	
------		  [B]lack					  ------
------		  #[S]wag					  ------
------ 		  New Age			  		  ------
------		  DNL291					  ------
------------------------------------------------




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	

function revistar_jogador ( thePlayer, comando, nick )
    if nick then
        if getPlayerFromPartialName ( nick ) then
            local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
            if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then -- Acl Pra Quem Pode Usar o Comando
				local player_a_ser_revistado    =   getPlayerFromPartialName ( nick )
                local nick_do_jogador           =   getPlayerName ( player_a_ser_revistado )
				local nick_do_policial          =   getPlayerName ( thePlayer )
                local estrelas_de_procurado     =   getPlayerWantedLevel ( player_a_ser_revistado )
				local policiax, policiay, policiaz = getElementPosition ( thePlayer ) -- Encontrar posição do policial
				local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado
				local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, revistadox, revistadoy, revistadoz ) -- Calcular a distancia entre os dois elementos 
					if ( dist > 5 )  then -- se a distancia for 5 executara a função a seguir
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!", thePlayer, 255, 255, 255, true) -- Chat Box 
					elseif ( dist < 4 )then -- Caso ao contrario a distancia for 4 executara a função a seguir
					setPedAnimation( thePlayer, "POLICE", "plc_drgbst_01", 3100, true, false, false, false)
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..nick_do_policial.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..nick_do_jogador.."", root, 255, 255, 255, true) -- Chat Box 
					setTimer ( function()
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..estrelas_de_procurado.."", thePlayer, 255, 255, 255, true) -- Nivel de procurado do jogador
					end, 3390, 1 )	
					triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) -- Chamar evento do client
					
				end
			else			
				outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Se voce nao for da acl voce nao tera permissao a este comando
        end
    end
end
end
addCommandHandler ( "revistar", revistar_jogador )

function algemar_jogador ( thePlayer, _, nick )
	if nick then
		if getPlayerFromPartialName ( nick ) then
            local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
            if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then -- Acl Pra Quem Pode Usar o Comando
				local player_a_ser_algemado    =   getPlayerFromPartialName ( nick )
                local nick_do_jogador           =   getPlayerName ( player_a_ser_algemado )
				local nick_do_policial          =   getPlayerName ( thePlayer )
				
				setElementData(player_a_ser_algemado,"algemado", nick_do_jogador) -- Elemento Data
				setPedAnimation( player_a_ser_algemado, "GRAVEYARD", "mrnM_loop", -1, true, false, false, false) -- Animação de algemar
				setElementFrozen( player_a_ser_algemado, true ) -- Freezar jogador
				toggleControl(player_a_ser_algemado, "fire", false) -- retirar função de atirar
				
				outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ffffff"..nick_do_jogador.." #c1c1c1Foi #ff0000Algemado #c1c1c1Pelo #ff0000Policial "..nick_do_policial.."", root, 255, 255, 255, true) -- Chat Box
				outputChatBox("#000000[#ff0000POLICIA#000000] #ff0000Voce #c1c1c1Foi #ff0000Algemado#c1c1c1! ", player_a_ser_algemado, 255, 255, 255, true) -- Chat Box
				end
			else
				outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Se voce nao for da acl nao tera permissao a este comando
			end
		end
	end
addCommandHandler("algemar", algemar_jogador)

function algemar_jogador ( thePlayer, _, nick )
	if nick then
		if getPlayerFromPartialName ( nick ) then
            local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
            if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then
				local player_a_ser_desalgemado  =   getPlayerFromPartialName ( nick )
                local nick_do_jogador           =   getPlayerName ( player_a_ser_desalgemado )
				local nick_do_policial          =   getPlayerName ( thePlayer )
				if getElementData (player_a_ser_desalgemado, "algemado") then -- vai verificar se o jogador estiver com os algemas
				setPedAnimation( player_a_ser_desalgemado ) -- desativara animaçao
				setElementFrozen( player_a_ser_desalgemado, false ) -- desativara o freeze
				toggleControl(player_a_ser_desalgemado, "fire", true ) -- ativara a função de atirar
				outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ffffff"..nick_do_jogador.." #c1c1c1Foi #ff0000Desalgemado #c1c1c1Pelo #ff0000Policial "..nick_do_policial.."", root, 255, 255, 255, true) -- Chat Box
				outputChatBox("#000000[#ff0000POLICIA#000000] #ff0000Voce #c1c1c1Foi #ff0000Desalgemado#c1c1c1! ", player_a_ser_desalgemado, 255, 255, 255, true) -- Chat Box
				removeElementData ( player_a_ser_desalgemado, "algemado" ) -- remover algemar
				else
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #FF0000Suspeito #c1c1c1Nao #c1c1c1Foi #ff0000Algemado #c1c1c1Para Executar Este Comando! ",thePlayer, 255, 255, 255, true) -- chat box se o jogador nao estiver algemado
				end
			else
				outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Acl Pra Quem Pode Usar o Comando
			end
		end
	end
end
addCommandHandler("desalgemar", algemar_jogador)
				
				
			

 

E o server do mod habilitação.

 

function RobberUber (ThePlayer,seat)
local id = getElementModel(source)
if not getElementData(ThePlayer, "Habilitacoes:Motos", false) and seat == 0 then 
if id == 581 then
cancelEvent()
outputChatBox("ᴿ#00ff00ᴮ✘ #ffffffINFO #00ff00✘➺ [ #ffffffAuto Escola #00ff00] #ffffff - Você Não Tem Carteira Para Dirigir Motos",ThePlayer,255,255,255, true)
outputChatBox("ᴿ#00ff00ᴮ✘ #ffffffINFO #00ff00✘➺ [ #ffffffAuto Escola #00ff00] #ffffff - Compre Uma Na AutoEscola No S Vermelho No F11",ThePlayer,255,255,255, true)
end
end
end
addEventHandler("onVehicleStartEnter",root, RobberUber)

 

Link to comment
function revistar_jogador ( thePlayer, comando, nick )
    if nick then
        if getPlayerFromPartialName ( nick ) then
            local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
            if isObjectInACLGroup ("user."..accName, aclGetGroup ( "ComandosPolicia") ) then -- Acl Pra Quem Pode Usar o Comando
				local player_a_ser_revistado    =   getPlayerFromPartialName ( nick )
                local nick_do_jogador           =   getPlayerName ( player_a_ser_revistado )
				local nick_do_policial          =   getPlayerName ( thePlayer )
                local estrelas_de_procurado     =   getPlayerWantedLevel ( player_a_ser_revistado )
				local policiax, policiay, policiaz = getElementPosition ( thePlayer ) -- Encontrar posição do policial
				local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado
				local dist = getDistanceBetweenPoints3D ( policiax, policiay, policiaz, revistadox, revistadoy, revistadoz ) -- Calcular a distancia entre os dois elementos 
					if ( dist > 5 )  then -- se a distancia for 5 executara a função a seguir
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!", thePlayer, 255, 255, 255, true) -- Chat Box 
					elseif ( dist < 4 )then -- Caso ao contrario a distancia for 4 executara a função a seguir
					setPedAnimation( thePlayer, "POLICE", "plc_drgbst_01", 3100, true, false, false, false)
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..nick_do_policial.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..nick_do_jogador.."", root, 255, 255, 255, true) -- Chat Box 
					setTimer ( function()
					outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..estrelas_de_procurado.."", thePlayer, 255, 255, 255, true) -- Nivel de procurado do jogador
					if getElementData(player_a_ser_revistado, "Habilitacoes:Motos") then -- Verifica se ele tem carteira de moto
						outputChatBox("Player com carteira de moto", thePlayer, 255, 255, 255, true)
					else
						outputChatBox("Player sem carteira de moto", thePlayer, 255, 255, 255, true)
					end
					end, 3390, 1 )	
					triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) -- Chamar evento do client
					
				end
			else			
				outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!", thePlayer, 255, 255, 255, true) -- Se voce nao for da acl voce nao tera permissao a este comando
        end
    end
end
end
addCommandHandler ( "revistar", revistar_jogador )

Só adicionar uma "verificação" abaixo do output do nivel de procurado

Obs: ele vai verificar só de moto, vc tem que fazer o mesmo com a de carro, caminhao e etc.

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