Jump to content

Put names off in freeroam map


Recommended Posts

snippet taken from wiki example.

  
root = getRootElement ( ) 
-- Store all the players in the server into a table 
players = getElementsByType ( "player" ) 
  
function ResourceStart ( name, root ) 
    for k,v in ipairs ( players ) do              -- for all the players in the table 
        setPlayerNametagShowing ( v, false )      -- turn off their nametag 
    end 
end 
addEventHandler ( "onResourceStart", root, ResourceStart ) 
  
function PlayerJoin () 
      -- Whoever joins the server should also have their nametags deactivated 
    setPlayerNametagShowing ( source, false ) 
end 
addEventHandler ( "onPlayerJoin", root, PlayerJoin ) 
  

Link to comment

Well 2 things:

First, the above code will work, but is inefficient.

  
function ResourceStart(name, root) 
    for i, thePlayer in ipairs(getElementsByType("player")) do --You dont need a players table, especially as a global variable. 
        setPlayerNametagShowing(thePlayer, false) 
    end 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), ResourceStart) --Only run this when THIS resource starts 
  
function PlayerJoin() 
    setPlayerNametagShowing(source, false) 
end 
addEventHandler("onPlayerJoin", getRootElement(), PlayerJoin) --No need to store the root element, especially as a global variable. 
  

Second, this will hide the player's name that is attached to his/her body in-game, not necessarily their blip or name in the freeroam GUI (unless the freeroam gui is scripted to detect if their nametag is showing or not).

Link to comment
  • Discord Moderators

Since there is no freeroam setting to do this, you can go into fr_client.lua and remove/comment the content of function updatePlayerBlips

function updatePlayerBlips() 
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...