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

Lua I'm looking for a script that allows an item to be used by a certain vocation!

nicoelperro

New Member
Joined
May 3, 2024
Messages
14
Reaction score
3
Hey! First of all thanks to all of you for reading me.. Like i said, i need a script that allows only non-vocation characters to use the item, so people in main island can't use it. :)
This server works with TFS 1.3 and it's a 8.6 version :)
If someone can help me ASAP i would appreciate it very much.. and if i'm in the wrong thread please switch me to the right one, don't delete this please :D
 
Use a .lua file, and place that file into data/scripts
LUA:
local nonVocation = 0 -- vocation id that can use the item
local itemId = 1111 -- itemId of the item

local testAction = Action()

function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getVocation():getId() ~= nonVocation then
        print("Some other vocation used the item.")
        return false
    end
    print("Non-Vocation used the item.")
    item:remove(1) -- remove the item?
    return true
end

testAction:id(itemId)
testAction:register()
 
Use a .lua file, and place that file into data/scripts
LUA:
local nonVocation = 0 -- vocation id that can use the item
local itemId = 1111 -- itemId of the item

local testAction = Action()

function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getVocation():getId() ~= nonVocation then
        print("Some other vocation used the item.")
        return false
    end
    print("Non-Vocation used the item.")
    item:remove(1) -- remove the item?
    return true
end

testAction:id(itemId)
testAction:register()
That was very helpful! thanks a lot man <3
 
Back
Top