function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
reqPos = {x=,y=,z=}, -- Position, on which player has to stand while music is playing.
inside = {x=,y=,z=}, -- Position where player will be teleported.
msg = "Bad Music!"
}
local storage = getPlayerStorageValue(cid, 2073)
if (getCreaturePosition(cid) == config.reqPos) then
if item.itemid == 2073 then
if storage == -1 then
setPlayerStorageValue(cid, 2073, 1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "DO...")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, config.msg)
setPlayerStorageValue(cid, 2073, -1)
end
elseif item.itemid == 2070 then
if storage == 1 then
setPlayerStorageValue(cid, 2073, 2)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "RE...")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, config.msg)
setPlayerStorageValue(cid, 2073, -1)
end
elseif item.itemid == 2079 then
if storage == 2 then
setPlayerStorageValue(cid, 2073, -1)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "MI...")
doTeleportThing(cid, config.inside)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, config.msg)
setPlayerStorageValue(cid, 2073, -1)
end
end
end
return TRUE
end