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

mountseller

tnecniiv

scripter to be
Joined
Jan 6, 2012
Messages
294
Solutions
3
Reaction score
23
hey guysi have this mountseller npc in my folder but i never implemented it when i do i get this error
[29/01/2014 21:25:28] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/mountseller.lua
[29/01/2014 21:25:28] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['

i was wondering if someone can take a look at this code and help me =D
im using 0.2.14 tfs
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())

the npc file


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mount Seller" script="data/npc/scripts/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>
 
Last edited:
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())

Missing a few "," in the array.
 
if player:getLevel <= 85
selfSay("Not level 85!", cid)
talkState[talkUser] = 0
end

I have no idea what I'm doing as I'm on scripter, and "player:getLevel" is from TFS 1.0 I think. Let someone else who knows about this do it, not me hehe :p
 
Under
Code:
talkState[talkUser] = 1
add
Code:
if getPlayerLevel(cid) >= 85 then

and add
Code:
else
    selfSay("You need to be at least level 85.", cid)
    talkState[talkUser] = 0
end
above
Code:
    return true
end
 
[30/01/2014 18:06:54] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/mountseller.lua
[30/01/2014 18:06:54] data/npc/scripts/mountseller.lua:39: '<eof>' expected near 'end'


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 = {1}
if getPlayerLevel(cid) >= 85 then
else
selfSay("You need to be at least level 85.", cid)
talkState[talkUser] = 0
end
return true
end
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
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())
 
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 getPlayerLevel(cid) >= 85 then
            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("You need to be at least level 85.", 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())
 
yea im not worried if i get mounts or not i love my 8.6 servers but would of been good if u can have mounts in 8.6 as i have seen it done before
 
Back
Top