Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
1.4K
Count/Check PlayerOnscreen #81
File: player_count.lua | 254b | 10 lines.
 --[[
  Script made by Lee (Discord: l33_) - www.trainorcreations.com
  If you want to support my work, feel free to donate at https://trainorcreations.com/donate
  PS. Stop ripping off my work and selling it as your own.
 ]]--
function checkPlayerOnScreen()
  for _, creature in ipairs(getSpectators(pos())) do
    if creature:isPlayer() and not creature:isLocalPlayer() then
      return true
    end
  end
  return false
end

 -- if checkPlayerOnScreen() then return end
File: check_player_screen.lua | 349b | 13 lines.
 --[[
  Script made by Lee (Discord: l33_) - www.trainorcreations.com
  If you want to support my work, feel free to donate at https://trainorcreations.com/donate
  PS. Stop ripping off my work and selling it as your own.
 ]]--
function countPlayers()
  local playerCount = 0
  for _, creature in ipairs(getSpectators(pos(), false)) do
    if creature:isPlayer() and not creature:isLocalPlayer() then
      playerCount = playerCount +1
    end
  end
  return playerCount
end

macro(2000, "PlayeronScreen", function()
  say("players on screen:"..countPlayers())
end)

13 Jul 2023
Ads