function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {x=123, y=112, z=7}
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS)
doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS)
return TRUE
end
function onEquip(cid, item, slot)
local pos = {x=123, y=112, z=7}
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS)
doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS)
return TRUE
end
When you use it or when you wear it?
Use (Actions):
PHP:function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x=123, y=112, z=7} doTeleportThing(cid, pos, TRUE) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS) doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS) return TRUE end
Wear (Movements):
PHP:function onEquip(cid, item, slot) local pos = {x=123, y=112, z=7} doTeleportThing(cid, pos, TRUE) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS) doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS) return TRUE end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {x=123, y=112, z=7}
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS)
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS)
return TRUE
end
function onEquip(cid, item, slot)
local pos = {x=123, y=112, z=7}
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS)
doTeleportThing(cid, pos, TRUE)
doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS)
return TRUE
end
If you leave the codes like this youll get 2 magic effects on the same place.
PHP:function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = {x=123, y=112, z=7} doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS) doTeleportThing(cid, pos, TRUE) doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS) return TRUE end
PHP:function onEquip(cid, item, slot) local pos = {x=123, y=112, z=7} doSendMagicEffect(getPlayerPosition(cid), CONST_ME_GIFT_WRAPS) doTeleportThing(cid, pos, TRUE) doSendMagicEffect(pos, CONST_ME_GIFT_WRAPS) return TRUE end
The computer is dumb, it doesnt think logically enough to understand that you want to send the effect, teleport and effect again. It reads line by line.