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

NPC Mount NPC w/mounts and lua script

I don't know how to fix it.
Can anyone help me, that knows how to fix it?

___________________________

Code:
[01/05/2012 21:49:24] [Error - LuaScriptInterface::loadFile] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['
[01/05/2012 21:49:24] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/mountseller.lua
[01/05/2012 21:49:24] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['

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} 
    ["Mule"] = {price = 0, id = 13}
    ["Tiger Slug"] = {price = 0, id = 14}
    ["Uniwheel"] = {price = 0, id = 15}
    ["Crystal Wolf"] = {price = 0, id = 16}
    ["War Horse"] = {price = 0, id = 17}
    ["Kingly Deer"] = {price = 0, id = 18}
    ["Tamed Panda"] = {price = 0, id = 19}
    ["Dramedary"] = {price = 0, id = 20}
    ["Sandstone Scorion"] = {price = 0, id = 21}
    ["Rented Horse 1"] = {price = 0, id = 22}
    ["Fire War Horse"] = {price = 0, id = 23}
    ["Shadow Draptor"] = {price = 0, id = 24}
    ["Rented Horse 2"] = {price = 0, id = 25}
    ["Rented Horse 3"] = {price = 0, id = 26}
} 
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())

You need to add commas at the end.
Lua:
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}, 
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
} 
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())

Edit: Didn't notice people allready posted a fix. Sorry about that.
 
Works nicely after putting the commas in. I changed the name of the mounts in mountseller.lua to all lower case letters since most people would just use lower case to type to an NPC.

Could someone update this script so that the NPC asks you if you want to buy 'x' mount for 'x' price to act like a normal NPC?

Thumbs up thanks for this script!
 
- - - Updated - - -

If anyone needs help on creating quests to recieve mounts let me know and il help you its easy if you have a lil experience with remeres and luas
i would like to know n i do have exp with both
 
How i can fix the script please... Post the script fixed please i need so much. Thanks.
 
Hi! Could you write that in the script to change the npc to fetch items, instead of money? I haven't any idea...
 
Im not any good at writing/editing scripts to that extent nut im sure if you use search function you mite find it or create you a thread in support! Waiting is a game we must all play? It mite not take long for someone to help yet. Then again ive seen post with no responses for months!
 
Works fine but one thing! How can I make it to ask before it actually buys the mount? Someone might want to check the price and he will misbuy it!
 
If anyone needs a vocation version of this here it is ...
Looks like total crap but what ever it works.
Code:
local table = {
  ["Widow Queen"] = {price = 1000000, id = 1, vocation = 1},
  ["Racing Bird"] = {price = 1000000, id = 2, vocation = 2},
  ["War Bear"] = {price = 1000000, id = 3, vocation = 3},
  ["Black Sheep"] = {price = 1000000, id = 4, vocation = 4}
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)  npcHandler:eek:nCreatureAppear(cid)  end
function onCreatureDisappear(cid)  npcHandler:eek:nCreatureDisappear(cid)  end
function onCreatureSay(cid, type, msg)  npcHandler:eek:nCreatureSay(cid, type, msg)  end
function onThink()  npcHandler:eek:nThink()  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
 
     local t = table[msg]
     if t then
         selfSay("Are you sure? [Cost:"..t.price.."] Gold for "..msg.."?", cid)
         talkState[talkUser] = 1
         xmsg = msg
     elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
         t = table[xmsg]
         if getPlayerPremiumDays(cid) >= 1 then
             if not getPlayerMount(cid, t.id) then
            if getPlayerVocation(cid) == t.vocation then
                 if doPlayerRemoveMoney(cid, t.price) then
                     doPlayerAddMount(cid, t.id)
                     selfSay("You just paid "..t.price.." Gold for "..msg..".", cid)
                 else
                     selfSay("Sorry, you do not have enough money!", cid)
                 end
                elseif t.vocation == 1 then
                     selfSay("Sorry this mount is for sorcerer's only.", cid)
                elseif t.vocation == 2 then
                     selfSay("Sorry this mount is for Druid's only.", cid)
                elseif t.vocation == 3 then
                     selfSay("Sorry this mount is for Paladin's only.", cid)
                elseif t.vocation == 4 then
                     selfSay("Sorry this mount is for Knight's only.", cid)
                 end
             else
                 selfSay("You already have this mount!", cid)
             end
         else
             selfSay("You must be Premium!", cid)
        end
         talkState[talkUser] = 0
     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 am having some troubles with mine its saying Correct Name of Mount but i did say the right one and it aint let giving me them either




