Mr.Caffeine
Active Member
- Joined
- Nov 4, 2018
- Messages
- 79
- Reaction score
- 43
Hello, there is a way to make this script select only the players from this area of getSpectators?
I need the getSpectators count ignores monsters and npcs.
TFS version: 0.4
I need the getSpectators count ignores monsters and npcs.
TFS version: 0.4
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local g = getCreaturePosition(cid)
local amountOfPlayersmin = 3
local amountOfPlayersmax = 4
local teleport = {x = 1942, y = 3056, z = 8}
local centerPos = {x = g.x, y = g.y, z = g.z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE}
local rangeX = 3
local rangeY = 3
local p = getSpectators(centerPos, rangeX, rangeY)
local players = #p
if players >= amountOfPlayersmin and players <= amountOfPlayersmax then
for _, pid in pairs(p) do
doTeleportThing(pid, teleport)
doSendMagicEffect(getCreaturePosition(pid), CONST_ME_TELEPORT)
end
else
doPlayerSendTextMessage(cid, 25, "Is necessary to gather a group of 3 to 4 players in this room.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return true
end
end