Lucasawsdsa1 0 Posted December 6, 2017 Share Posted December 6, 2017 Fala Galera do xTibia, hoje venho trazer aqui para vocês um sistema de war system 100% Funcional, que ja tinha no meu servidor as scripts, e eu vejo muitas pessoas atras dessas scripts, tanto para Sqlite e para Mysql, Então Venho trazer aqui hoje o tão famoso sistema War System com escudos Sem precisar de Sources e mecher na Database do Servidor, O sistema consiste em só scripts no servidor então vamos para o script: Em data/talkactions/scripts crie um arquivo chamado attackguild.lua e coloque isto dentro --script by Notorious function onSay(cid, words, param) local storageId = 101 if isPlayerPzLocked(cid) then doPlayerSendCancel(cid, "You cannot use this command during battle.") return true end if getPlayerGuildId(cid) <= 0 then doPlayerSendCancel(cid, "You are not a guild member.") return true end if param == '' then local status = { [1] = {"OFF"}, [-1] = {"ON"} } doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Currently Status: "..status[getPlayerStorageValue(cid, storageId)][1].."") return true end if param == 'on' and getPlayerStorageValue(cid, storageId) == 1 then doPlayerSetStorageValue(cid, storageId, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Now you can attack guild members.") return true end if param == 'off' and getPlayerStorageValue(cid, storageId) == -1 then doPlayerSetStorageValue(cid, storageId, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Now you can't attack guild members.") return true end return true end Agora em data/talkactions/scripts crie outro arquivo chamado balance.lua e coloque isto dentro 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, '', 'Quantidade de dinheiro inválida.', 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, '', 'O saldo é muito baixo para esse valor.', TALKTYPE_CHANNEL_W, 0) return true end if(not db.query('UPDATE `guilds` SET `balance` = `balance` - ' .. money[1] .. ' WHERE `id` = ' .. guild .. ' LIMIT 1;')) then return false end doPlayerAddMoney(cid, money[1]) doPlayerSendChannelMessage(cid, '', 'Voce só pegou ' .. money[1] .. ' de dinheiro do saldo de sua guild.', TALKTYPE_CHANNEL_W, 0) else doPlayerSendChannelMessage(cid, '', 'Sub-Comando inválido.', TALKTYPE_CHANNEL_W, 0) end elseif(t[1] == 'donate') then local money = tonumber(t[2]) if(not isValidMoney(money)) then doPlayerSendChannelMessage(cid, '', 'Quantidade de dinheiro inválida.', TALKTYPE_CHANNEL_W, 0) return true end if(getPlayerMoney(cid) < money) then doPlayerSendChannelMessage(cid, '', 'Voce não tem dinheiro suficiente.', TALKTYPE_CHANNEL_W, 0) return true end if(not doPlayerRemoveMoney(cid, money)) then return false end db.query('UPDATE `guilds` SET `balance` = `balance` + ' .. money .. ' WHERE `id` = ' .. guild .. ' LIMIT 1;') doPlayerSendChannelMessage(cid, '', 'Voce tem transferido ' .. money .. ' de dinheiro para a sua guild.', 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, '', 'O saldo atual da guild ' .. result:getDataString('name') .. ' é: ' .. result:getDataLong('balance') .. ' Bronze Coins.', TALKTYPE_CHANNEL_W, 0) result:free() end return true end Agora em Data/talkactions/scripts crie outro arquivo chamado war.lua e coloque isto dentro: function onSay(cid, words, param, channel) local guild = getPlayerGuildId(cid) if(not guild or getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER) then doPlayerSendChannelMessage(cid, "", "Voce não pode executar este talkaction.", TALKTYPE_CHANNEL_W, 0) return true end local t = string.explode(param, ",") if(not t[2]) then doPlayerSendChannelMessage(cid, "", "Nenhum parâmetro.", TALKTYPE_CHANNEL_W, 0) return true end local enemy = getGuildId(t[2]) if(not enemy) then doPlayerSendChannelMessage(cid, "", "A guild \"" .. t[2] .. "\" não existe.", TALKTYPE_CHANNEL_W, 0) return true end if(enemy == guild) then doPlayerSendChannelMessage(cid, "", "Você não pode declarar war com sua própria guild.", TALKTYPE_CHANNEL_W, 0) return true end local enemyName, tmp = "", db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy) if(tmp:getID() ~= -1) then enemyName = tmp:getDataString("name") tmp:free() end if(isInArray({"accept", "reject", "cancel"}, t[1])) then local query = "`guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild if(t[1] == "cancel") then query = "`guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy end tmp = db.getResult("SELECT `id`, `begin`, `end`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0") if(tmp:getID() == -1) then doPlayerSendChannelMessage(cid, "", "Atualmente não há nenhum convite pendente para uma war com " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end if(t[1] == "accept") then local _tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = _tmp:getID() < 0 or _tmp:getDataInt("balance") < tmp:getDataInt("payment") _tmp:free() if(state) then doPlayerSendChannelMessage(cid, "", "O saldo da sua guild é muito baixo para aceitar este convite.", TALKTYPE_CHANNEL_W, 0) return true end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. tmp:getDataInt("payment") .. " WHERE `id` = " .. guild) end query = "UPDATE `guild_wars` SET " local msg = "aceitou a guild " .. enemyName .. " para a war." if(t[1] == "reject") then query = query .. "`end` = " .. os.time() .. ", `status` = 2" msg = "rejeitou a guild " .. enemyName .. " para a war." elseif(t[1] == "cancel") then query = query .. "`end` = " .. os.time() .. ", `status` = 3" msg = "cancelou a war com a guild " .. enemyName .. "." else query = query .. "`begin` = " .. os.time() .. ", `end` = " .. (tmp:getDataInt("end") > 0 and (os.time() + ((tmp:getDataInt("begin") - tmp:getDataInt("end")) / 86400)) or 0) .. ", `status` = 1" end query = query .. " WHERE `id` = " .. tmp:getDataInt("id") if(t[1] == "accept") then doGuildAddEnemy(guild, enemy, tmp:getDataInt("id"), WAR_GUILD) doGuildAddEnemy(enemy, guild, tmp:getDataInt("id"), WAR_ENEMY) end tmp:free() db.query(query) doBroadcastMessage(getPlayerGuildName(cid) .. " " .. msg, MESSAGE_EVENT_ADVANCE) return true end if(t[1] == "invite") then local str = "" tmp = db.getResult("SELECT `guild_id`, `status` FROM `guild_wars` WHERE `guild_id` IN (" .. guild .. "," .. enemy .. ") AND `enemy_id` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)") if(tmp:getID() ~= -1) then if(tmp:getDataInt("status") == 0) then if(tmp:getDataInt("guild_id") == guild) then str = "Voce já invitou a guild " .. enemyName .. " para a war." else str = enemyName .. " já invitou voce para a war." end else str = "Voce já está em guerra com a guild " .. enemyName .. "." end tmp:free() end if(str ~= "") then doPlayerSendChannelMessage(cid, "", str, TALKTYPE_CHANNEL_W, 0) return true end local frags = tonumber(t[3]) if(frags ~= nil) then frags = math.max(10, math.min(1000, frags)) else frags = 100 end local payment = tonumber(t[4]) if(payment ~= nil) then payment = math.max(100000, math.min(1000000000, payment)) tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = tmp:getID() < 0 or tmp:getDataInt("balance") < payment tmp:free() if(state) then doPlayerSendChannelMessage(cid, "", "O saldo da sua guild é muito baixo para tal pagamento.", TALKTYPE_CHANNEL_W, 0) return true end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild) else payment = 0 end local begining, ending = os.time(), tonumber(t[5]) if(ending ~= nil and ending ~= 0) then ending = begining + (ending * 86400) else ending = 0 end db.query("INSERT INTO `guild_wars` (`guild_id`, `enemy_id`, `begin`, `end`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");") doBroadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE) return true end if(not isInArray({"end", "finish"}, t[1])) then return false end local status = (t[1] == "end" and 1 or 4) tmp = db.getResult("SELECT `id` FROM `guild_wars` WHERE `guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy .. " AND `status` = " .. status) if(tmp:getID() ~= -1) then local query = "UPDATE `guild_wars` SET `end` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. tmp:getDataInt("id") tmp:free() doGuildRemoveEnemy(guild, enemy) doGuildRemoveEnemy(enemy, guild) db.query(query) doBroadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return true end if(status == 4) then doPlayerSendChannelMessage(cid, "", "Atualmente não há trégua de guerra pendente da guild " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end tmp = db.getResult("SELECT `id`, `end` FROM `guild_wars` WHERE `guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild .. " AND `status` = 1") if(tmp:getID() ~= -1) then if(tmp:getDataInt("end") > 0) then tmp:free() doPlayerSendChannelMessage(cid, "", "Você não pode acabar com a war com " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end local query = "UPDATE `guild_wars` SET `status` = 4, `end` = " .. os.time() .. " WHERE `id` = " .. tmp:getDataInt("id") tmp:free() db.query(query) doBroadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return true end doPlayerSendChannelMessage(cid, "", "Atualmente não há nenhuma guerra ativa com a guild " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end DEPOIS DE TER ADICIONADO ESSES 3 ARQUIVOS CORRETAMENTE VA EM data/talkactions/talkactions.xml e adicione essas tag <!-- Guilds --> <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."/> <talkaction words="!attackguild" event="script" value="attackguild.lua"/> Adicionado essas tags vamos para Data/lib/ crie um arquivo chamado 101-war.lua e coloque isto dentro: WAR_GUILD = 0 WAR_ENEMY = 1 Pronto Sistema adicionado Com sucesso. Explicando o Sistema: Para uma guilda Atacar outra guilda inimiga vai ter que digitar o Seguinte comando !attackguild no Default vai aparecer a seguinte mensagem se tudo estiver 100% : Currently Status: ON Depois que aparecer esta mensagem, O player vai ter que abrir o chat da guilda dele, e dentro do chat usar o seguinte comando: /war invite, NOME DA GUILD INIMIGA QUE VAI ENTRAR EM GUERRA. Apos ter dado esse comando a guilda Inimiga vai receber a mensagem que foi invitada para uma war Então o player inimigo vai ter que digitar no chat da guild dele /war accept ,NOME DA GUILD QUE VOCE VAI ACEITAR A GUERRA. Pronto, quando a guerra for aceita pela outra Guild automaticamente vao entrar em guerra, A guerra só acaba quando umas das guilda atingirem as 100 frags. Lembrando Esse sistema, se as guildas estiverem em Guerra, as frags vai contar Sim ! E Tambem Dar o Comando no chat da propria Guilda /balance vai mostrar quantos coins tem a sua guilda. E outra coisa, Ambas guild vai receber o Famoso ESCUDO aduadhas. Bom é isso, Se funcionar no servidor de voces Deem REP ++, Lembrando Foi testado e aprovado em um servidor de DBO Versão 8.6 TFS 0.4. Link to comment Share on other sites More sharing options...
leozinpbb 7 Posted December 6, 2017 Share Posted December 6, 2017 será que tem como funcionar em 0.3.6 ? 8.54 eu vi um servidor que possui esse sistemas e nenhum outro . Link to comment Share on other sites More sharing options...
Emanueldk 0 Posted April 26, 2018 Share Posted April 26, 2018 Em 06/12/2017 at 17:38, leozinpbb disse: será que tem como funcionar em 0.3.6 ? 8.54 eu vi um servidor que possui esse sistemas e nenhum outro . Em 06/12/2017 at 13:53, Lucasawsdsa1 disse: Fala Galera do xTibia, hoje venho trazer aqui para vocês um sistema de war system 100% Funcional, que ja tinha no meu servidor as scripts, e eu vejo muitas pessoas atras dessas scripts, tanto para Sqlite e para Mysql, Então Venho trazer aqui hoje o tão famoso sistema War System com escudos Sem precisar de Sources e mecher na Database do Servidor, O sistema consiste em só scripts no servidor então vamos para o script: Em data/talkactions/scripts crie um arquivo chamado attackguild.lua e coloque isto dentro --script by Notorious function onSay(cid, words, param) local storageId = 101 if isPlayerPzLocked(cid) then doPlayerSendCancel(cid, "You cannot use this command during battle.") return true end if getPlayerGuildId(cid) <= 0 then doPlayerSendCancel(cid, "You are not a guild member.") return true end if param == '' then local status = { [1] = {"OFF"}, [-1] = {"ON"} } doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Currently Status: "..status[getPlayerStorageValue(cid, storageId)][1].."") return true end if param == 'on' and getPlayerStorageValue(cid, storageId) == 1 then doPlayerSetStorageValue(cid, storageId, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Now you can attack guild members.") return true end if param == 'off' and getPlayerStorageValue(cid, storageId) == -1 then doPlayerSetStorageValue(cid, storageId, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Now you can't attack guild members.") return true end return true end Agora em data/talkactions/scripts crie outro arquivo chamado balance.lua e coloque isto dentro 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, '', 'Quantidade de dinheiro inválida.', 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, '', 'O saldo é muito baixo para esse valor.', TALKTYPE_CHANNEL_W, 0) return true end if(not db.query('UPDATE `guilds` SET `balance` = `balance` - ' .. money[1] .. ' WHERE `id` = ' .. guild .. ' LIMIT 1;')) then return false end doPlayerAddMoney(cid, money[1]) doPlayerSendChannelMessage(cid, '', 'Voce só pegou ' .. money[1] .. ' de dinheiro do saldo de sua guild.', TALKTYPE_CHANNEL_W, 0) else doPlayerSendChannelMessage(cid, '', 'Sub-Comando inválido.', TALKTYPE_CHANNEL_W, 0) end elseif(t[1] == 'donate') then local money = tonumber(t[2]) if(not isValidMoney(money)) then doPlayerSendChannelMessage(cid, '', 'Quantidade de dinheiro inválida.', TALKTYPE_CHANNEL_W, 0) return true end if(getPlayerMoney(cid) < money) then doPlayerSendChannelMessage(cid, '', 'Voce não tem dinheiro suficiente.', TALKTYPE_CHANNEL_W, 0) return true end if(not doPlayerRemoveMoney(cid, money)) then return false end db.query('UPDATE `guilds` SET `balance` = `balance` + ' .. money .. ' WHERE `id` = ' .. guild .. ' LIMIT 1;') doPlayerSendChannelMessage(cid, '', 'Voce tem transferido ' .. money .. ' de dinheiro para a sua guild.', 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, '', 'O saldo atual da guild ' .. result:getDataString('name') .. ' é: ' .. result:getDataLong('balance') .. ' Bronze Coins.', TALKTYPE_CHANNEL_W, 0) result:free() end return true end Agora em Data/talkactions/scripts crie outro arquivo chamado war.lua e coloque isto dentro: function onSay(cid, words, param, channel) local guild = getPlayerGuildId(cid) if(not guild or getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER) then doPlayerSendChannelMessage(cid, "", "Voce não pode executar este talkaction.", TALKTYPE_CHANNEL_W, 0) return true end local t = string.explode(param, ",") if(not t[2]) then doPlayerSendChannelMessage(cid, "", "Nenhum parâmetro.", TALKTYPE_CHANNEL_W, 0) return true end local enemy = getGuildId(t[2]) if(not enemy) then doPlayerSendChannelMessage(cid, "", "A guild \"" .. t[2] .. "\" não existe.", TALKTYPE_CHANNEL_W, 0) return true end if(enemy == guild) then doPlayerSendChannelMessage(cid, "", "Você não pode declarar war com sua própria guild.", TALKTYPE_CHANNEL_W, 0) return true end local enemyName, tmp = "", db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy) if(tmp:getID() ~= -1) then enemyName = tmp:getDataString("name") tmp:free() end if(isInArray({"accept", "reject", "cancel"}, t[1])) then local query = "`guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild if(t[1] == "cancel") then query = "`guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy end tmp = db.getResult("SELECT `id`, `begin`, `end`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0") if(tmp:getID() == -1) then doPlayerSendChannelMessage(cid, "", "Atualmente não há nenhum convite pendente para uma war com " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end if(t[1] == "accept") then local _tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = _tmp:getID() < 0 or _tmp:getDataInt("balance") < tmp:getDataInt("payment") _tmp:free() if(state) then doPlayerSendChannelMessage(cid, "", "O saldo da sua guild é muito baixo para aceitar este convite.", TALKTYPE_CHANNEL_W, 0) return true end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. tmp:getDataInt("payment") .. " WHERE `id` = " .. guild) end query = "UPDATE `guild_wars` SET " local msg = "aceitou a guild " .. enemyName .. " para a war." if(t[1] == "reject") then query = query .. "`end` = " .. os.time() .. ", `status` = 2" msg = "rejeitou a guild " .. enemyName .. " para a war." elseif(t[1] == "cancel") then query = query .. "`end` = " .. os.time() .. ", `status` = 3" msg = "cancelou a war com a guild " .. enemyName .. "." else query = query .. "`begin` = " .. os.time() .. ", `end` = " .. (tmp:getDataInt("end") > 0 and (os.time() + ((tmp:getDataInt("begin") - tmp:getDataInt("end")) / 86400)) or 0) .. ", `status` = 1" end query = query .. " WHERE `id` = " .. tmp:getDataInt("id") if(t[1] == "accept") then doGuildAddEnemy(guild, enemy, tmp:getDataInt("id"), WAR_GUILD) doGuildAddEnemy(enemy, guild, tmp:getDataInt("id"), WAR_ENEMY) end tmp:free() db.query(query) doBroadcastMessage(getPlayerGuildName(cid) .. " " .. msg, MESSAGE_EVENT_ADVANCE) return true end if(t[1] == "invite") then local str = "" tmp = db.getResult("SELECT `guild_id`, `status` FROM `guild_wars` WHERE `guild_id` IN (" .. guild .. "," .. enemy .. ") AND `enemy_id` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)") if(tmp:getID() ~= -1) then if(tmp:getDataInt("status") == 0) then if(tmp:getDataInt("guild_id") == guild) then str = "Voce já invitou a guild " .. enemyName .. " para a war." else str = enemyName .. " já invitou voce para a war." end else str = "Voce já está em guerra com a guild " .. enemyName .. "." end tmp:free() end if(str ~= "") then doPlayerSendChannelMessage(cid, "", str, TALKTYPE_CHANNEL_W, 0) return true end local frags = tonumber(t[3]) if(frags ~= nil) then frags = math.max(10, math.min(1000, frags)) else frags = 100 end local payment = tonumber(t[4]) if(payment ~= nil) then payment = math.max(100000, math.min(1000000000, payment)) tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild) local state = tmp:getID() < 0 or tmp:getDataInt("balance") < payment tmp:free() if(state) then doPlayerSendChannelMessage(cid, "", "O saldo da sua guild é muito baixo para tal pagamento.", TALKTYPE_CHANNEL_W, 0) return true end db.query("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild) else payment = 0 end local begining, ending = os.time(), tonumber(t[5]) if(ending ~= nil and ending ~= 0) then ending = begining + (ending * 86400) else ending = 0 end db.query("INSERT INTO `guild_wars` (`guild_id`, `enemy_id`, `begin`, `end`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");") doBroadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE) return true end if(not isInArray({"end", "finish"}, t[1])) then return false end local status = (t[1] == "end" and 1 or 4) tmp = db.getResult("SELECT `id` FROM `guild_wars` WHERE `guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy .. " AND `status` = " .. status) if(tmp:getID() ~= -1) then local query = "UPDATE `guild_wars` SET `end` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. tmp:getDataInt("id") tmp:free() doGuildRemoveEnemy(guild, enemy) doGuildRemoveEnemy(enemy, guild) db.query(query) doBroadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return true end if(status == 4) then doPlayerSendChannelMessage(cid, "", "Atualmente não há trégua de guerra pendente da guild " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end tmp = db.getResult("SELECT `id`, `end` FROM `guild_wars` WHERE `guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild .. " AND `status` = 1") if(tmp:getID() ~= -1) then if(tmp:getDataInt("end") > 0) then tmp:free() doPlayerSendChannelMessage(cid, "", "Você não pode acabar com a war com " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end local query = "UPDATE `guild_wars` SET `status` = 4, `end` = " .. os.time() .. " WHERE `id` = " .. tmp:getDataInt("id") tmp:free() db.query(query) doBroadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE) return true end doPlayerSendChannelMessage(cid, "", "Atualmente não há nenhuma guerra ativa com a guild " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0) return true end DEPOIS DE TER ADICIONADO ESSES 3 ARQUIVOS CORRETAMENTE VA EM data/talkactions/talkactions.xml e adicione essas tag <!-- Guilds --> <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."/> <talkaction words="!attackguild" event="script" value="attackguild.lua"/> Adicionado essas tags vamos para Data/lib/ crie um arquivo chamado 101-war.lua e coloque isto dentro: WAR_GUILD = 0 WAR_ENEMY = 1 Pronto Sistema adicionado Com sucesso. Explicando o Sistema: Para uma guilda Atacar outra guilda inimiga vai ter que digitar o Seguinte comando !attackguild no Default vai aparecer a seguinte mensagem se tudo estiver 100% : Currently Status: ON Depois que aparecer esta mensagem, O player vai ter que abrir o chat da guilda dele, e dentro do chat usar o seguinte comando: /war invite, NOME DA GUILD INIMIGA QUE VAI ENTRAR EM GUERRA. Apos ter dado esse comando a guilda Inimiga vai receber a mensagem que foi invitada para uma war Então o player inimigo vai ter que digitar no chat da guild dele /war accept ,NOME DA GUILD QUE VOCE VAI ACEITAR A GUERRA. Pronto, quando a guerra for aceita pela outra Guild automaticamente vao entrar em guerra, A guerra só acaba quando umas das guilda atingirem as 100 frags. Lembrando Esse sistema, se as guildas estiverem em Guerra, as frags vai contar Sim ! E Tambem Dar o Comando no chat da propria Guilda /balance vai mostrar quantos coins tem a sua guilda. E outra coisa, Ambas guild vai receber o Famoso ESCUDO aduadhas. Bom é isso, Se funcionar no servidor de voces Deem REP ++, Lembrando Foi testado e aprovado em um servidor de DBO Versão 8.6 TFS 0.4. o man, o meu akie qnd é pra aceitar nao ta indo, ele manda o comando no default como se eu estivesse conversando com alguem Link to comment Share on other sites More sharing options...
leozinpbb 7 Posted April 27, 2018 Share Posted April 27, 2018 Melhor usar em 8.60 ( 0.4) melhor e sem bugs. Link to comment Share on other sites More sharing options...
marcelinhok 1 Posted January 15, 2019 Share Posted January 15, 2019 Esta pendindo uma Query, creio q seja no Sqlite. Podeira disponibilizar ? Duduh124000 1 Link to comment Share on other sites More sharing options...
orshabinha 0 Posted May 26, 2019 Share Posted May 26, 2019 Em 06/12/2017 em 12:53, Lucasawsdsa1 disse: <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."/> <talkaction words="!attackguild" event="script" value="attackguild.lua"/> Atualmente não há nenhum convite pendente para uma war sempre aparece isso. Link to comment Share on other sites More sharing options...
Lolksky 17 Posted June 15, 2020 Share Posted June 15, 2020 Ao usar o comando /war invite, NOME DA GUILD aparece: [20:43:12.194] [Error - TalkAction Interface] [20:43:12.198] data/talkactions/scripts/war.lua:onSay [20:43:12.202] Description: [20:43:12.204] data/talkactions/scripts/war.lua:3: attempt to compare number with nil [20:43:12.206] stack traceback: [20:43:12.207] data/talkactions/scripts/war.lua:3: in function <data/talkactions/scripts/war.lua:1> Link to comment Share on other sites More sharing options...
mantega11 0 Posted January 28, 2022 Share Posted January 28, 2022 usei esse script e agr os char nao ataca os outros, pega pk mais nao hit o char. oque sera que pode ser? Link to comment Share on other sites More sharing options...
Recommended Posts