Jump to content

Make it so script only shows gang blips


Dentos

Recommended Posts

So i got this blip script it works fine but i want it to only show the people thats in your gang and not everyone I use castillo btw

-- needs configurable blip colors, and team support 
root = getRootElement () 
color = { 0, 255, 0 } 
players = {} 
resourceRoot = getResourceRootElement ( getThisResource () ) 
  
players = { } 
  
function onResourceStart ( resource ) 
      for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        local team = getPlayerTeam ( player ) 
        local r, g, b = unpack ( ( team and { getTeamColor ( team ) } or { getPlayerNametagColor ( player ) } ) ) 
        players [ player ] = createBlipAttachedTo ( player, 0, 2, r, g, b, 255 ) 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) 
  
function onPlayerSpawn ( spawnpoint ) 
local gangName = getElementData ( thePlayer, "gang" ) 
    if ( gangName and gangName ~= "None" ) then 
        local msg = table.concat ( { ... }, " " ) 
        local nick = getPlayerName ( thePlayer ) 
        for index, player in ipairs ( getElementsByType ( "player" ) ) do 
            if ( getElementData ( player, "gang" ) == gangName ) then 
        setBlipColor ( players [ source ], r, g, b, 255 ) 
    end 
end 
addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) 
  
function destroyBlips ( totalammo, killer, killerweapon ) 
    destroyBlipsAttachedTo ( source ) 
end 
addEventHandler ( "onPlayerQuit", root, destroyBlips ) 
addEventHandler ( "onPlayerWasted", root, destroyBlips ) 
  
function destroyBlipsAttachedTo ( player ) 
    local attached = getAttachedElements ( player ) 
    if ( attached ) then 
        for _, element in ipairs ( attached ) do 
            if ( getElementType ( element ) == "blip" ) then 
                destroyElement ( element ) 
            end 
        end 
    end 
end 

Link to comment

I also tried this but dosent work :/

playerBlibs = {} 
amouunt = 0 
function updateGPS () 
amouunt = 0 
local gangname = getElementData(getLocalPlayer(),"gang") 
    for i, blip in ipairs(playerBlibs) do 
        destroyElement(blip) 
    end 
if getElementData(getLocalPlayer(),"gang") == "None" then return end     
playerBlibs = {}     
    for i, player in ipairs(getElementsByType("player")) do 
        if gangname == getElementData(player,"gang") then 
            amouunt = amouunt+1 
            playerBlibs[amouunt] = createBlipAttachedTo(player,0,2,22,255,22) 
            setBlipVisibleDistance(playerBlibs[amouunt],1000) 
        end 
    end 
end 
setTimer(updateGPS,10000,0) 

Link to comment
  
playerBlibs = {} 
function updateGPS () 
local gangname = getElementData(getLocalPlayer(),"gang") 
    for i, blip in ipairs(playerBlibs) do 
        destroyElement(blip) 
    end 
if getElementData(getLocalPlayer(),"gang") == "None" then return end    
playerBlibs = {}    
    for i, player in ipairs(getElementsByType("player")) do 
        if gangname == getElementData(player,"gang") then 
            playerBlibs[player] = createBlipAttachedTo(player,0,2,22,255,22) 
            setBlipVisibleDistance(playerBlibs[player],1000) 
        end 
    end 
end 
setTimer(updateGPS,10000,0) 
  

Link to comment

also tried this any nothing please help skype denntos

root = getRootElement () 
color = { 0, 255, 0 } 
players = {} 
resourceRoot = getResourceRootElement ( getThisResource () ) 
  
players = { } 
  
function onResourceStart ( resource ) 
      for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        local gang = getPlayergang ( player ) 
        local r, g, b = unpack ( ( gang and { getgangColor ( gang ) } or { getPlayerNametagColor ( player ) } ) ) 
        players [ player ] = createBlipAttachedTo ( player, 0, 2, r, g, b, 255 ) 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) 
  
function onPlayerSpawn ( spawnpoint ) 
    local gang = getPlayergang ( source ) 
    local r, g, b = unpack ( ( gang and { getgangColor ( gang ) } or { getPlayerNametagColor ( source ) } ) ) 
    if ( players [ source ] ) then 
        setBlipColor ( players [ source ], r, g, b, 255 ) 
    else 
        players [ source ] = createBlipAttachedTo ( source, 0, 2, r, g, b, 255 ) 
    end 
end 
addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) 
  
function destroyBlips ( totalammo, killer, killerweapon ) 
    destroyBlipsAttachedTo ( source ) 
end 
addEventHandler ( "onPlayerQuit", root, destroyBlips ) 
addEventHandler ( "onPlayerWasted", root, destroyBlips ) 
  
function destroyBlipsAttachedTo ( player ) 
    local attached = getAttachedElements ( player ) 
    if ( attached ) then 
        for _, element in ipairs ( attached ) do 
            if ( getElementType ( element ) == "blip" ) then 
                destroyElement ( element ) 
            end 
        end 
    end 
end 

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