Sup. Need some help with this script. Script works perfectly, except when I turn my server on it sets my town_id to 0 x=0 y=0 z=0, and no one can Login, It says temple position is wrong. I have to turn on my server, then add the script into globalevents and reload it for it to work. Anyone know how to make it so I don't have to do it everytime? Lol
ALSO! How can I make it so it says Map has been changed to "Hell" or "yalahar" etc etc depending on the town_id it was changed to,
I figure you have to do something with getTownTemplePosition(townId). But when no ones logged in to start then how does it set a town to begin with. Help please!local config, new = {
minTownId = 1,
maxTownId = 10
}, 0
function onThink(interval, lastExecution)
for _, pid in ipairs(getPlayersOnline()) do
local town = getPlayerTown(pid)
new = town < config.maxTownId and town + 1 or config.minTownId
local minutes = 5
doBroadcastMessage("It has been one hour! The map has been changed! | Online Players: "..#getPlayersOnline())
doPlayerSetTown(pid, new)
doTeleportThing(pid, getTownTemplePosition(new))
doRemoveCondition(pid, CONDITION_INFIGHT)
end
db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
return true
end
Last edited: