Forum o OTS i Tibii
Witam, Oto Skrypt NPC Bankier Do Napisany Przez GM DemoN czyli mnie nie Życzę sobie Kopii tego skryptu, na tym forum !
OK to Zaczynamy, NPC Wygląda Jak CM aby to zmienić w funkcji zamiast Linijki :
<look type="75" head="24" body="77" legs="10" feet="20"/>
Wpisz tą :
<look type="128" head="24" body="77" legs="10" feet="20"/>
W Folderze npc np.: OTS/Data/npc
utwórz plik Bankier.xml (plik xml ale nazwa nie może zawierać tej końcówki .xml)
Skopiuj to \/ i wklej do pliku Bankier.xml
<?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 \/
-- 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())
Offline