• 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!

Remove items from /i

JaquezGaming

Member
Joined
Feb 7, 2018
Messages
10
Reaction score
5
Hi im just wondering if anyone have script for 0.4 where it locks items for example (Plate Armor) so its not possible to do it in /i but you can create it through /rc or only owner can create the item? :)
 
Solution
Look in talkactions and find the script that /i uses.

Inside that script, look for the line that shows something similar or exactly the same as this..
Lua:
local id = tonumber(t[1])
if(not id) then
    errors(false)
    id = getItemIdByName(t[1])
    errors(true)

    if(not id) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
        return true
    end
end
Directly underneath that block of code, place this code.
Lua:
if isInArray(locked_items, id) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
    return true
end
At the top of the script above function onSay, place this code.
Lua:
local locked_items =...
Look in talkactions and find the script that /i uses.

Inside that script, look for the line that shows something similar or exactly the same as this..
Lua:
local id = tonumber(t[1])
if(not id) then
    errors(false)
    id = getItemIdByName(t[1])
    errors(true)

    if(not id) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
        return true
    end
end
Directly underneath that block of code, place this code.
Lua:
if isInArray(locked_items, id) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
    return true
end
At the top of the script above function onSay, place this code.
Lua:
local locked_items = {2463, 1111, 2222, 3333}

The above steps will 'lock' the items from being spawned.
Now, to only allow a 'owner' to spawn these items, you have a couple of choices.

The easier choice, is to only allow owners to have the highest access on the server. (such as access 6 in data/xml/groups.xml)
And then implement that into the script, like this.
Lua:
if isInArray(locked_items, id) then
    if getPlayerAccess(cid) < 6 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
        return true
    end
end
The slightly harder choice would be to manually input the 'owners' name into the script, and compare that instead, like this.
Lua:
local owners = {"xikini", "jaquezgaming"} -- use only lowercase letters (put this up above function onSay)
Lua:
if isInArray(locked_items, id) then
    if not isInArray(owners, getCreatureName(cid):lower()) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
        return true
    end
end

In either case, this should do what you are wanting, I believe.

Cheers.
 
Solution
Look in talkactions and find the script that /i uses.

Inside that script, look for the line that shows something similar or exactly the same as this..
Lua:
local id = tonumber(t[1])
if(not id) then
    errors(false)
    id = getItemIdByName(t[1])
    errors(true)

    if(not id) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
        return true
    end
end
Directly underneath that block of code, place this code.
Lua:
if isInArray(locked_items, id) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
    return true
end
At the top of the script above function onSay, place this code.
Lua:
local locked_items = {2463, 1111, 2222, 3333}

The above steps will 'lock' the items from being spawned.
Now, to only allow a 'owner' to spawn these items, you have a couple of choices.

The easier choice, is to only allow owners to have the highest access on the server. (such as access 6 in data/xml/groups.xml)
And then implement that into the script, like this.
Lua:
if isInArray(locked_items, id) then
    if getPlayerAccess(cid) < 6 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
        return true
    end
end
The slightly harder choice would be to manually input the 'owners' name into the script, and compare that instead, like this.
Lua:
local owners = {"xikini", "jaquezgaming"} -- use only lowercase letters (put this up above function onSay)
Lua:
if isInArray(locked_items, id) then
    if not isInArray(owners, getCreatureName(cid):lower()) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry! This item is not allowed to be created.")
        return true
    end
end

In either case, this should do what you are wanting, I believe.

Cheers.
Thanks bro ❤️
 
Back
Top