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

Random position at login

Xeo

Zote
Joined
Jun 14, 2009
Messages
129
Solutions
1
Reaction score
2
Location
Chile
I've looked up in the forums and haven't found something like this :huh: well basically ..thats the idea!I'd like that every player that logs in will appear in a different position..every time!
 
:O thanks for the fast answer! but I get this error when I try it


18/01/2010 20:49:16] [Error - CreatureScript Interface]
[18/01/2010 20:49:16] data/creaturescripts/scripts/onlogin.lua:eek:nLogin
[18/01/2010 20:49:16] Description:
[18/01/2010 20:49:16] data/creaturescripts/scripts/onlogin.lua:10: bad argument #1 to 'random' (number expected, got table)
[18/01/2010 20:49:16] stack traceback:
[18/01/2010 20:49:16] [C]: in function 'random'
[18/01/2010 20:49:16] data/creaturescripts/scripts/onlogin.lua:10: in function <data/creaturescripts/scripts/onlogin.lua:1>

:eek: ?
 
Code:
local config = {
	pos = {
		{ x = 100, y = 100, z = 7 },
		{ x = 100, y = 100, z = 7 },
		{ x = 100, y = 100, z = 7 }
	},
	min = 8
}
function onLogin(cid)
	if(getPlayerLevel(cid) > config.min) then
		doTeleportThing(cid, config.pos[math.random(#config.pos)])
	end
	return TRUE
end
 
Fixed

@Dark,
Ahh yea, thanks. :thumbup:

data/creaturescripts/scripts/
Code:
function onLogin(cid)
	local pos = {
		{ x = 100, y = 100, z = 7 },
		{ x = 100, y = 100, z = 7 },
		{ x = 100, y = 100, z = 7 }
	}
	local min = 8
	if(getPlayerLevel(cid) > min) then
		doTeleportThing(cid, pos[math.random(#pos)])
	else
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	end
	return true
end
 
Last edited:
Back
Top