• 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 Mounts Seller

Change the doPlayerRemoveMoney line to
Code:
if doPlayerRemoveItem(cid, t.item[1], t.item[2]) then
Then instead of "price = 0" in the table.
Code:
item = {5879, 50}
For the message, instead of "selfSay("Sorry, you do not have enough money!", cid)"
Code:
selfSay("Sorry, you do not have "..t.item[2].." "..getItemInfo(t.item[1]).name.."!", cid)
 
I changed it to what you said and i keep getting this error:

[07/01/2015 09:22:48] Lua Script Error: [Npc interface]
[07/01/2015 09:22:48] data/npc/scripts/mountseller.lua:eek:nCreatureSay
[07/01/2015 09:22:48] data/npc/scripts/mountseller.lua:55: attempt to call global 'getItemInfo' (a nil value)
[07/01/2015 09:22:48] stack traceback:
[07/01/2015 09:22:48] [C]: in function 'getItemInfo'
[07/01/2015 09:22:48] data/npc/scripts/mountseller.lua:55: in function 'callback'
[07/01/2015 09:22:48] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[07/01/2015 09:22:48] data/npc/scripts/mountseller.lua:36: in function <data/npc/scripts/mountseller.lua:36>
 
Change getItemInfo to getItemDescriptions or add this in global.lua.
Code:
getItemInfo = getItemDescriptions
 
now i have this:

[07/01/2015 09:53:21] Lua Script Error: [Npc interface]
[07/01/2015 09:53:21] data/npc/scripts/mountseller.lua:eek:nCreatureSay
[07/01/2015 09:53:21] data/npc/scripts/mountseller.lua:50: attempt to index field 'item' (a number value)
[07/01/2015 09:53:21] stack traceback:
[07/01/2015 09:53:21] [C]: in function '__index'
[07/01/2015 09:53:21] data/npc/scripts/mountseller.lua:50: in function 'callback'
[07/01/2015 09:53:21] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[07/01/2015 09:53:21] data/npc/scripts/mountseller.lua:36: in function <data/npc/scripts/mountseller.lua:36>
 
I used the format you told me to, I haven't gotten around to personalizing each mount to a specific item yet though.

Code:
local table = {
    ["Widow Queen"] = {item = 5879, 50},
    ["racing bird"] = {item = 5879, 50},
    ["war bear"] = {item = 5879, 50},
    ["black sheep"] = {item = 5879, 50},
    ["midnight panther"] = {item = 5879, 50},
    ["draptor"] = {item = 5879, 50},
    ["titanica"] = {item = 5879, 50},
    ["tin lizzard"] = {item = 5879, 50},
    ["blazebringer"] = {item = 5879, 50},
    ["rapid boar"] = {item = 5879, 50},
    ["stampor"] = {item = 5879, 50},
    ["undead cavebear"] = {item = 5879, 50},
    ["mule"] = {item = 5879, 50},
    ["tiger slug"] = {item = 5879, 50},
    ["uniwheel"] = {item = 5879, 50},
    ["crystal wolf"] = {item = 5879, 50},
    ["war horse"] = {item = 5879, 50},
    ["kingly deer"] = {item = 5879, 50},
    ["tamed panda"] = {item = 5879, 50},
    ["dramedary"] = {item = 5879, 50},
    ["sandstone scorion"] = {item = 5879, 50},
    ["rented horse 1"] = {item = 5879, 50},
    ["fire war horse"] = {item = 5879, 50},
    ["shadow draptor"] = {item = 5879, 50},
    ["rented horse 2"] = {item = 5879, 50},
    ["rented horse 3"] = {item = 5879, 50},
}
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 doPlayerRemoveItem(cid, t.item[1], t.item[2]) then 
          doPlayerAddMount(cid, t.id)
          selfSay("You lost "..t.item.." for mount!", cid)
          talkState[talkUser] = 0
         else
          selfSay("Sorry, you do not have "..t.item[2].." "..getItemDescriptions(t.item[1]).name.."!", 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())
 
[07/01/2015 10:55:48] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/mountseller.lua
[07/01/2015 10:55:48] data/npc/scripts/mountseller.lua:2: '}' expected (to close '{' at line 1) near '='
 
Post the script, make sure you have a comma after every line (except from the last one) in the table.
 