Hello Guys done some searching and figured that i would add what i was looking for all in one place!


goto mounts.xml and add
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mounts>
    <mount id="1" clientid="368" name="Widow Queen" speed="20" premium="yes" />
    <mount id="2" clientid="369" name="Racing Bird" speed="20" premium="yes" />
    <mount id="3" clientid="370" name="War Bear" speed="20" premium="yes" />
    <mount id="4" clientid="371" name="Black Sheep" speed="20" premium="yes" />
    <mount id="5" clientid="372" name="Midnight Panther" speed="20" premium="yes" />
    <mount id="6" clientid="373" name="Draptor" speed="20" premium="yes" />
    <mount id="7" clientid="374" name="Titanica" speed="20" premium="yes" />
    <mount id="8" clientid="375" name="Tin Lizzard" speed="20" premium="yes" />
    <mount id="9" clientid="376" name="Blazebringer" speed="20" premium="yes" />
    <mount id="10" clientid="377" name="Rapid Boar" speed="20" premium="yes" />
    <mount id="11" clientid="378" name="Stampor" speed="20" premium="yes" />
    <mount id="12" clientid="379" name="Undead Cavebear" speed="20" premium="yes" />
    <mount id="13" clientid="387" name="Mule" speed="20" premium="yes" />
    <mount id="14" clientid="388" name="Tiger Slug" speed="20" premium="yes" />
    <mount id="15" clientid="389" name="Uniwheel" speed="20" premium="yes" />
    <mount id="16" clientid="390" name="Crystal Wolf" speed="20" premium="yes" />
    <mount id="17" clientid="392" name="War Horse" speed="20" premium="yes" />
    <mount id="18" clientid="401" name="Kingly Deer" speed="20" premium="yes" />
    <mount id="19" clientid="402" name="Tamed Panda" speed="20" premium="yes" />
    <mount id="20" clientid="405" name="Dromedary" speed="20" premium="yes" />
    <mount id="21" clientid="406" name="Sandstone Scorpion" speed="20" premium="yes" />
    <mount id="22" clientid="421" name="Rented Horse" speed="20" premium="yes" />
    <mount id="23" clientid="426" name="Fire War Horse" speed="20" premium="yes" />
    <mount id="24" clientid="427" name="Shadow Draptor" speed="20" premium="yes" />
    <mount id="25" clientid="437" name="Rented Horse" speed="20" premium="yes" />
    <mount id="26" clientid="438" name="Rented Horse" speed="20" premium="yes" />
</mounts>

create an npc xml and insert it into data/npcs name it as mountseller.xml


Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mount Seller" script="mountseller.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="128" head="17" body="54" legs="114" feet="0" addons="2" mount="379"/>
    <parameters>
        <parameter key="message_greet" value="Welcome |PLAYERNAME|! I selling mounts: {Widow Queen}, {Racing Bird}, {War Bear}, {Black Sheep}, {Midnight Panther}, {Draptor}, {Titanica}, {Tin Lizzard}, {Blazebringer}, {Rapid Boar}, {Stampor}, {Undead Cavebear}, {Mule}, {Tiger Slug}, {Uniwheel}, {Crystal Wolf}, {War Horse}, {Kingly Deer}, {Tamed Panda}, {Dramedary}, {Sandstone Scorpion}, {Rented Horse 1}, {Fire War Horse}, {Shadow Draptor}, {Rented Horse 2}, {Rented Horse 3}}."/>
    </parameters>
</npc>



now goto data/npc/scripts and add create this file mountseller.lua

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},
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
}
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())

tested in 9.44 as of now and worked just didnt fell like adding newer mounts into script easy to do yourself though if i done everthing for you how would you learn anything
 
