Limite de player por sala
Introdução:
Esse script pode ser bem útil para baiak onde as salas tão sempre cheia de player upando ou então para eventos.
O script simplesmente checa a quantidade de player que tem dentro da sala, caso não tenha atingido o limite o player pode entrar caso não, manda uma mensagem falando que a sala esta lotada.
Exemplo de uso: pode servir até para a anihilator ou demon aok, invitando que um segundo time entre na sala antes que o primeiro acabe.
Caso a sala esteja lotada.
Caso não.
Em data/movement/script, crie
LimiteArea.lua e adicione.
-- Do not remove the credits ---- [MOVEEVENT] Limite de player por sala ---- Developed by Rigby ---- Especially for the Xtibia.com -- function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)local config = {-- Config ---- [ACTIONID] = {area = getPlayersInArea(AREA QUE IRA CHECAR (FROMPOS,TOPOS)), amountOfPlayers = QUANTIDADE QUE CABE, teleport = PARA ONDE SERA TELEPORTADO}[213123] = {area = getPlayersInArea({x = 1030, y = 1020, z = 7}, {x = 1040, y = 1030, z = 7}), amountOfPlayers = 1, teleport = {x = 1037, y = 1025, z = 7}},[543543] = {area = getPlayersInArea({x = 1037, y = 1025, z = 7}, {x = 1041, y = 1025, z = 7}), amountOfPlayers = 2, teleport = {x = 1036, y = 1025, z = 7}},-- Config --} if config[item.actionid] then if #config[item.actionid].area < config[item.actionid].amountOfPlayers then doTeleportThing(cid, config[item.actionid].teleport, false) doPlayerSendTextMessage(cid, 25, "Welcome") else doPlayerSendTextMessage(cid, 25, "The room already reached its limit "..config[item.actionid].amountOfPlayers.." player 's wait someone out .") doTeleportThing(cid, fromPosition) end endreturn trueend function getPlayersInArea(fromPos, toPos) -- Function made by Vodkartlocal players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return playersend
<movevent type="StepIn" actionid="213123;543543:ACTIONID" event="script" value="LimiteArea.lua"/>