Jump to content

Help me please ill pay if necessary


Dentos

Recommended Posts

So I got resource that allows you to see only your clan members in map and viceversa but theres a little problem with it

-I start resource and it works fine

-I reconnect

-The people in my gang can still see me but i cant see them

-someone reconnects in my gang I start seeing only one reconnected and not rest and the one reconnected cant see anyone until someone reconnects

heres the script been stuck on this for almost a month :(

local pBlips = { } 
  
    function blipsRestart() 
        for index, player in ipairs(getElementsByType("player")) do 
            addTeamBlip(player) 
        end 
    end 
setTimer(blipsRestart,10000,0) 
 addEventHandler("onResourceStart", resourceRoot, blipsRestart) 
    function blipJoin() 
            addTeamBlip(source) 
    end 
 addEventHandler("onPlayerJoin",getRootElement(),blipJoin) 
function addTeamBlip(player) 
    if ( pBlips[player] ) then return false end -- Adding a prevention of duplicate blips 
    local theGang = getElementData ( player, "gang" ) 
    if ( theGang and theGang ~= "None" ) then 
       local r, g, b = getPlayerNametagColor( player ) 
       local theBlip = createBlipAttachedTo( player, 0, 2, 0, 255, 0 ) 
        -- Change visibility to only the team members 
        setElementVisibleTo( theBlip, root, false ) 
        for index, value in ipairs ( getPlayersByGang ( theGang ) ) do -- THIS 
            setElementVisibleTo( theBlip, value, true ) 
        end 
        pBlips[player] = theBlip 
    end 
end 
  
function destroyBlip(element) 
    local theElement = source or element 
    if ( theElement ) then 
        destroyElement(pBlips[theElement]) 
        pBlips[theElement] = nil -- Just in-case... 
    end 
end 
  
-- Events 
  
addEventHandler ( "onPlayerSpawn", root, addTeamBlip ) 
addEventHandler ( "onPlayerQuit", root, destroyBlip ) 
  
  
function getPlayersByGang ( gang ) 
    local players = { } 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( getElementData ( player, "gang" ) == gang ) then 
            table.insert ( players, player ) 
        end 
    end 
  
    return players 
end 

Link to comment
  
local pBlips = { } 
  
    function blipsRestart() 
        for index, player in ipairs(getElementsByType("player")) do 
            addTeamBlip(player) 
        end 
    end 
setTimer(blipsRestart,10000,0) 
 addEventHandler("onResourceStart", resourceRoot, blipsRestart) 
    function blipJoin() 
            addTeamBlip(source) 
    end 
 addEventHandler("onPlayerLogin",getRootElement(),blipJoin) 
function addTeamBlip(player) 
    if ( pBlips[player] ) then return false end -- Adding a prevention of duplicate blips 
    local theGang = getElementData ( player, "gang" ) 
    if ( theGang and theGang ~= "None" ) then 
       local r, g, b = getPlayerNametagColor( player ) 
       local theBlip = createBlipAttachedTo( player, 0, 2, 0, 255, 0 ) 
        -- Change visibility to only the team members 
        setElementVisibleTo( theBlip, root, false ) 
        for index, value in ipairs ( getPlayersByGang ( theGang ) ) do -- THIS 
            setElementVisibleTo( theBlip, value, true ) 
        end 
        pBlips[player] = theBlip 
    end 
end 
  
function destroyBlip(element) 
    local theElement = source or element 
    if ( theElement ) then 
        destroyElement(pBlips[theElement]) 
        pBlips[theElement] = nil -- Just in-case... 
    end 
end 
  
-- Events 
  
addEventHandler ( "onPlayerSpawn", root, addTeamBlip ) 
addEventHandler ( "onPlayerQuit", root, destroyBlip ) 
  
  
function getPlayersByGang ( gang ) 
    local players = { } 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( getElementData ( player, "gang" ) == gang ) then 
            table.insert ( players, player ) 
        end 
    end 
  
    return players 
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...