this is the error
and this is the script im trying to get to work
Code:
[20/09/2010 15:18:49] [Error - TalkAction Interface]
[20/09/2010 15:18:49] data/talkactions/scripts/bank.lua:onSay
[20/09/2010 15:18:49] Description:
[20/09/2010 15:18:49] data/talkactions/scripts/bank.lua:22: attempt to compare number with boolean
[20/09/2010 15:18:49] stack traceback:
[20/09/2010 15:18:49] data/talkactions/scripts/bank.lua:22: in function <data/talkactions/scripts/bank.lua:7>
and this is the script im trying to get to work
Code:
---Script by mock the bear
local storeige = 18316
local function msg(cid,m)
doCreatureSay(cid,m,TALKTYPE_ORANGE_1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, m)
end
function onSay(cid, words, param, channel) ---Script by mock the bear
local c = getGuildBalance(cid,storeige)
c = c == -1 and 0 or c
if param:find('balance') or param == 'b' or (words == '!balance') then
msg(cid,'Guild balance '..c..'')
elseif param:find('amount') or param == 'a' then
local c = getGuildBalance(cid)
doCreatureSay(cid,'Guild balance '..c..' gps.',TALKTYPE_ORANGE_1)
msg(cid,'The Guild balance contains only '..c..' gps.')
elseif param:match('deposit (.+)') or param:match('d (.+)') or (words == '!deposit') then
local v = param:match('deposit (.+)') or param:match('d (.+)') or tonumber(param) or param == 'all' and param
local dep = tonumber(v == 'all' and getGuildBalance(cid) or v)
if not dep then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Insert a value')
else
if SetGuildBalance(cid) >= dep then
SetGuildStorageValue(cid,storeige,c+dep)
doPlayerRemoveMoney(cid,dep)
msg(cid,'Deposit '..dep..'.')
else
msg(cid,'The Guild balance contains only '..getGuildBalance(cid)..'.')
end
end
elseif param:match('withdraw (.+)') or param:match('w (.+)') or (words == '!withdraw') then
local v = param:match('withdraw (.+)') or param:match('w (.+)') or tonumber(param) or param == 'all' and param
local dep = tonumber(v == 'all' and c or v)
if not dep then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Insert a value')
else
if c >= dep then
SetGuildStorageValue(cid,storeige,c-dep)
doPlayerAddMoney(cid,dep)
msg(cid,'Withdraw '..dep..'.')
else
msg(cid,'The Guild balance contains only '..c..'.')
end
end
else
doPlayerSendTextMessage(cid, 25, "Use like this:\n!bank deposit x\n!bank balance\n!bank withdraw\n!bank amount(ou assim)\n!bank d x\n!bank w x\n!bank deposit all\n!bank a")
end
return TRUE
end
Last edited: