Count/Check PlayerOnscreen
#81
--[[
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
--[[
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