• 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 seller. sell mount for coins

Zaweq

New Member
Joined
Apr 1, 2017
Messages
12
Reaction score
0
Can anyone help me change this script Mount Seller sold Mount for Coins not for gold
COINS ID: 37606

Thanks!


Code:
local table = {
  ["Azudocus"] = {price = 0, id = 44},
  ["Blazebringer"] = {price = 0, id = 9},
  ["Antelope"] = {price = 0, id = 163},
  ["Glooth Glider"] = {price = 0, id = 71},
  ["Prismatic unicorn"] = {price = 0, id = 115}
}
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
   
     local t = table[msg]
     if t then
         selfSay("Do you want to pay "..t.price.." gold for "..msg.." mount?", 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 doPlayerRemoveMoney(cid, t.price) then
                     doPlayerAddMount(cid, t.id)
                     selfSay("You lost "..t.price.." gp! for mount!", cid)
                 else
                     selfSay("Sorry, you do not have enough money!", 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())
 
Last edited by a moderator:

Levi999x

AoT
Joined
Dec 14, 2017
Messages
1,743
Solutions
34
Reaction score
957
Location
Germany
if doPlayerRemoveMoney(cid, t.price) then

to

if doPlayerRemoveItem(cid, t.price) then
Post automatically merged:

if doPlayerRemoveMoney(cid, t.price) then

to

if doPlayerRemoveItem(cid, t.price) then
 
OP
OP
Zaweq

Zaweq

New Member
Joined
Apr 1, 2017
Messages
12
Reaction score
0
yes

if doPlayerRemoveMoney(cid, t.price) then

to

if player:removeItem(37606, t.price) then
dont working me friend....
Post automatically merged:

Lua:
local table = {
  ["Azudocus"] = {price = 5, id = 44},
  ["Blazebringer"] = {price = 0, id = 9},
  ["Antelope"] = {price = 0, id = 163},
  ["Glooth Glider"] = {price = 0, id = 71},
  ["Prismatic unicorn"] = {price = 0, id = 115}
}


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
  
     local t = table[msg]
     if t then
         selfSay("Do you want to pay "..t.price.." for "..msg.." mount?", 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 player:removeItem(37606, t.price) then
                     doPlayerAddMount(cid, t.id)
                     selfSay("You lost "..t.price.." gp! for mount!", cid)
                 else
                     selfSay("Sorry, you do not have enough money!", 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())
 
Top