slaw
Software Developer
PHP:
function getNextPosFromDir(fromPos, dir, size)
local newPos =
{
[0]={x=fromPos.x, y=fromPos.y-size, z=fromPos.z},
[1]={x=fromPos.x+size, y=fromPos.y, z=fromPos.z},
[2]={x=fromPos.x, y=fromPos.y+size, z=fromPos.z},
[3]={x=fromPos.x-size, y=fromPos.y, z=fromPos.z}
}
return newPos[dir]
end
This table was made by someone else, dont rememember.
If you want get position, where player is looking + 5 squares.
newPos = getNextPosFromDir(getCreaturePos(cid), getPlayerLookDir(cid), 5)
example talkaction: (teleportntiles.lua)
PHP:
function onSay(cid, words, param)
newPos = getNextPosFromDir(getCreaturePos(cid), getPlayerLookDir(cid), param)
doTeleportThing(cid, newPos, TRUE)
end
talkactions.xml
PHP:
<talkaction filter="word" log="no" access="3" words="/a" script="teleportntiles.lua"/>
Last edited: