brunolopes
New Member
- Joined
- Nov 8, 2009
- Messages
- 49
- Reaction score
- 1
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local xpos = {x = fromPosition.x+1, y = fromPosition.y, z = fromPosition.z, stackpos = 2}
local x = getThingFromPos(xpos)
local ypos = {x = fromPosition.x, y = fromPosition.y+1, z = fromPosition.z, stackpos = 2}
local y = getThingFromPos(ypos)
if (item.uid == 35000) then
if (item.itemid == 1754) then
doTransformItem(item.uid, 1762)
doTransformItem(y.uid, 1763)
doSetItemOutfit(cid, 4390, 5*1000)
doTeleportThing(cid, fromPosition)
elseif (item.itemid == 1760) then
doTransformItem(item.uid, 1764)
doTransformItem(x.uid, 1765)
doSetItemOutfit(cid, 4390, 5*1000)
doTeleportThing(cid, fromPosition)
end
end
addEvent(doTeleportThing, 5*1000, cid, {x = 1023, y = 1020, z = 8})
addEvent(doPlayerSendTextMessage, 5*1000, cid, MESSAGE_EVENT_ADVANCE, 'Your sleeping time has finished!')
addEvent(doPlayerSetStorageValue, 5*1000, cid, 3501, 0)
if (getPlayerStorageValue(cid, 3501) == 1) then
addEvent(setGlobalStorageValue, 5*1000, 15001, 0)
elseif (getPlayerStorageValue(cid, 3501) == 2) then
addEvent(setGlobalStorageValue, 5*1000, 15002, 0)
elseif (getPlayerStorageValue(cid, 3501) == 3) then
addEvent(setGlobalStorageValue, 5*1000, 15003, 0)
elseif (getPlayerStorageValue(cid, 3501) == 4) then
addEvent(setGlobalStorageValue, 5*1000, 15004, 0)
end
end
Hello, I made this script, for when the player uses a bed, this changes to the used bed, and the player sleeps for some time, without logging off.
But, when the player is "kicked off" from the bed, I need to transform it back to the normal bed (IDs: 1754, 1755, 1760, 1761), someone can help me?
This is a Inn System.