Jump to content

Wanted level junk


Captain Cody

Recommended Posts

Trying to to make script that shows the police which players have wanted levels

    function wantedlevelstuff (thePlayera) 
    local policeTeam = getTeamFromName("Police") 
    local militaryTeam = getTeamFromName("Military") 
    outputChatBox ( "Look for the yellow moving blips on map.", thePlayera ) 
    local playersa = getElementsByType ( "player" ) 
    for theKey,thePlayera in ipairs(playersa) do 
    local levela = getPlayerWantedLevel ( thePlayera ) 
    if ( levela > 0 ) then 
    local wantedBlip = createBlipAttachedTo ( thePlayera, 56 ) 
    setElementVisibleTo ( wantedBlip, root, false ) 
    setElementVisibleTo ( wantedBlip, thePlayera, true ) 
    end 
    end 
    end 
  

Attaches a blip to the person who triggers it, but no one else with wanted level

Link to comment

Are you asking this?

  
function wantedlevelstuff (player) 
    local policeTeam = getTeamFromName("Police") 
    local militaryTeam = getTeamFromName("Military") 
    if getPlayerTeam( player ) == policeTeam or getPlayerTeam( player ) == militaryTeam then 
        outputChatBox ( "Look for the yellow moving blips on map.", player ) 
        local playersa = getElementsByType ( "player" ) 
        for theKey,thePlayera in ipairs(playersa) do 
            local levela = getPlayerWantedLevel ( thePlayera ) 
            if ( levela > 0 ) then 
                local wantedBlip = createBlipAttachedTo ( thePlayera, 56 ) 
                setElementVisibleTo ( wantedBlip, root, false ) 
                setElementVisibleTo ( wantedBlip, player, true ) 
            end 
        end 
    end 
end 
  
  

This checks if the player is in Police or Military team then continues. You overwrote variables so it made it confusing. Then I maade it available only to police!

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