Jump to content

Me ajuda aqui


Recommended Posts

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 )
Quote

Estou usando essa função para revistar os jogadores, so que queria por a função para revistar as armas que o jogador tiver, so que não sei como fazer isso se puder me ajudar agradeço.

 

Link to comment

Até onde eu sei getPlayerFromPartialName não é uma função nativa, por tanto você tem que adiciona-la no seu script.

 

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

No caso isso ai?

 

Link to comment
  • Moderators

 

1 hour ago, zW1Z4RD said:

No caso isso ai?

Sim.

3 hours ago, zW1Z4RD said:

Estou usando essa função para revistar os jogadores, so que queria por a função para revistar as armas que o jogador tiver, so que não sei como fazer isso se puder me ajudar agradeço.

Revistar as armas de que forma? Pra verficiar as armas use a função getPedWeapon, no 2º argumento você especifica o slot que é 0-12.

Edited by DNL291
Link to comment
5 hours ago, DNL291 said:

 

Sim.

Revistar as armas de que forma? Pra verficiar as armas use a função getPedWeapon, no 2º argumento você especifica o slot que é 0-12.

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 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_arma ( thePlayer, _, nick )

			if ( verificar_arma ) or (getPedWeapon (thePlayer, 0) == 1 or 2 or 3 or 4 or 5 or 6 or 9 or 22 or 24 or 25 or 26) then
		outputChatBox ( "Jogador possui arma de fogo" )
		else
		outputChatBox ( "Jogador nao possui arma de fogo." )
		
				end
			end
		end
	end
end
addCommandHandler("revarm", revistar_arma) 
Quote

Isso?

 

Link to comment
1 hour ago, Lord Henry said:

Não. Isso não existe: or 2 or 3 or 4 or 5 or 6 or 9 or 22 or 24 or 25 or 26) then

E pq vc fica citando a si mesmo em vez de mandar mensagem normal?

A quer sabe n tou entendendo mais nada ksksks deixa pra la vlw do mesmo jeito

Link to comment
function revistar_jogador(player,cmd,nick)
	local accName = getAccountName(getPlayerAccount(player))
	if not isObjectInACLGroup ("user."..accName,aclGetGroup("ComandosPolicia")) then
		return outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Você nao tem permissao a este comando!",player,255,255,255,true)
	end	
	local toPlayer = getPlayerFromPartialName(nick)
	if not toPlayer then
		return outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1nick invalido!",player,255,255,255,true)
	end	
	local toPlayerName = getPlayerName(toPlayer)
	local playerName = getPlayerName(player)
	local toPlayerWantedLv = getPlayerWantedLevel(toPlayer)
	local px,py,pz = getElementPosition(player)
	local tpx,tpy,tpz = getElementPosition(toPlayer)
	local dist = getDistanceBetweenPoints3D(px,py,pz,tpx,tpy,tpz)
	if dist >= 5 then
		outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!",player,255,255,255,true)
	else
		setPedAnimation(player,"POLICE","plc_drgbst_01",3100,true,false,false,false)
		checar_armas(player,toPlayer)
		outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1O #ff0000Policial #ffffff"..playerName.." #c1c1c1esta #ff0000Revistando #c1c1c1o #ff0000Suspeito "..toPlayerName,root,255,255,255,true)
		setTimer(outputChatBox,3390,1,"#000000[#ff0000POLICIA#000000] #c1c1c1Nivel de #ff0000Procurado #c1c1c1do #ff0000Suspeito#c1c1c1:"..toPlayerWantedLv,player,255,255,255,true)
		triggerClientEvent(player,"doShowDXProgressBar",root)
	end
end
addCommandHandler("revistar",revistar_jogador)

function checar_armas(player,toPlayer)
	for i=1,12 do
		local weaponID = getPedWeapon(toPlayer,i)
		if weaponID~=0 then
			outputChatBox("#000000[#ff0000POLICIA#000000] #c1c1c1Arma encontrada:"..getWeaponNameFromID(weaponID),player,255,255,255,true)
		end
	end
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

é tipo isso?

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