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

Lua Function doTeleportThing

Lee Weii

New Member
Joined
Aug 19, 2008
Messages
41
Reaction score
1
In this function, teleport the things to the direction that we put,
but i made a spell, thats teleport player to 2sqm back.
But the player enter in Walls, have one solution to not enter in walls/houses ?
 
It's a lot of coding, but you have to detect whether the destination XYZ is a wall object or not before you doTeleportThing. You can get the itemid of the object by getThingfromPos(pos[]).itemid; so if itemid ~= walls[], then you can doTeleportThing().
 
You can use:
Lua:
local item = getThingfromPos(your_pos)
if hasProperty(item.uid, 0) == TRUE or hasProperty(item.uid, 3) == TRUE then //BLOCKSOLID & BLOCKPATH
    return TRUE
end
 
local item = getThingfromPos(your_pos)
if hasProperty(item.uid, 0) == TRUE or hasProperty(item.uid, 3) == TRUE then //BLOCKSOLID & BLOCKPATH
return TRUE
end

I need change something ? or just put in script?
 
PHP:
function onCastSpell(cid, param)

local creature = getCreatureTarget(cid)
local pos = getCreaturePosition(cid)
local item = getCreaturePosition(cid)
if hasProperty(item.uid, 0) == TRUE or hasProperty(item.uid, 3) == TRUE then
    return TRUE
end 

   if isCreature(creature) == TRUE then
   doSendDistanceShoot(pos,getThingPos(creature),38)
   doSendMagicEffect(getThingPos(creature),3)
   doMoveCreature(creature,getDirectionBetween(pos,getThingPos(creature)))
   else
   doPlayerSendCancel(cid,"You need select the target.")
   end

return TRUE
end

Here, my code, i put in but doesn't work. :S, so is the original.
 
Last edited:
Back
Top