You cannot compare position tables, you have to invoke a function like:if(getCreaturePos(cid) == {x=1234,y=1234,z=7}) then
function comparePosition(p1, p2)
return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z and true or false
end
comparePosition(p1, p2) already.local MusicEffect = {
[2076] = CONST_ME_SOUND_GREEN, --Fanfare
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 2076 then
-- area
if isInRange(player:getPosition(), Position(32330, 32214, 7), Position(32332, 32216, 7)) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Wow that is a terrible song.")
end
-- exact location
if player:getPosition() == Position(32330, 32214, 7) then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Wow that is a beautiful song.")
end
end
item:getPosition():sendMagicEffect(MusicEffect[item.itemid])
return true
end
How to detect when player plays fanfire, if he is in position x=100, y=120, z=7
Send player a msg?
You cannot compare position tables, you have to invoke a function like:if(getCreaturePos(cid) == {x=1234,y=1234,z=7}) then
function comparePosition(p1, p2)
return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z and true or false
end
comparePosition(p1, p2) already.Yea sorry, i forgot that i've edited this in my srv so i can compare table.You cannot compare position tables, you have to invoke a function like:
depending on tfs version it might haveLUA:function comparePosition(p1, p2) return pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z and true or false endcomparePosition(p1, p2)already.