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

TalkAction [TFS 1.1] - !aol or !bless

FLE

Member
Joined
Oct 5, 2008
Messages
422
Reaction score
24
Location
Vancouver Canada
Hey Otland,
I decided too post these... just too promote use of tfs 1.1!

talkactions.xml
Code:
<talkactionwords="!bless"script="bless.lua"/>
<talkactionwords="!aol"script="aol.lua"/>

bless.lua
Code:
local bless ={1,2,3,4,5}
local price =100000

function onSay(player, words, param)

for i =1, table.maxn(bless)doif player:hasBlessing(bless[i])then
player:sendCancelMessage("You already have all the blessings.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false 
end
end

if player:removeMoney(price)then
for i =1, table.maxn(bless)do
player:addBlessing(bless[i])
end

player:sendTextMessage(MESSAGE_INFO_DESCR,"You have bought all blessings.")
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
else
player:sendCancelMessage("You don't have enough money.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)

end

return true

end
aol.lua
Code:
local price =20000

function onSay(player, words, param)

if player:removeMoney(price) then
player:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
player:addItem(2173,1) else
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendCancelMessage("You don't have enough money.")
end

end

Enjoy ~
 
Last edited:
The script seems to be working, but you should start using TAB to give the script a structure.
 
Im new too scripting I dont know proper structure, I just make it 200x until it works! ^^

btw -

in my notepad++ it has structure...

but when i paste it here in otland it goes like no spaces >_<
 
Last edited:
How could I add an exhaust too this !aol
Code:
local cfg = {
exhausted = 10, -- Time you are exhausted.
storage = 78945 -- Storage used for "exhaust."
}
local price =20000

function onSay(player, words, param)
    if (player:getStorageValue(cfg.storage) > os.time())then
        player:sendCancelMessage("You must wait another " .. player:getStorageValue(cfg.storage) - os.time() .. ' second' .. ((player:getStorageValue(cfg.storage) - os.time()) == 1 and "" or "s") .. ".")
    return false
    end
    if player:removeMoney(price) then
        player:getPosition():sendMagicEffect(CONST_ME_YELLOWENERGY)
        player:addItem(2173,1)
        player:setStorageValue(cfg.storage, os.time() + cfg.exhausted)
               else
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        player:sendCancelMessage("You don't have enough money.")
    end
    return false
end
 
Don't know if it works but proper indentation would be a start

Code:
local bless = {1, 2, 3, 4, 5}
local price = 100000

function onSay(player, words, param)
    for(i = 1, table.maxn(bless)) do
        if(player:hasBlessing(bless[i]) then
            player:sendCancelMessage("You already have all the blessings.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    if(player:removeMoney(price)) then
        for(i = 1, table.maxn(bless)) do
            player:addBlessing(bless[i])
        end
        player:sendTextMessage(MESSAGE_INFO_DESCR,"You have bought all blessings.")
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
        player:sendCancelMessage("You don't have enough money.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
    end
    return true
end
 
Back
Top