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

Reply to thread

That's not true. You just need to ask him the correct question, I never struggled with any script he made for me


[CODE=lua]local config = {

    [44189] = {reset = 4, slot = "wand", message = "You need 4 resets to equip this wand."},

    [15410] = {reset = 6, slot = "wand", message = "You need 6 resets to equip this wand."},

    [18406] = {reset = 8, slot = "armor", message = "You need 8 resets to equip this armor."},

    [39323] = {reset = 10, slot = "armor", message = "You need 10 resets to equip this armor."},

    [15409] = {reset = 5, slot = "head", message = "You need 5 resets to equip this helmet."},

    [39319] = {reset = 7, slot = "head", message = "You need 7 resets to equip this helmet."},

    [15407] = {reset = 6, slot = "legs", message = "You need 6 resets to equip these legs."},

    [18404] = {reset = 8, slot = "legs", message = "You need 8 resets to equip these legs."},

    [15408] = {reset = 5, slot = "ammo", message = "You need 5 resets to equip this ammunition."},

    [15411] = {reset = 7, slot = "ring", message = "You need 7 resets to equip this ring."},

    [39312] = {reset = 9, slot = "necklace", message = "You need 9 resets to equip this necklace."},

    [18410] = {reset = 6, slot = "feet", message = "You need 6 resets to equip these boots."}

}


local STORAGE_RESET = 525000


local function checkResetRequirement(player, item)

    local itemConfig = config[item:getId()]

    if not itemConfig then return true end

   

    local playerResets = math.max(player:getStorageValue(STORAGE_RESET), 0)

   

    if playerResets < itemConfig.reset then

        player:sendTextMessage(MESSAGE_STATUS_SMALL, itemConfig.message)

        return false

    end

    return true

end


local function registerEquipEvents(event)

    for itemId, itemConfig in pairs(config) do

        event:id(itemId)

        event:slot(itemConfig.slot)

    end

    event:register()

end


local equipEvent = MoveEvent()

equipEvent.onEquip = function(player, item, slot, isCheck)

    return checkResetRequirement(player, item)

end

registerEquipEvents(equipEvent)


local unequipEvent = MoveEvent()

unequipEvent.onDeEquip = function(player, item, slot, isCheck)

    return true

end

registerEquipEvents(unequipEvent)

[/CODE]


Back
Top