|
- Tibia | OpenTibiaServer http://www.tibia12.pun.pl/index.php - Skrypty http://www.tibia12.pun.pl/viewforum.php?id=17 - [8.0][NPC] Bankier Do Evolutions !!! http://www.tibia12.pun.pl/viewtopic.php?id=23 |
| DemoN - 2008-03-05 11:33:48 |
Witam, Oto Skrypt NPC Bankier Do Napisany Przez GM DemoN czyli mnie nie Życzę sobie Kopii tego skryptu, na tym forum ! Kod:<look type="75" head="24" body="77" legs="10" feet="20"/> Wpisz tą : Kod:<look type="128" head="24" body="77" legs="10" feet="20"/> W Folderze npc np.: OTS/Data/npc Kod:<?xml version="1.0"?> <npc name="Bankier" script="data/npc/scripts/bank.lua" access="3"> <look type="75" head="24" body="77" legs="10" feet="20"/> </npc> potem w data\npc\scripts zrób plik bank.lua Wpisują do niego to \/ Kod:-- RL Tibia Bank System by GM DemoN
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
local stan = 0
local stan_two = 0
local player_pattern = '^[a-zA-Z0-9 -]+$'
local number_pattern = '%d'
local target_cid = 0
local number_pattern_two = '%d+'
local b, e = 0
local count = 0
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
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if getPlayerStorageValue(cid,8996) <= 0 then
setPlayerStorageValue(cid,8996,0)
end
if msgcontains(msg, 'deposit') or msgcontains(msg, 'wplac') then
if string.find(msg, number_pattern) then
b, e = string.find(msg, number_pattern_two)
count = tonumber(string.sub(msg, b, e))
if pay(cid,count) then
stan = getPlayerStorageValue(cid,8996) + count
setPlayerStorageValue(cid,8996,stan)
doPlayerRemoveMoney(cid,count)
selfSay('Money was deposited!')
talk_state = 0
else
selfSay('You dont have anought money!')
talk_state = 0
end
else
selfSay('How much money you want deposit?')
talk_state = 1
end
elseif msgcontains(msg, 'withdraw') or msgcontains(msg, 'wyplac') then
if string.find(msg, number_pattern) then
b, e = string.find(msg, number_pattern_two)
count = tonumber(string.sub(msg, b, e))
if getPlayerStorageValue(cid,8996) - count >= 0 then
stan = getPlayerStorageValue(cid,8996) - count
setPlayerStorageValue(cid,8996,stan)
doPlayerAddMoney(cid,count)
selfSay('Money was withdrawed!')
talk_state = 0
else
selfSay('You do not have anought money on account!')
talk_state = 0
end
else
selfSay('How much money you want withdraw?')
talk_state = 2
end
elseif msgcontains(msg, 'transfer') or msgcontains(msg, 'transferuj') then
selfSay('Want you for who transfer money?')
talk_state = 3
elseif msgcontains(msg, 'balance') or msgcontains(msg, 'stan') then
selfSay('Your account balance is ' .. getPlayerStorageValue(cid,8996) .. ' gp.')
talk_state = 4
elseif talk_state == 1 then
if string.find(msg, number_pattern) then
if pay(cid,msg) then
stan = getPlayerStorageValue(cid,8996) + msg
setPlayerStorageValue(cid,8996,stan)
doPlayerRemoveMoney(cid,msg)
selfSay('Money was deposited!')
talk_state = 0
else
selfSay('You dont have anought money!')
talk_state = 0
end
else
selfSay('There is not number!')
talk_state = 0
end
elseif talk_state == 2 then
stan = getPlayerStorageValue(cid,8996)
if string.find(msg, number_pattern) then
if getPlayerStorageValue(cid,8996) - msg >= 0 then
stan = getPlayerStorageValue(cid,8996) - msg
setPlayerStorageValue(cid,8996,stan)
doPlayerAddMoney(cid,msg)
selfSay('Money was withdrawed!')
talk_state = 0
else
selfSay('You do not have anought money on account!')
talk_state = 0
end
else
selfSay('There is not number!')
talk_state = 0
end
elseif talk_state == 3 then
if string.find(msg, player_pattern) then
target_cid = getPlayerByName(msg)
if isPlayer(target_cid) == 1 then
talk_state = 4
selfSay('How much i must transfer?')
else
talk_state = 0
selfSay('Player is not online or this player dont exists.Player must be online to transfer money on his account.')
end
else
selfSay('It isnt nick!')
talk_state = 0
end
elseif talk_state == 4 then
stan = getPlayerStorageValue(cid,8996)
if string.find(msg, number_pattern) then
if stan - msg >= 0 then
stan_two = getPlayerStorageValue(target_cid,8996) + msg
stan = getPlayerStorageValue(cid,8996) - msg
setPlayerStorageValue(target_cid,8996,stan_two)
setPlayerStorageValue(cid,8996,stan)
doPlayerRemoveMoney(cid,msg)
talk_state = 0
selfSay('Money transfered.')
else
selfSay('You do not have anought money on account!')
talk_state = 0
end
else
selfSay('There is not number!')
talk_state = 0
end
elseif talk_state == 5 then
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) |
| Azkob The Legend - 2008-05-04 09:02:48 |
wielkie thx przyda sie kumplowi ?:D |