Hi,
Im using 0.3.6.pl1 8.5.4 gesior acc and tfs with warsystem BUT.. This warsystem probably have got errors, maybe in wars.lua?
When i wrote in game /war invite,nameguild,frags is ok
/war accept,name guild .. ok
and players have got war eblems but when i will kill player of enemy guild the eblems disapeared idk why?? After kill war is still continues but without war eblems.. What is wrong in this codes?
On page i can see only 1:0, 0:1 scores.. somethink is wrong with counter death..
data/talkactions/talkactions.xml
data/globalevents/scripts/init.lua or start.lua
data/lib/101-war.lua
data/talkactions/scripts/balance.lua
Im using 0.3.6.pl1 8.5.4 gesior acc and tfs with warsystem BUT.. This warsystem probably have got errors, maybe in wars.lua?
When i wrote in game /war invite,nameguild,frags is ok
/war accept,name guild .. ok
and players have got war eblems but when i will kill player of enemy guild the eblems disapeared idk why?? After kill war is still continues but without war eblems.. What is wrong in this codes?
On page i can see only 1:0, 0:1 scores.. somethink is wrong with counter death..
data/talkactions/talkactions.xml
Code:
<talkaction words="/war" channel="0" event="script" value="war.lua" desc="(Guild channel command) War management."/>
<talkaction words="/balance" channel="0" event="script" value="balance.lua" desc="(Guild channel command) Balance management."/>
data/globalevents/scripts/init.lua or start.lua
Code:
db.executeQuery("DELETE FROM `guild_wars` WHERE `status` = 0 AND `begin` < " .. (os.time() - 2 * 86400) .. ";")
db.executeQuery("UPDATE `guild_wars` SET `status` = 5, `end` = " .. os.time() .. " WHERE `status` = 1 AND `end` > 0 AND `end` < " .. os.time() .. ";")
data/lib/101-war.lua
Code:
WAR_GUILD = 0
WAR_ENEMY = 1
data/talkactions/scripts/balance.lua
Code:
local function isValidMoney(value)
if(value == nil) then
return false
end
return (value > 0 and value <= 99999999999999)
end
function onSay(cid, words, param, channel)
local guild = getPlayerGuildId(cid)
if(guild == 0) then
return false
end
local t = string.explode(param, ' ', 1)
if(getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER and isInArray({ 'pick' }, t[1])) then
if(t[1] == 'pick') then
local money = { tonumber(t[2]) }
if(not isValidMoney(money[1])) then
doPlayerSendChannelMessage(cid, '', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_W, 0)
return true
end
local result = db.getResult('SELECT `balance` FROM `guilds` WHERE `id` = ' .. guild)
if(result:getID() == -1) then
return false
end
money[2] = result:getDataLong('balance')
result:free()
if(money[1] > money[2]) then
doPlayerSendChannelMessage(cid, '', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_W, 0)
return true
end
if(not db.executeQuery('UPDATE `guilds` SET `balance` = `balance` - ' .. money[1] .. ' WHERE `id` = ' .. guild .. ' LIMIT 1;')) then
return false
end
doPlayerAddMoney(cid, money[1])
doPlayerSendChannelMessage(cid, '', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_W, 0)
else
doPlayerSendChannelMessage(cid, '', 'Invalid sub-command.', TALKTYPE_CHANNEL_W, 0)
end
elseif(t[1] == 'donate') then
local money = tonumber(t[2])
if(not isValidMoney(money)) then
doPlayerSendChannelMessage(cid, '', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_W, 0)
return true
end
if(getPlayerMoney(cid) < money) then
doPlayerSendChannelMessage(cid, '', 'You don\'t have enough money.', TALKTYPE_CHANNEL_W, 0)
return true
end
if(not doPlayerRemoveMoney(cid, money)) then
return false
end
db.executeQuery('UPDATE `guilds` SET `balance` = `balance` + ' .. money .. ' WHERE `id` = ' .. guild .. ' LIMIT 1;')
doPlayerSendChannelMessage(cid, '', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_W, 0)
else
local result = db.getResult('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
if(result:getID() == -1) then
return false
end
doPlayerSendChannelMessage(cid, '', 'Current balance of guild ' .. result:getDataString('name') .. ' is: ' .. result:getDataLong('balance') .. ' bronze coins.', TALKTYPE_CHANNEL_W, 0)
result:free()
end
return true
end