• 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 Buying Mount with Command

MaR0

Banned User
Joined
Apr 16, 2018
Messages
272
Solutions
3
Reaction score
29
Is it possible that I can create lua script 'talkaction' to buy any mount? i'm using tfs 1.2 client 10.98
If anyone was able to do it can post to example
thanks in advance
regards
 
Solution
Fast and simple.
Code:
function onSay(player, words, param)
    player:addMount(mountId or mountName)
    player:removeMoney(cost)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought a mount.")
    return false
end
Fast and simple.
Code:
function onSay(player, words, param)
    player:addMount(mountId or mountName)
    player:removeMoney(cost)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought a mount.")
    return false
end
 
Solution
Well, that's simple bro
take a look at this npc script "all functions layed out for you"
NPC - Mounts Seller
take a look at this part of code and edit it to fit your needs with onplayersay for talkactions
Code:
local table = {
    ["Widow Queen"] = {price = 0, id = 1},
    ["Racing Bird"] = {price = 0, id = 2},
    ["War Bear"] = {price = 0, id = 3},
    ["Black Sheep"] = {price = 0, id = 4},
    ["Midnight Panther"] = {price = 0, id = 5},
    ["Draptor"] = {price = 0, id = 6},
    ["Titanica"] = {price = 0, id = 7},
    ["Tin Lizzard"] = {price = 0, id = 8},
    ["Blazebringer"] = {price = 0, id = 9},
    ["Rapid Boar"] = {price = 0, id = 10},
    ["Stampor"] = {price = 0, id = 11},
    ["Undead Cavebear"] = {price = 0, id = 12}
}
Code:
if table[msg] then
      local t = table[msg]
Code:
if getPlayerPremiumDays(cid) >= 1 then
        if not getPlayerMount(cid, t.id) then
         if doPlayerRemoveMoney(cid, t.cena) then
          doPlayerAddMount(cid, t.id)
          selfSay("You lost "..t.price.." gp! for mount!", cid)
          talkState[talkUser] = 0
         else
          selfSay("Sorry, you do not have enough money!", cid)
          talkState[talkUser] = 0
         end
        else
         selfSay("You already have this mount!", cid)
         talkState[talkUser] = 0
        end
       else
        selfSay("You must be Premium!", cid)
        talkState[talkUser] = 0
       end
    else
    selfSay('What? Please told me a correct name of mount!', cid)
    talkState[talkUser] = 0
   end
   return true
end

hope u get it working :)

/Nixez
 
Fast and simple.
Code:
function onSay(player, words, param)
    player:addMount(mountId or mountName)
    player:removeMoney(cost)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought a mount.")
    return false
end
i have used your script but it's says You have bought a mount., but there's no mounts.
here's some photo to explain.
AkaQoi.png
 
i have used your script but it's says You have bought a mount., but there's no mounts.
here's some photo to explain.
AkaQoi.png
I assume you changed these template variables he gave you in the code right?
 
I assume you changed these template variables he gave you in the code right?
yeah i have used this,
Code:
function onSay(player, words, param)
    player:addMount(5)
    player:removeMoney(10000)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought a mount.")
    return false
end
 
Back
Top