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

Ugh, need more help...

Forum General

1st Donator Division
Joined
May 6, 2010
Messages
200
Reaction score
1
Location
Toronto, Canada
Sorry for posting too many help threads.
I tried making it myself first, but then it just blows me off when it doesn't work.

This time; the script is supposed to randomize everyone's temple position everytime they log in.

Here's what I have:
Code:
local TEMPLE = {{{ x = 247, y = 251, z =7 }}, { x = 258, y = 245, z =7 }}

function onLogin(cid)
	local random = math.random(1, table.maxn(TEMPLE))
	if isPlayer(cid) == TRUE then
		doTeleportThing(cid, random)
	end
	return true
end

I have 2 positions set because I just wanted to test and make sure it works.

Here's the error:
[07/05/2010 21:23:28] [Error - CreatureScript Interface]
[07/05/2010 21:23:28] data/creaturescripts/scripts/randomtemple.lua:onLogin
[07/05/2010 21:23:28] Description:
[07/05/2010 21:23:28] attempt to index a number value
[07/05/2010 21:23:28] stack traceback:
[07/05/2010 21:23:28] [C]: in function 'doTeleportThing'
[07/05/2010 21:23:28] data/creaturescripts/scripts/randomtemple.lua:6: in function <data/creaturescripts/scripts/randomtemple.lua:3>
 
Code:
local TEMPLE = {{ x = 247, y = 251, z =7 }, { x = 258, y = 245, z =7 }}
function onLogin(cid)
	if isPlayer(cid) then
		doTeleportThing(cid, TEMPLE[math.random(#TEMPLE)])
	end
	return true
end
 
Back
Top