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

[1.1] Help with mount Item Npc

Jallen

New Member
Joined
Jul 16, 2008
Messages
1
Reaction score
0
Hello. I need some help with my mount NPC, The npc takes the items, but I do not recive the mount. And the NPC takes the items even if i already have the mount.

It worked when I used money instead of items.

I would really appreciate some help.

My code in mount_seller.lua:

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())
 
Back
Top