Zuma Master
~Holes Through Happiness~
Hello. I have been trying to create a spell that teleports the caster to a random space in a 3x3 square around him. So, i have , after about one hour , resulted with this:
Will this , do the job? i have no server engine on this computer to test it , so i need to ask on the forums over here , by the way if it does work , feel free to use it , i dont mind at all.
Code:
local playerpos = getCreaturePos(cid)
local position = {fromx = playerpos.x - 3, fromy = playerpos.y - 3, tox = playerpos.x + 3, toy = playerpos.y + 3, z = playerpos.z}
function onCastSpell(cid, spell, words)
local pos = {x=math.random(position.fromx,position.tox),y=math.random(position.fromy,position.toy),z=position.z}
doTeleportThing(cid, pos)
return 1
end