NPC Bankier 7.6 XML

Dawcio92

New Member
Joined
Sep 9, 2019
Messages
8
Best answers
0
Reaction score
0
Do not request scripts etc., in Support board. We have a specific board for that (Requests). Moved the thread accordingly.
Hello, I am looking for NPC Bankier for YurOTS 0.9.4f XML.
 

M0ustafa

Î Àm ŁĕğẹňĎ
Support Team
Joined
Mar 4, 2017
Messages
889
Best answers
94
Reaction score
318
Location
Egypt
This is an old bank script from Eldin world XML not sure if it will work for you or not try it.
Lua:
local focus = 0
-- [Banking crap]
local newValue = 0
local where = 0
local depositCheck = 0
local depositAmount = 0
local withdrawl = 0
local withdrawAmount = 0
-- [/Banking crap]
local talkcount = 0  -- Keep track of what we said last time --
local talk_start = 0
local tempcount = 0
local queue = {}
local npcmap = {}
function onThingMove(creature, thing, oldpos, oldstackpos)
end
 
function onCreatureAppear(creature)
end

function onCreatureDisappear(id)
   if id == focus then
      focus = 0
      where = 0
      newValue = 0
   depositCheck = 0
   depositAmount = 0
   withdrawl = 0
   withdrawAmount = 0
      talk_start = 0
      talkcount = 0
      selfSay('Next please')
      if not(queue[1] == nil) then
          greetNextCostumer(queue)
      end
   end
end

function clearCrap()
   where = 0
      newValue = 0
   depositCheck = 0
   withdrawl = 0
   withdrawAmount = 0
   depositAmount = 0
end

function onCreatureTurn(creature)
end
 
function onCreatureSay(cid, type, msg)
 
--- local dist = getDistanceToCreature(focus)
 
 msg = string.lower(msg)
    if ((string.find(msg, '(%a*)hi(%a*)') and string.len(msg) == 2) or (string.find(msg, '(%a*)hello(%a*)') and string.len(msg) == 5) or (string.find(msg, '(%a*)hey(%a*)') and string.len(msg) == 3)) and getDistanceToCreature(cid) < 3 then
      if focus == cid then
         selfSay('I am already talking to you.')
         talk_start = os.clock()
      elseif focus > 0 or not(queue[1] == nil) then
         selfSay('Please, ' .. creatureGetName(cid) .. '. Wait for your turn!.')
         if not isInQueue(cid, queue) then
             addToQueue(cid, queue)
         end
      elseif(focus == 0) and (queue[1] == nil) then
         selfSay('Hello, ' .. creatureGetName(cid) .. ', Well come to the local bank, what do you want to do? here you can access your bank account saying (deposit, withdraw, balance).')
         focus = cid
         talk_start = os.clock()
      end
      return
   end
   if (string.find(msg, '(%a*)bye(%a*)') or string.find(msg, '(%a*)farewell(%a*)')) and cid == focus then
      selfSay('Farewell, ' .. creatureGetName(cid) .. '!')
      focus = 0
      talk_start = 0
      talkcount = 0
      newValue = 0
      where = 0
   depositCheck = 0
   depositAmount = 0
   withdrawl = 0
   withdrawAmount = 0
      if not(queue[1] == nil) then
         clearCrap()
          greetNextCostumer(queue)
      end
      return
   end
 
   -- Get the bank balance
   if (string.find(msg, '(%a*)balance(%a*)') and cid == focus) then
     if (getPlayerStorageValue(cid, 1118) < 0) then
      clearCrap()
      selfSay('Sorry, you do not have a bank account yet! Would you like to create one?')
      where = 1
      talk_start = os.clock()
     else
      selfSay(creatureGetName(cid) .. ', your balance is currently at ' .. getPlayerStorageValue(cid, 1118) .. ' gold coins.')
      clearCrap()
      talk_start = os.clock()
     end
   end
 
   -- Simple "yes" handler
   if ((string.find(msg, '(%a*)yes(%a*)') or string.find(msg, '(%a*)yea(%a*)') or string.find(msg, '(%a*)ya(%a*)') or string.find(msg, '(%a*)yep(%a*)')) and cid == focus) then
     if where == 1 then     -- Create bank account
      setPlayerStorageValue(cid, 1118, 0)
      selfSay('Ok! Your bank account is ready to use, what do you wish to do?')
      clearCrap()
      talk_start = os.clock()
     end
     if withdrawl == 2 then    -- Withdrawl
      if(getPlayerStorageValue(cid, 1118) < withdrawAmount) and (cid == focus) then
       selfSay('Sorry, you cannot withdraw more gold than your account has in it.')
       clearCrap()
       talk_start = os.clock()
      else
       newValue = (getPlayerStorageValue(cid, 1118) - withdrawAmount)
       setPlayerStorageValue(cid, 1118, newValue)
       doPlayerAddMoney(cid, withdrawAmount)
       selfSay('Ok! Here is your money, now be on your way.')
       clearCrap()
       talk_start = os.clock()
      end
     end
     if depositCheck == 2 then
      if(doPlayerRemoveMoney(cid, depositAmount) == TRUE) and (cid == focus) then
        newValue = (getPlayerStorageValue(cid, 1118) + depositAmount)
        setPlayerStorageValue(cid, 1118, newValue)
        selfSay('Success! Your new balance is at ' .. newValue .. ' gold coins.')
        talk_start = os.clock()
        clearCrap()
       else
        selfSay('Sorry, you do not have that much gold.')
        clearCrap()
        talk_start = os.clock()
      end
     end
   end
 
   -- Simple "no" handler
   if ((string.find(msg, '(%a*)no(%a*)') or string.find(msg, '(%a*)nao(%a*)') or string.find(msg, '(%a*)nope(%a*)') or string.find(msg, '(%a*)na(%a*)')) and cid == focus) then
     if where > 0 or withdrawl > 0 or depositCheck > 0 or withdrawAmount > 0 then
      selfSay('Sorry to hear that..')
      clearCrap()
      talk_start = os.clock()
     end
   end
 
   -- Deposit gold into the bank account
   if ((string.find(msg, '(%a*)deposit(%a*)')) and cid == focus) then
     if (getPlayerStorageValue(cid, 1118) < 0) then
      clearCrap()
      selfSay('Sorry, you do not have a bank account yet! Would you like to create one?')
      where = 1
      talk_start = os.clock()
     else
      clearCrap()
      depositCheck = 1
      talk_start = os.clock()
     end
   end
 
 
   -- Withdraw money from the bank
   if ((string.find(msg, '(%a*)withdraw(%a*)')) and cid == focus) then
     if (getPlayerStorageValue(cid, 1118) < 0) then
      clearCrap()
      selfSay('Sorry, you do not have a bank account yet! Would you like to create one?')
      where = 1
      talk_start = os.clock()
     else
      clearCrap()
      withdrawl = 1
      talk_start = os.clock()
     end
   end
 
    -- Deposit money into bank
   if depositCheck == 1 and getCount(msg) ~= -1 then
     if(getCount(msg) > 0) and (cid == focus) then
      depositAmount = getCount(msg)
      depositCheck = 2
      selfSay('Are you sure you wish to deposit ' .. getCount(msg) .. ' gold coins?')
      talk_start = os.clock()
     else
      clearCrap()
      selfSay('I guess not then')
      talk_start = os.clock()
     end
   end
 
   -- Withdraw money from bank
   if withdrawl == 1 and getCount(msg) ~= -1 then
     if(getCount(msg) > 0) and (cid == focus) then
      withdrawAmount = getCount(msg)
      withdrawl = 2
      selfSay('Are you sure you wish to withdraw ' .. getCount(msg) .. ' gold coins?')
      talk_start = os.clock()
     else
      clearCrap()
      selfSay('I guess not then')
      talk_start = os.clock()
     end
   end
 
   if(cid == focus and talkcount ~= 0) then
       clearCrap()
       selfSay('I guess not then.')
       talkcount = 0
       return
   end
 
