Jump to content

[HELP] PedAiming


lolman

Recommended Posts

Posted

Hello,

I got a problem with my code... I want that if you are in the team Criminal, and if you aim at a player which is in the team "Police" the criminal guy which aimed will get stars...

But in this code, if you are in the police team and you aim, you also get stars. and as a crim you get stars too.

function playerTargetCheck ( thePlayer ) 
    local target 
    for i, thePlayer in ipairs ( getElementsByType("player") ) do   
        target = getPedTarget ( thePlayer )                         
        if ( target ) then                                          
            if ( getElementType ( target ) == "player" ) and thePlayer then      
                setPlayerWantedLevel(thePlayer, 6) 
            elseif target == thePlayer then return false 
            end 
        end 
    end 
end 
setTimer ( playerTargetCheck, 1000, 0 )  

Posted

Try this by putting it in your Police part

local team = getPlayerTeam() 
local theTeamName = getTeamName(team) 
    if ( theTeamName == "Police" )  
      and (target) and getPlayerWantedLevel ( source ) > 0 ) then return 
end 

Posted

Try this using onPlayerTarget event.

function onPlayerTarget (element) 
    local teamNameC = getTeamName(getPlayerTeam(source)) 
    if element and getElementType (element) == "player" then 
        local theTeamName = getTeamName(getPlayerTeam(element)) 
            if (theTeamName == "Police") then  
            if (teamNameC ~= "Criminal") then return end  
            setPlayerWantedLevel(source, 6) 
        end  
    end 
end 
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget )  

Posted
Which one? and its not an full code

Put your code and we'll helps we have no idea about your Police and Criminal team names.

here's your mistake

9d5a536626.png

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