Jump to content

I need HELP pls


ViniG

Recommended Posts

3 hours ago, ViniG said:

What can I use to make all players invisible and just what is playing visible?

Here is a command that can be used to toggle all players visibility:

Server

--//Variable stating whether players are visible or not
local is_visible = "true"

function setPlayersVisibility(src, cmd, state)
  if (not state or state ~= "true" or state ~= "false") then
    outputChatBox("Syntax: /setplayersvisible <state>", src, 255, 0, 0)
    return false
  end
  
  if (state == is_visible) then
    outputChatBox("Players visibility is already set to this value.", src, 255, 0, 0)
    return false
  end
  
  for _, player in ipairs(getElementsByType("player"))
    if (state == "true") then
      if (is_visible ~= "true") then
        is_visible = "true"
      end
      setElementAlpha(player, 255)
    else
      if (is_visible ~= "false") then
        is_visible = "false"
      end
      setElementAlpha(player, 0)
    end
  end

  outputChatBox("You have changed the visibility of all players to ".. is_visible .. ".", src, 0, 255, 0)
  return true
end
addCommandHandler("setplayersvisible", setPlayersVisibility)

 

Also, if you want to make them completely invisible you could use:

setPlayerHudComponentVisible ( player thePlayer, string component, bool show )

This can be used to hide their nametag.

Edited by Pembo
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...