• 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 Mount script bug

Nokturno

Not a human
Joined
Aug 7, 2009
Messages
570
Solutions
2
Reaction score
403
Hello people i edit a script adding some new mounts (8.7) TFS 0.2.9

And all continued working , but Now Npc dont remove Money from it



Code:
local table = {
    ["widow queen"] = {price = 330000, id = 1},
    ["racing bird"] = {price = 250000, id = 2},
    ["war bear"] = {price = 600000, id = 3},
    ["black sheep"] = {price = 10000, id = 4},
    ["midnight panther"] = {price = 250000, id = 5},
    ["draptor"] = {price = 500000, id = 6},
    ["titanica"] = {price = 550000, id = 7},
    ["tin lizzard"] = {price = 300000, id = 8},
    ["blazebringer"] = {price = 500000, id = 9},
    ["rapid boar"] = {price = 50000, id = 10},
    ["stampor"] = {price = 400000, id = 11},
    ["undead cavebear"] = {price = 600000, id = 12},
["panda"] = {price = 100000, id = 14},
["pig"] = {price = 50000, id = 15},
["kongra"] = {price = 400000, id = 16},
["terror bird"] = {price = 150000, id = 17},
["wolf"] = {price = 120000, id = 18},
["hyaena"] = {price = 180000, id = 19},
["lion"] = {price = 150000, id = 20},
["tiger"] = {price = 150000, id = 21},
["winter wolf"] = {price = 150000, id = 22},
["tarantula"] = {price = 130000, id = 23},
["hand of cursed fate"] = {price = 400000, id = 24},
["hellspawn"] = {price = 400000, id = 25},
["mutated rat"] = {price = 400000, id = 26},
["nightmare"] = {price = 350000, id = 27},
["toad"] = {price = 200000, id = 28},
["bonebeast"] = {price = 230000, id = 29},
["young sea serpent"] = {price = 400000, id = 30},
["butterfly demon"] = {price = 400000, id = 31},
["snake god essence"] = {price = 400000, id = 32},
["lancer beetle"] = {price = 380000, id = 33},
["orc warlord"] = {price = 400000, id = 34},
["dragon hatchling"] = {price = 400000, id = 13}

}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                  npcHandler:onThink()                    end

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
     if table[msg] then
      local t = table[msg]
      talkState[talkUser] = 1
       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

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I hope u can help with this
 
If u wish to know how, please make a new thread or Simply pm him
Moderator's, with the acceptance of the Creator of the thread,
Please close it!
thanks =)
 
Back
Top