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

math.random - What is wrong?

Lukanio

### Own3D ###
Joined
Nov 25, 2008
Messages
325
Reaction score
6
Script not working:
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local chance = math.random(1,4)
if chance == 1 then
return doTeleportThing(cid, {x=738, y=1008, z=7})
elseif chance == 2 then
return doTeleportThing(cid, {x=739, y=1008, z=5})
elseif chance == 3 then
return doTeleportThing(cid, {x=738, y=1007, z=3})
elseif chance == 4 then
return doTeleportThing(cid, {x=739, y=1006, z=1})
else
doTeleportThing(cid, fromPosition)
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return true
end
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local chance = math.random(1,4)
	if chance == 1 then
	doTeleportThing(cid, {x=738, y=1008, z=7})
	
	elseif chance == 2 then
	doTeleportThing(cid, {x=739, y=1008, z=5})

	elseif chance == 3 then
	doTeleportThing(cid, {x=738, y=1007, z=3})

	elseif chance == 4 then
	doTeleportThing(cid, {x=739, y=1006, z=1})

	else
	doTeleportThing(cid, fromPosition)
	doPlayerSendCancel(cid, "Sorry, not possible.")
	end
	
return true
end
 
Back
Top Bottom