• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Need help with a script

Mr Drako

New Member
Joined
May 17, 2010
Messages
6
Reaction score
0
This script can remove any number of items from a location, all you have to do is add the item to the table as explained in the script. You can not remove the same item from two different locations, each item removed must have a different item ID.

What should I write in actions.xml? :confused:

Code:
---Made By Rooteh---
---Start Config---
local Config = {
                [2554] = {970, 1098, 7, 255},  --- [ItemID] = {PosX, PosY, PosZ, PosStack}  You can not use an ItemId Twice
                [2120] = {971, 1098, 7, 255},
                [2553] = {972, 1098, 7, 255},
                [2420] = {973, 1098, 7, 255},
}
local Teleport_To_Pos = {x = 975, y = 1096, z = 7}  --- Position the teleport will send the player
local Teleport_Spawn_Pos = {x = 972, y = 1096, z = 7} --- Position the teleport will be created
local TeleportTime = 12000 --- How long before the teleport disappears 1000 = 1 sec
---End Config---   Dont Edit Anything Below This Point
local Q_Items = {}
local function RemoveTeleport()
    doRemoveItem((getTileItemById(Teleport_Spawn_Pos, 1387)).uid, 1)
end
function onUse(cid, item, item2, frompos, topos)
    for i, v in pairs(Config) do     ---- i = [itemid]  v = {cords}
        if not (getThingFromPos({x = v[1], y = v[2], z = v[3], stackpos = v[4]}).itemid == i) then  ---- v[1] = xcords v[2] = ycords etc
            if item.itemid == 1945 then
                doTransformItem(item.uid, 1946)
            else
                doTransformItem(item.uid, 1945)
            end
        return true   --- If all of the itemids are not found at the locations given, the script is ended here with return true
        end
    end
    if item.itemid == 1945 then
        doTransformItem(item.uid, 1946)
    else
        doTransformItem(item.uid, 1945)
    end
    for i, v in pairs(Config) do
        Q_Items[i] = getTileItemById({x = v[1], y = v[2], z = v[3], stackpos = v[4]}, i)  --- The item.uid of each item is stored in the array Q_Items
    doRemoveItem(Q_Items[i].uid)  --- All of the item.uid which were stored on the previous line are removed from the game
    end
    doCreateTeleport(1387, Teleport_To_Pos, Teleport_Spawn_Pos)
    doPlayerSendTextMessage(cid, 22, "A teleport opened. Hurry it\'s only opened for "..(TeleportTime/1000).." seconds!")
    addEvent(RemoveTeleport, TeleportTime)  --- Starts a timer, when the timer is finished it runs Function RemoveTeleport at the top of the script
return true 
end

This script is made by Rooteh.
 
Last edited:
Back
Top