local item_required = 9020
local item_count = 1
local destination = { x = 1473, y = 1046, z = 7 }
local function reset(pos)
doTransformItem(getTileItemById(pos, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- check if lever is currently used
if item.itemid == 1946 then
return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset.")
end
-- check if player has item
if getPlayerItemCount(cid, item_required) < item_count then
return doPlayerSendTextMessage(cid, 22, "You do not have the required item to use this lever.")
end
-- remove item, transform lever, and add reset
doTeleportThing(cid, {x = 1473, y = 1046, z = 7})...
<action actionid="45001" event="script" value="script_name.lua"/>
local item_required = 1111
local item_count = 1
local destination = { x = 1000, y = 1000, z = 7 }
local function reset(pos)
doTransformItem(getTileItemById(pos, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- check if lever is currently used
if item.itemid == 1946 then
return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset.")
end
-- check if player has item
if getPlayerItemCount(cid, item_required) < item_count then
return doPlayerSendTextMessage(cid, 22, "You do not have the required item to use this lever.")
end
-- remove item, transform lever, and add reset
doTeleportThing(cid, destination)
doPlayerRemoveItem(cid, item_required, item_count)
doTransformItem(item.uid, item.itemid + 1)
addEvent(reset, 10 * 1000, toPosition)
return true
end
should i insert function onUse(cid, item, from x1469 y1046, itemEx, to x1471 y1046Code:function onUse(cid, item, fromPosition, itemEx, toPosition)
but how do i change where i will be teleport to
doTeleportThing(cid, {x = , y = , z =})
doPlayerRemoveItem(cid, item_required, item_count)
oops.LUA:doTeleportThing(cid, {x = , y = , z =})
Add that above;
LUA:doPlayerRemoveItem(cid, item_required, item_count)
local item_required = 9020
local item_count = 1
local destination = { x = 1473, y = 1046, z = 7 }
local function reset(pos)
doTransformItem(getTileItemById(pos, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- check if lever is currently used
if item.itemid == 1946 then
return doPlayerSendTextMessage(cid, 22, "Wait for switch to reset.")
end
-- check if player has item
if getPlayerItemCount(cid, item_required) < item_count then
return doPlayerSendTextMessage(cid, 22, "You do not have the required item to use this lever.")
end
-- remove item, transform lever, and add reset
doTeleportThing(cid, {x = 1473, y = 1046, z = 7})
doPlayerRemoveItem(cid, item_required, item_count)
doTransformItem(item.uid, item.itemid + 1)
addEvent(reset, 10 * 1000, toPosition)
return true
end