Jump to content

Blip


Recommended Posts

Posted

Hello i wanna create blips with color like palyer's nametag color. And i wanna make police invisible. I made some codes but it didn't work anyway and i'm pretty sure that i'm making it in bad way.

Posted
Hello i wanna create blips with color like palyer's nametag color. And i wanna make police invisible. I made some codes but it didn't work anyway and i'm pretty sure that i'm making it in bad way.

If u need help u have to post u code...

Maybe u can find something usefull in the "search"

Good luck.

2rcl8c0.png

Full Theft Auto Server.

mtasa://212.227.133.73:22003

Posted

I made this

  
  
    local blip = { } 
      
    addEventHandler ( "onPlayerSpawn", root, 
        function ( ) 
            if ( not isElement ( blip [ source ] ) ) then 
                blip [ source ] = createBlipAttachedTo ( source ) 
            end 
      
            local theTeam = getPlayerTeam ( source ) 
            if ( not theTeam ) then 
                return 
            end 
      
            local r, g, b = getTeamColor ( theTeam ) 
            setPlayerNametagColor ( source, r, g, b ) 
            setBlipColor ( blip [ source ], r, g, b, 255 ) 
        end 
    ) 
     
    addEventHandler ( "onResourceStart", resourceRoot, 
        function () 
            for k, v in ipairs ( getElementsByType("player") ) do 
                if ( not isElement ( blip [ v ] ) ) then 
                    blip [ v ] = createBlipAttachedTo ( v ) 
                end 
                 
            local theTeam = getPlayerTeam ( v ) 
            if (not theTeam) then 
                return 
            end 
             
            local r, g, b = getTeamColor ( theTeam ) 
            setPlayerNametagColor ( v, r, g, b ) 
            setBlipColor ( blip [ v ], r, g, b, 255 ) 
        end 
    )        
      
    addEventHandler ( "onPlayerQuit", root, 
        function ( ) 
            if isElement ( blip [ source ] ) then 
                destroyElement ( blip [ source ] ) 
            end 
        end 
    ) 

But it doesnt work for me.

Posted

( ( Not Tested ) )

local blip = { } 
addEventHandler ( "onPlayerSpawn", root, function ( ) 
    if ( not isElement ( blip [ source ] ) ) then 
        blip [ source ] = createBlipAttachedTo ( source ) 
    end 
    local theTeam = getPlayerTeam ( source ) 
    if ( not theTeam ) then 
        return 
    end 
    if ( getTeamName ( theTeam ) == "Police" ) then 
        return 
    end 
    local r, g, b = getTeamColor ( theTeam ) 
    setPlayerNametagColor ( source, r, g, b ) 
    setBlipColor ( blip [ source ], r, g, b, 255 ) 
end ) 
    
addEventHandler ( "onResourceStart", resourceRoot, function () 
    for k, v in ipairs ( getElementsByType("player") ) do 
        if ( not isElement ( blip [ v ] ) ) then 
            blip [ v ] = createBlipAttachedTo ( v ) 
        end 
        local theTeam = getPlayerTeam ( v ) 
        if (not theTeam) then 
            return 
        end    
        if ( getTeamName ( theTeam ) == "Police" ) then 
            return  
        end 
        local r, g, b = getTeamColor ( theTeam ) 
        setPlayerNametagColor ( v, r, g, b ) 
        setBlipColor ( blip [ v ], r, g, b, 255 ) 
    end 
end )   
  
function destroyPlayerBlip( ) 
    if isElement ( blip [ source ] ) then 
        destroyElement ( blip [ source ] ) 
    end 
end  
addEventHandler ( "onPlayerQuit", root, destroyPlayerBlip ) 
addEventHandler ( "onPlayerWasted", root, destroyPlayerBlip ) 
  
addEventHand 
  
setTimer ( function ( ) 
    for i,v in ipairs ( getElementsByType ( "player" ) ) do 
        if isElement ( blip [ v ] ) then 
            destroyElement ( blip [ v ] ) 
        end 
        local theTeam = getPlayerTeam ( v ) 
        if (not theTeam) then 
            return 
        end    
        if ( getTeamName ( theTeam ) == "Police" ) then 
            return  
        end 
        local r, g, b = getTeamColor ( theTeam ) 
        setPlayerNametagColor ( v, r, g, b ) 
        setBlipColor ( blip [ v ], r, g, b, 255 ) 
    end 
end, 30000, 0 ) 

Posted
local blip = { } 
  
addEvent ( "onPlayerTeamChanged", true ) 
addEventHandler ( "onPlayerTeamChanged", root, 
    function ( theTeam ) 
        if ( not theTeam ) then 
            return 
        end 
  
        if ( not isElement ( blip [ source ] ) ) then 
            blip [ source ] = createBlipAttachedTo ( source ) 
        end 
  
        local r, g, b = getTeamColor ( theTeam ) 
        setPlayerNametagColor ( source, r, g, b ) 
        setBlipColor ( blip [ source ], r, g, b, 255 ) 
    end 
) 
  
addEventHandler ( "onPlayerQuit", root, 
    function ( ) 
        if isElement ( blip [ source ] ) then 
            destroyElement ( blip [ source ] ) 
        end 
    end 
) 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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