• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Count players

nevix

Tunzodus.net
Joined
Mar 31, 2010
Messages
356
Reaction score
62
Location
Lithuanian
Looking for help how to count players if specified zone?

My script but doesnt work:
Code:
centerPos = {x = 32345, y = 32222, z = 7}

function onUse(cid, item, fromPosition, itemEx, toPosition)


count = 0
        local spectators = getSpectators(centerPos, 2, 2, false)
        if spectators ~= nil then
                for _, spectator in ipairs(spectators) do
                        if isPlayer(spectator) then   
                        count = count + 1
                             
                        end
                end
        end
       

        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Info."..count.."")


return true
end
 
SOshWIv.png


It's working for me, perhaps wrong centerPos? :p
 

Similar threads

Back
Top