im getting error with it im on 9.44 also
14:27 Mount Seller: Welcome Admin Split! I selling mounts: Widow Queen, Racing Bird, War Bear, Black Sheep, Midnight Panther, Draptor, Titanica, Tin Lizzard, Blazebringer, Rapid Boar, Stampor, Undead Cavebear, Mule, Tiger Slug, Uniwheel, Crystal Wolf, War Horse, Kingly Deer, Tamed Panda, Dramedary, Sandstone Scorpion, Rented Horse 1, Fire War Horse, Shadow Draptor, Rented Horse 2, Rented Horse 3.
14:28 Admin Split [50]: rented horse
14:28 Mount Seller: What? Please told me a correct name of mount!
14:28 Admin Split [50]: rented horse 1
14:28 Mount Seller: What? Please told me a correct name of mount!
14:28 Admin Split [50]: Tiger Slug
14:28 Mount Seller: You must be Premium!
14:28 Admin Split [50]: yes
14:28 Mount Seller: What? Please told me a correct name of mount!
14:28 Admin Split [50]: Tiger Slug
14:28 Mount Seller: You lost 0 gp! for mount!
14:28 Admin Split [50]: yes
14:28 Mount Seller: What? Please told me a correct name of mount!



Hello Guys done some searching and figured that i would add what i was looking for all in one place!


goto mounts.xml and add
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mounts>
    <mount id="1" clientid="368" name="Widow Queen" speed="20" premium="yes" />
    <mount id="2" clientid="369" name="Racing Bird" speed="20" premium="yes" />
    <mount id="3" clientid="370" name="War Bear" speed="20" premium="yes" />
    <mount id="4" clientid="371" name="Black Sheep" speed="20" premium="yes" />
    <mount id="5" clientid="372" name="Midnight Panther" speed="20" premium="yes" />
    <mount id="6" clientid="373" name="Draptor" speed="20" premium="yes" />
    <mount id="7" clientid="374" name="Titanica" speed="20" premium="yes" />
    <mount id="8" clientid="375" name="Tin Lizzard" speed="20" premium="yes" />
    <mount id="9" clientid="376" name="Blazebringer" speed="20" premium="yes" />
    <mount id="10" clientid="377" name="Rapid Boar" speed="20" premium="yes" />
    <mount id="11" clientid="378" name="Stampor" speed="20" premium="yes" />
    <mount id="12" clientid="379" name="Undead Cavebear" speed="20" premium="yes" />
    <mount id="13" clientid="387" name="Mule" speed="20" premium="yes" />
    <mount id="14" clientid="388" name="Tiger Slug" speed="20" premium="yes" />
    <mount id="15" clientid="389" name="Uniwheel" speed="20" premium="yes" />
    <mount id="16" clientid="390" name="Crystal Wolf" speed="20" premium="yes" />
    <mount id="17" clientid="392" name="War Horse" speed="20" premium="yes" />
    <mount id="18" clientid="401" name="Kingly Deer" speed="20" premium="yes" />
    <mount id="19" clientid="402" name="Tamed Panda" speed="20" premium="yes" />
    <mount id="20" clientid="405" name="Dromedary" speed="20" premium="yes" />
    <mount id="21" clientid="406" name="Sandstone Scorpion" speed="20" premium="yes" />
    <mount id="22" clientid="421" name="Rented Horse" speed="20" premium="yes" />
    <mount id="23" clientid="426" name="Fire War Horse" speed="20" premium="yes" />
    <mount id="24" clientid="427" name="Shadow Draptor" speed="20" premium="yes" />
    <mount id="25" clientid="437" name="Rented Horse" speed="20" premium="yes" />
    <mount id="26" clientid="438" name="Rented Horse" speed="20" premium="yes" />
</mounts>

create an npc xml and insert it into data/npcs name it as mountseller.xml


Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mount Seller" script="mountseller.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="128" head="17" body="54" legs="114" feet="0" addons="2" mount="379"/>
    <parameters>
        <parameter key="message_greet" value="Welcome |PLAYERNAME|! I selling mounts: {Widow Queen}, {Racing Bird}, {War Bear}, {Black Sheep}, {Midnight Panther}, {Draptor}, {Titanica}, {Tin Lizzard}, {Blazebringer}, {Rapid Boar}, {Stampor}, {Undead Cavebear}, {Mule}, {Tiger Slug}, {Uniwheel}, {Crystal Wolf}, {War Horse}, {Kingly Deer}, {Tamed Panda}, {Dramedary}, {Sandstone Scorpion}, {Rented Horse 1}, {Fire War Horse}, {Shadow Draptor}, {Rented Horse 2}, {Rented Horse 3}}."/>
    </parameters>
</npc>



now goto data/npc/scripts and add create this file mountseller.lua

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},
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
}
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())

tested in 9.44 as of now and worked just didnt fell like adding newer mounts into script easy to do yourself though if i done everthing for you how would you learn anything
 
Back
Top