Jump to content

Help


ma2med

Recommended Posts

Posted

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 
) 
  

Posted
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"

Posted
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!

Posted

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

gKhdyRJ.png

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

Posted

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.

 

Posted
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?

Posted

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!

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