- Joined
- Aug 6, 2007
- Messages
- 1,767
- Reaction score
- 36
Hi guys,
I finally managed to get the banker finished only 1 function is missing .. ofcourse it's transfer.. anywais it fully works Deposit/Balance/Withdraw.
As you might notice when u use balance your server will give an error
or somting like that just ignored i was to lazy to fix it.. atleast balance still works
Banker.Lua
If you have some getCount(msg) problems add this in your Npc.lua:
Gimmy some rep guys first forgotten server banker releaser!
P.s)
Read this plx0r
THIS SCRIPT MAY ONLY BE RELEASED ON WWW.OTLAND.NET
I finally managed to get the banker finished only 1 function is missing .. ofcourse it's transfer.. anywais it fully works Deposit/Balance/Withdraw.
As you might notice when u use balance your server will give an error
Code:
getPlayerStorageValue()
Banker.Lua
Code:
----------------------------------------------------------Made By MokerHamer----------------------------------------------
--------------------Special Thanks to: Talaturen and Jiddo without them i coulden't have done this!------------------
------------------------------------------NOTE* THIS SCRIPT MAY ONLY BE RELEASED ON WWW.OTLAND.NET ONLY---------------------
------------------------------------This Script is specialde made for World Of Tramon V8.0-----------------------------
-----------------------------------------------------World Of Tramon Link: None Yet--------------------------------------
--------------------------------------------------------------------------------------------------------------------------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
---------Begin-Dont--Tough!--Noob--censative
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
local count = (getCount(msg))
local oldcount = getPlayerStorageValue(cid, 300)
if(oldcount == -1) then
oldcount = 0
end
---------End-Dont--Tough!--Noob--censative
---------------Begin Crap that u can change it if u want-----------------------
bank_need_premium = 'Sorry, You need premium account to use the bank.'
low_money_deposit = 'You do not have enough money in your deposit to withdraw, '..count..' Gold Pieces. '
lost_track = 'Huh, What are you talking about?'
if msgcontains(msg, 'banker') then
selfSay('Hello. How can I help you? If you need some help just say information')
elseif msgcontains(msg, 'information') then
selfSay('Hello i am the city banker, you can do many things here like, Check your balance deposit and even withdraw!')
---------------End Crap that u can change it if u want
-------------------------------------------------------------Begin of the Banker script---------------------------------------
------------------------Begin!--deposit--Crap----
elseif msgcontains(msg, 'deposit') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('How mutch would u like to deposit?')
talk_state = 1
else
selfSay(bank_need_premium)
talk_state = 0
end
---deposit--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 1 then
talk_state = 0
if doPlayerRemoveMoney(cid, count) == TRUE then
setPlayerStorageValue(cid,300, oldcount+count)
selfSay('You have successfully deposit '..count..' Gold Pieces')
else
selfSay(lost_track)
end
------------------------End!--deposit--Crap----
------------------------Begin!--Balance--Crap----
elseif msgcontains(msg, 'balance') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('do u want to check your balance?')
talk_state = 2
else
selfSay(bank_need_premium)
talk_state = 0
end
---Balance--Confurm--Yes
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,300, oldcount) then
if(oldcount == -1) then
oldcount = 0
end
selfSay('You have '..oldcount..' Gold Pieces deposit.')
else
selfSay(lost_track)
end
------------------------End!--Balance--Crap----
------------------------Begin!--withdraw--Crap----
elseif msgcontains(msg, 'withdraw') then
if getPlayerPremiumDays(cid) > 0 then
selfSay('How mutch would u like to withdraw?')
talk_state = 3
else
selfSay(bank_need_premium)
talk_state = 0
end
---withdraw--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 3 then
talk_state = 0
if count <= oldcount then
setPlayerStorageValue(cid,300, oldcount-count)
doPlayerAddMoney(cid, count)
selfSay('You have successfully withdrawed '..count..' Gold Pieces.')
else
selfSay(low_money_deposit)
end
------------------------End!--withdraw--Crap----
---No--To--All
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
selfSay('Why the fuck dit you start this conversation anywais?')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If you have some getCount(msg) problems add this in your Npc.lua:
Code:
-- Function used to match a number value from a string. the getCount Module
function getCount(msg)
local ret = -1
local b, e = string.find(msg, "%d+")
if b ~= nil and e ~= nil then
ret = tonumber(string.sub(msg, b, e))
end
return ret
end
Gimmy some rep guys first forgotten server banker releaser!
P.s)
Read this plx0r
THIS SCRIPT MAY ONLY BE RELEASED ON WWW.OTLAND.NET
Last edited by a moderator: