Artisz Posted August 16, 2016 Share Posted August 16, 2016 Hi! It is possible that show player's nametag just for his friends? So don't see all players the nametag, just the friends? Link to comment
Wumbaloo Posted August 16, 2016 Share Posted August 16, 2016 (edited) Try to use setPlayerNametagShowing and a boucle for to get player's friends with a getElementData ? All of this client sided Example: --Client Side function resourceStart( ) local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do -- Make your getElementData here or get if localPlayer and player are friends setPlayerNametagShowing ( player, false ) end end addEventHandler ( "onResourceStart", getResouceRootElement(getThisResource()), resourceStart ) Edited August 16, 2016 by Guest Link to comment
Artisz Posted August 16, 2016 Author Share Posted August 16, 2016 So if I set the elementdata, when he introduce himself like this: setElementData(source, tonumber(targetPlayer), 1) And in clientside I try this: function resourceStart() local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do if(getElementData(source, tonumber(player) == 1) then setPlayerNametagShowing ( player, true ) end end end addEventHandler ( "onResourceStart", getResouceRootElement(getThisResource()), resourceStart It'll working? I can't try this now. Link to comment
Wumbaloo Posted August 16, 2016 Share Posted August 16, 2016 Forgot to setPlayerNametagShowing off for other player, but yea, should work function resourceStart() local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do setPlayerNametagShowing ( player, false) if(getElementData(source, tonumber(player) == 1) then setPlayerNametagShowing ( player, true ) end end end addEventHandler ( "onResourceStart", getResouceRootElement(getThisResource()), resourceStart Link to comment
Artisz Posted August 16, 2016 Author Share Posted August 16, 2016 It's not working. I have no errors or warnings. Link to comment
Wumbaloo Posted August 16, 2016 Share Posted August 16, 2016 function resourceStart() local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do setPlayerNametagShowing ( player, false) if(getElementData(getLocalPlayer(), tonumber(player) == 1) then setPlayerNametagShowing ( player, true ) end end end addEventHandler ( "onResourceStart", getResouceRootElement(getThisResource()), resourceStart Link to comment
Artisz Posted August 16, 2016 Author Share Posted August 16, 2016 Nothing. Always show the all player's nametag. And It's don't react anything(outputChatBox don't do anything). Link to comment
Wumbaloo Posted August 16, 2016 Share Posted August 16, 2016 function resourceStart() local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do setPlayerNametagShowing ( player, false) if(getElementData(getLocalPlayer(), tonumber(player) == 1) then setPlayerNametagShowing ( player, true ) end end end addEventHandler ( "onClientResourceStart", getResouceRootElement(getThisResource()), resourceStart Link to comment
Artisz Posted August 16, 2016 Author Share Posted August 16, 2016 It's working, thank you! Sorry for the lot of problem! If someone need this, here is my version: addEventHandler( 'onClientRender', root, function() local players = getElementsByType ( "player" ) for key, player in ipairs ( players ) do setPlayerNametagShowing ( player, false) if(getElementData(getLocalPlayer(), tonumber(getElementData(player,"accountID"))) == 1) then setPlayerNametagShowing ( player, true ) end end end) Link to comment
Wumbaloo Posted August 16, 2016 Share Posted August 16, 2016 No problem, sorry for codes that doesn't work. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now