end
 
function onCreatureChangeOutfit(creature)
end
 
function onThink()
   if (os.clock() - talk_start) > 25 then
      if focus > 0 then
         selfSay('Next please!')
         talkcount = 0
      end
      focus = 0
      talk_start = 0
      talkcount = 0
      newValue = 0
      where = 0
   depositCheck = 0
   depositAmount = 0
   withdrawl = 0
   withdrawAmount = 0
      if not(queue[1] == nil) then
         clearCrap()
          greetNextCostumer(queue)
      end
   end
 
---   local dist = getDistanceToCreature(focus)
   if dist == 0 then
      selfSay('Next please!')
      focus = 0
      talk_start = 0
      talkcount = 0
      count = 0
      where = 0
      newValue = 0
   depositCheck = 0
   depositAmount = 0
   withdrawl = 0
   withdrawAmount = 0
      talkcount = 0
      if not(queue[1] == nil) then
          greetNextCostumer(queue)
      end
   end
 
   if focus == 0 then
      --walk(5) -- If you have another function for NPC walking, put it here instead of the walk(5) one
   end

     if focus ~= 0 then
         if getDistanceToCreature(focus) > 2 then
             selfSay('Good bye then.')
             focus = 0
      talk_start = 0
      talkcount = 0
      count = 0
      where = 0
      newValue = 0
   depositCheck = 0
   depositAmount = 0
   withdrawl = 0
   withdrawAmount = 0
      talkcount = 0
               end
     end


end
XML:
<?xml version="1.0"?>
<npc name="Banker" script="data/npc/scripts/Bank.lua" access="1">
 <health now="100" max="100"/>
 <look type="35" head="20" body="30" legs="40" feet="50" corpse="2131"/>
</npc>
 
OP
D

Dawcio92

New Member
Joined
Sep 9, 2019
Messages
8
Best answers
0
Reaction score
0
Ajaj, not this NPC, my bad ;P
Do you have any npc that change gp to platinum, platinum to cc?
 
Top