• 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!

Lua Random Temple Login

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Reaction score
12
Location
TV
I would like modify this script for when login,go random towns,not by time.

LUA:
local config, new = {
	minTownId = 1,
	maxTownId = 7
}, 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
		doPlayerSetTown(pid, new)
		doTeleportThing(pid, getTownTemplePosition(new))
		doRemoveCondition(pid, CONDITION_INFIGHT)
		doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
		doCreatureAddMana(pid, getCreatureMaxMana(pid))
	end
	db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
	doBroadcastMessage("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
	return true
end

Im using TFS 0.3.6

Thanks,
Stewie.
 
LUA:
local t = {
      t = {1,2,3,4,5,6,7}
      }
function onLogin(cid)
	local town = math.random(1, #t.t)
	doTeleportThing(cid, (getTownTemplePosition(town)), false)
return TRUE
end
 

Similar threads

Back
Top