Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local maps = {
- [1] = { -- Mapa 1
- [1] = 2, -- Vocation 1 cai na cidade 2
- [2] = 5, -- Vocation 2 cai na cidade 5
- },
- [2] = { -- Mapa 2
- [1] = 8, -- Vocation 1 cai na cidade 8
- [2] = 6, -- Vocation 2 cai na cidade 6
- }
- }
- setGlobalStorageValue(7732, math.random(#maps)) -- Quando servidor inicia ele define o mapa inicial como sendo algum entre os da tabela `maps`
- function onThink()
- local map = getGlobalStorageValue(7732)
- for a = 1, math.huge do
- local mapa_random = math.random(#maps)
- if mapa_random ~= map then
- map = mapa_random
- break
- elseif a == 50 then
- map = 1
- break
- end
- end
- for _, cid in pairs(getPlayersOnline()) do
- local city = maps[map][getPlayerVocation(cid)]
- if city then
- doPlayerSendTextMessage(cid, 20, "Agora sua cidade é ".. getTownName(city) .. ".")
- doPlayerSetTown(cid, city)
- doTeleportThing(cid, getTownTemplePosition(city))
- else
- print("Erro, vocação de id ".. getPlayerVocation(cid) .. " não configurada no ChangeMap.")
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment