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

[TFS 1.X] Revscript !aol

highsanta

Advanced OT User
Joined
Dec 20, 2023
Messages
396
Solutions
3
Reaction score
173
Lua:
local talk = TalkAction("/aol", "!aol")

function talk.onSay(player, words, param)
    local moneyNeeded = 50000
    if player:getMoney() >= moneyNeeded then
        player:removeMoney(moneyNeeded)
        player:addItem(2173, 1) -- Amulet of Loss ID is 2173
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have bought Amulet of Loss for " .. moneyNeeded .. " gold.")
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. moneyNeeded .. " gold to buy Amulet of Loss.")
    end
end

talk:separator(" ")
talk:register()
 

Attachments

your script is cool and very simple. For those who want to enhance the script with some effects, etc., here it is :).
Lua:
local config = {
    aolPrice = 50000, -- Amulet of Loss Price
    aolItemId = 2173, -- Amulet of Loss ID
    buyEffect = CONST_ME_MAGIC_GREEN,
    buyMessage = "AOL!"
}

local talk = TalkAction("/aol", "!aol")

function talk.onSay(player, words, param)
    if player:getMoney() >= config.aolPrice then
        player:removeMoney(config.aolPrice)
        player:addItem(config.aolItemId, 1)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You have bought Amulet of Loss for " .. config.aolPrice .. " gold.")
        player:getPosition():sendMagicEffect(config.buyEffect)
        player:say(config.buyMessage, TALKTYPE_MONSTER_YELL)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. config.aolPrice .. " gold to buy Amulet of Loss.")
    end
end

talk:separator(" ")
talk:register()
 
Back
Top