Code:
local table = {
    ["Widow Queen"] = item = {5879, 50},
    ["racing bird"] = item = {5879, 50},
    ["war bear"] = item = {5879, 50},
    ["black sheep"] = item = {5879, 50},
    ["midnight panther"] = item = {5879, 50},
    ["draptor"] = item = {5879, 50},
    ["titanica"] = item = {5879, 50},
    ["tin lizzard"] = item = {5879, 50},
    ["blazebringer"] = item = {5879, 50},
    ["rapid boar"] = item = {5879, 50},
    ["stampor"] = item = {5879, 50},
    ["undead cavebear"] = item = {5879, 50},
    ["mule"] = item = {5879, 50},
    ["tiger slug"] = item = {5879, 50},
    ["uniwheel"] = item = {5879, 50},
    ["crystal wolf"] = item = {5879, 50},
    ["war horse"] = item = {5879, 50},
    ["kingly deer"] = item = {5879, 50},
    ["tamed panda"] = item = {5879, 50},
    ["dramedary"] = item = {5879, 50},
    ["sandstone scorion"] = item = {5879, 50},
    ["rented horse 1"] = item = {5879, 50},
    ["fire war horse"] = item = {5879, 50},
    ["shadow draptor"] = item = {5879, 50},
    ["rented horse 2"] = item = {5879, 50},
    ["rented horse 3"] = item = {5879, 50}
}
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 doPlayerRemoveItem(cid, t.item[1], t.item[2]) then 
          doPlayerAddMount(cid, t.id)
          selfSay("You lost "..t.item.." for mount!", cid)
          talkState[talkUser] = 0
         else
          selfSay("Sorry, you do not have "..t.item[2].." "..getItemDescriptions(t.item[1]).name.."!", 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())
 
Like this
Code:
["Widow Queen"] = {item = {5879, 50}},
I assume it should still have the id, so add that back.
 
This is what i have now.
Code:
local table = {
    ["Widow Queen"] = {item = {5879, 50, id = 1}},
    ["racing bird"] = {item = {5879, 50, id = 2}},
    ["war bear"] = {item = {5879, 50, id = 3}},
    ["black sheep"] = {item = {5879, 50, id = 4}},
    ["midnight panther"] = {item = {5879, 50, id = 5}},
    ["draptor"] = {item = {5879, 50, id = 6}},
    ["titanica"] = {item = {5879, 50, id = 7}},
    ["tin lizzard"] = {item = {5879, 50, id = 8}},
    ["blazebringer"] = {item = {5879, 50, id = 9}},
    ["rapid boar"] = {item = {5879, 50, id = 10}},
    ["stampor"] = {item = {5879, 50, id = 11}},
    ["undead cavebear"] = {item = {5879, 50, id = 12}},
    ["mule"] = {item = {5879, 50, id = 13}},
    ["tiger slug"] = {item = {5879, 50, id = 14}},
    ["uniwheel"] = {item = {5879, 50, id = 15}},
    ["crystal wolf"] = {item = {5879, 50, id = 16}},
    ["war horse"] = {item = {5879, 50, id = 17}},
    ["kingly deer"] = {item = {5879, 50, id = 18}},
    ["tamed panda"] = {item = {5879, 50, id = 19}},
    ["dramedary"] = {item = {5879, 50, id = 20}},
    ["sandstone scorion"] = {item = {5879, 50, id = 21}},
    ["rented horse 1"] = {item = {5879, 50, id = 22}},
    ["fire war horse"] = {item = {5879, 50, id = 23}},
    ["shadow draptor"] = {item = {5879, 50, id = 24}},
    ["rented horse 2"] = {item = {5879, 50, id = 25}},
    ["rented horse 3"] = {item = {5879, 50, 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 doPlayerRemoveItem(cid, t.item[1], t.item[2]) then 
          doPlayerAddMount(cid, t.id)
          selfSay("You lost "..t.item.." for mount!", cid)
          talkState[talkUser] = 0
         else
          selfSay("Sorry, you do not have "..t.item[2].." "..getItemDescriptions(t.item[1]).name.."!", 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())

and im still getting this error:

Code:
[07/01/2015 13:26:44] Lua Script Error: [Npc interface]
[07/01/2015 13:26:44] data/npc/scripts/mountseller.lua:onCreatureSay
[07/01/2015 13:26:44] LuaScriptInterface::luaGetPlayerMount(). There is no mount with the specified id.
[07/01/2015 13:26:44] stack traceback:
[07/01/2015 13:26:44]     [C]: in function 'getPlayerMount'
[07/01/2015 13:26:44]     data/npc/scripts/mountseller.lua:49: in function 'callback'
[07/01/2015 13:26:44]     data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[07/01/2015 13:26:44]     data/npc/scripts/mountseller.lua:36: in function <data/npc/scripts/mountseller.lua:36>
 
any way to make mount "War Bear" = 100cc and 100 bear paws?
(money + item to gain the mount)

i tried this line but it only take the money.
["War Bear"] = {price = 1000000, item = {5896, 100}, id = 3},
 
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/mount.lua:onCreatureSay
data/npc/scripts/mount.lua:34: attempt to call global 'getPlayerPremiumDays' (a nil value)
stack traceback:
        [C]: in function 'getPlayerPremiumDays'
        data/npc/scripts/mount.lua:34: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:411: in function 'onCreatureSay'
        data/npc/scripts/mount.lua:22: in function <data/npc/scripts/mount.lua:22>
 
Mh.. My players have free premium but the seller wants them to have premium.. x.x
How can I make them avaiable for them? :)
 
Back
Top