Ghazer
Member
- Joined
- Mar 13, 2009
- Messages
- 350
- Reaction score
- 6
Change map only if < 30 players online
Hello guys, this is changemap created by Summ... its great but I want add one feauture...
*If this is impossible please say to me...
I want this actions work only if server have 30- players online
Changemap:
- - - Updated - - -
This work to know when server have 30- players online...
But I dont know how to apply to work only in
Hello guys, this is changemap created by Summ... its great but I want add one feauture...
*If this is impossible please say to me...
I want this actions work only if server have 30- players online
Code:
doTeleportThing(pid, temple)
doRemoveConditions(pid)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
Changemap:
LUA:
local towns = {7, 5, 4, 2, 6, 3, 1}
local tp = {
id = 1387,
position = {x = 986, y = 1118, z = 6}
}
-- Do not change
local currentTown = 1
local function removeTp(pos, id)
local thing = getTileItemById(pos, id)
if thing.uid > 0 then
doRemoveItem(thing.uid)
end
end
function onThink(interval, lastExecution, thinkInterval)
local toPos = getTownTemplePosition(towns[currentTown])
for _, pid in ipairs(getPlayersOnline()) do
local temple = { x = 986, y = 1116, z = 6 }
doTeleportThing(pid, temple)
doRemoveConditions(pid)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
doBroadcastMessage("The map has been changed and all players have been teleported to the temple. Next map change will be in: 30 minutes!", MESSAGE_STATUS_WARNING)
end
currentTown = currentTown + 1
if not(towns[currentTown]) then
currentTown = 1
end
removeTp(tp.position, tp.id)
doCreateTeleport(tp.id, toPos, tp.position)
return true
end
- - - Updated - - -
This work to know when server have 30- players online...
LUA:
local online = getWorldCreatures()
if isPlayer(cid) then
if online < 30 then
But I dont know how to apply to work only in
Code:
doTeleportThing(pid, temple)
doRemoveConditions(pid)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
Last edited: