ma2med Posted November 23, 2014 Posted November 23, 2014 hi, i was doing small script but it's seem like setPlayerNametagShowing don't work: hasClicked = true addCommandHandler("ok",function() if hasClicked == true then for i,player in ipairs(getElementsByType("player")) do setPlayerNametagShowing ( player, false ) end hasClicked = false else for i,player in ipairs(getElementsByType("player")) do setPlayerNametagShowing ( player, true ) hasClicked = true end end end )
myonlake Posted November 24, 2014 Posted November 24, 2014 Please describe the issue you are facing, or we cannot help. If I helped you, please click the like button on the right Thanks!
Bilal135 Posted November 24, 2014 Posted November 24, 2014 local hasClicked = true addCommandHandler("ok", function() if hasClicked == true then setPlayerNametagShowing ( source, false ) end if hasClicked == false setPlayerNametagShowing ( source, true ) end end ) "Get busy living or get busy dying"
myonlake Posted November 24, 2014 Posted November 24, 2014 local hasClicked = true addCommandHandler("ok", function() if hasClicked == true then setPlayerNametagShowing ( source, false ) end if hasClicked == false setPlayerNametagShowing ( source, true ) end end ) This code makes no sense, please, do not post answers if you cannot write a simple if statement correctly. And besides, addCommandHandler returns no source. If I helped you, please click the like button on the right Thanks!
.:HyPeX:. Posted November 24, 2014 Posted November 24, 2014 This code makes no sense, please, do not post answers if you cannot write a simple if statement correctly. And besides, addCommandHandler returns no source. Yep, its actually function(source,cmd) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
ma2med Posted November 24, 2014 Author Posted November 24, 2014 I wan't hide the nametag from all players but it's not working it's still show
Irish Posted November 25, 2014 Posted November 25, 2014 function disableTag () for i, player in ipairs(getElementsByType("player")) do if isPlayerNametagShowing(player) == true then setPlayerNametagShowing (player, false) outputChatBox ("Players name tag disabled!", player) elseif isPlayerNametagShowing(player) == false then setPlayerNametagShowing(player, true) outputChatBox ("Players name tag enabled!", player) end end end addCommandHandler ("ok", disableTag) This might work properly for disabling player name tag. I haven't tested it though.
AJXB Posted November 25, 2014 Posted November 25, 2014 If you are using hasClicked to see if the user clicked on a GUI Button, better use onClientGUIClick. If you are using hasClicked for something else, you may use a short code: hasClicked = true function handleTags () for i,v in ipairs (getElementsByType ('player')) do if hasClicked then setPlayerNametagShowing( v, not(hasClicked) ) outputChatBox ("Nametags triggered") end end end addCommandHandler ("triggertags",handleTags) I did not test this, reply with any error you find. Note: You need to disable nametags on client side, you don't want to disable all nametags for all players, right? ~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names. ~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.
ma2med Posted November 29, 2014 Author Posted November 29, 2014 If you are using hasClicked to see if the user clicked on a GUI Button, better use onClientGUIClick.If you are using hasClicked for something else, you may use a short code: hasClicked = true function handleTags () for i,v in ipairs (getElementsByType ('player')) do if hasClicked then setPlayerNametagShowing( v, not(hasClicked) ) outputChatBox ("Nametags triggered") end end end addCommandHandler ("triggertags",handleTags) I did not test this, reply with any error you find. Note: You need to disable nametags on client side, you don't want to disable all nametags for all players, right? yes for all players but when I do that it's still showing it's bug maybe?
myonlake Posted November 29, 2014 Posted November 29, 2014 You probably use a custom nametag script that does not work with that function. If I helped you, please click the like button on the right Thanks!
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