• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Talkactions] Comandos War sytems Tfs 1.1

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Talkactions] Comandos War sytems Tfs 1.1 Empty [Talkactions] Comandos War sytems Tfs 1.1 Sáb Mar 21, 2015 3:01 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    hola usuarios de tibiaface

    bueno aqui le traigo los comandos para la guild war system de la tfs 1.1

    instalacion:

    nos vamos a:

    data/talkactions/scripts

    copiamos un archivo y renombramos por gwarabsolute.lua y pegamos esto dentro

    Código:
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild()
            if(guild == nil) then
                    player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                    return false
            end
     
            local guild = getPlayerGuildId(cid)
            if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then
                    player:sendCancelMessage("You cannot execute this talkaction.")
                    return false
            end
     
            local t = string.split(param, ",")
            if(not t[2]) then     
                    player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    player:sendChannelMessage("", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            if(enemy == guild) then
                    player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if tmp ~= false then
                    enemyName = result.getDataString(tmp, "name")
                    result.free(tmp)
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                    end
     
                    tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp == false) then
                            player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
     
                            result.free(_tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
            if(tmp ~= false) then
                         
                            if(result.getDataInt(tmp, "status") == 0) then
                                    if(result.getDataInt(tmp, "guild1") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            result.free(tmp)
                    end
     
                    if(str ~= "") then
                            player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    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.floor(payment)+1000
                            tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = result.getDataInt(tmp, "balance") < payment
                            result.free(tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
            if(tmp ~= false) then
                    local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(status == 4) then
                    player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
            if(tmp ~= false) then
                    if(result.getDataInt(tmp, "ended") > 0) then
                            result.free(tmp)
                            player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
         
            player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            return false
    end

    en la misma carpeta copiamos otro archivo y renombramos por absolutebalance.lua y pegamos esto dentro

    Código:
    local function isValidMoney(value)
            if(value == nil) then
                    return false
            end
            return (value > 0 and value <= 99999999999999)
    end
     
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild():getId()
            if(guild == nil) then
                    return true
            end
     
            local t = string.split(param, ' ', 1)
         
            if(player:getGuildLevel() == GUILDLEVEL_LEADER and isInArray({'pick'}, t[1])) then
                    if(t[1] == 'pick') then
                            local money = {tonumber(t[2])}
                            if(not isValidMoney(money[1])) then
                                    player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            local resultId = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            if resultId == false then
                                    return false
                            end
                         
                            money[2] = result.getDataInt(resultId, "balance")
                            result.free(resultId)
     
                            if(money[1] > money[2]) then
                                    player:sendChannelMessage('', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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])
                            player:sendChannelMessage('', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    else
                            player:sendChannelMessage('', 'Invalid sub-command.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    end
            elseif(t[1] == 'donate') then
                    local money = tonumber(t[2])
                    if(not isValidMoney(money)) then
                            player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return true
                    end
     
                    if(getPlayerMoney(cid) < money) then
                            player:sendChannelMessage('', 'You don\'t have enough money.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            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;')
                    player:sendChannelMessage('', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            else
                    local resultId = db.storeQuery('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
                    if resultId == false then
                            return false
                    end
                    player:sendChannelMessage('', 'Current balance of guild ' .. result.getDataString(resultId, "name") .. ' is: ' .. result.getDataInt(resultId, "balance") .. ' bronze coins.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    result.free(resultId)
            end
    end

    Luego nos vamos a:

    data/talkactions/talkactions.xml

    y añadimos estas tag:

    Código:
    <talkaction words="/war" separator=" " script="gwarabsolute.lua" />
       <talkaction words="/balance" separator=" " script="absolutebalance.lua" />

    tabla de comandos:

    [Talkactions] Comandos War sytems Tfs 1.1 MMGQyUU


    creditos: Absolute



    [Talkactions] Comandos War sytems Tfs 1.1 YNU5B25
    4 participantes
    http://www.tibiaface.com

    2[Talkactions] Comandos War sytems Tfs 1.1 Empty Re: [Talkactions] Comandos War sytems Tfs 1.1 Miér Abr 15, 2015 10:39 pm

    Invitado

    Anonymous
    Invitado
    [Admin] God Maya escribió:hola usuarios de tibiaface

    bueno aqui le traigo los comandos para la guild war system de la tfs 1.1

    instalacion:

    nos vamos a:

    data/talkactions/scripts
    copiamos un archivo y renombramos por gwarabsolute.lua y pegamos esto dentro

    Código:
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild()
            if(guild == nil) then
                    player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                    return false
            end
     
            local guild = getPlayerGuildId(cid)
            if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then
                    player:sendCancelMessage("You cannot execute this talkaction.")
                    return false
            end
     
            local t = string.split(param, ",")
            if(not t[2]) then      
                    player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    player:sendChannelMessage("", "Guild "" .. t[2] .. "" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            if(enemy == guild) then
                    player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if tmp ~= false then
                    enemyName = result.getDataString(tmp, "name")
                    result.free(tmp)
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                    end
     
                    tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp == false) then
                            player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
     
                            result.free(_tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
            if(tmp ~= false) then
                          
                            if(result.getDataInt(tmp, "status") == 0) then
                                    if(result.getDataInt(tmp, "guild1") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            result.free(tmp)
                    end
     
                    if(str ~= "") then
                            player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    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.floor(payment)+1000
                            tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = result.getDataInt(tmp, "balance") < payment
                            result.free(tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
            if(tmp ~= false) then
                    local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(status == 4) then
                    player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
            if(tmp ~= false) then
                    if(result.getDataInt(tmp, "ended") > 0) then
                            result.free(tmp)
                            player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
          
            player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            return false
    end

    en la misma carpeta copiamos otro archivo y renombramos por absolutebalance.lua y pegamos esto dentro

    Código:
    local function isValidMoney(value)
            if(value == nil) then
                    return false
            end
            return (value > 0 and value <= 99999999999999)
    end
     
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild():getId()
            if(guild == nil) then
                    return true
            end
     
            local t = string.split(param, ' ', 1)
          
            if(player:getGuildLevel() == GUILDLEVEL_LEADER and isInArray({'pick'}, t[1])) then
                    if(t[1] == 'pick') then
                            local money = {tonumber(t[2])}
                            if(not isValidMoney(money[1])) then
                                    player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            local resultId = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            if resultId == false then
                                    return false
                            end
                          
                            money[2] = result.getDataInt(resultId, "balance")
                            result.free(resultId)
     
                            if(money[1] > money[2]) then
                                    player:sendChannelMessage('', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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])
                            player:sendChannelMessage('', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    else
                            player:sendChannelMessage('', 'Invalid sub-command.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    end
            elseif(t[1] == 'donate') then
                    local money = tonumber(t[2])
                    if(not isValidMoney(money)) then
                            player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return true
                    end
     
                    if(getPlayerMoney(cid) < money) then
                            player:sendChannelMessage('', 'You don\'t have enough money.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            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;')
                    player:sendChannelMessage('', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            else
                    local resultId = db.storeQuery('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
                    if resultId == false then
                            return false
                    end
                    player:sendChannelMessage('', 'Current balance of guild ' .. result.getDataString(resultId, "name") .. ' is: ' .. result.getDataInt(resultId, "balance") .. ' bronze coins.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    result.free(resultId)
            end
    end

    Luego nos vamos a:

    data/talkactions/talkactions.xml
    y añadimos estas tag:

    Código:
    <talkaction words="/war" separator=" " script="gwarabsolute.lua" />
       <talkaction words="/balance" separator=" " script="absolutebalance.lua" />

    tabla de comandos:

    [Talkactions] Comandos War sytems Tfs 1.1 MMGQyUU


    creditos: Absolute

    Es para gesior?, lo dijo por que falta info en el sentido de que yo añadi los comandos i invitas y aceptas correctamente el problema es que de nada sirve en gesior x ejemplo ya que si pongo war a 10 frags por mucho que aga 10 frags y reinicie el server o loge o ag alo que aga sigo estando en war durante 1 semana, aver si puedes solucionarme eso>.< gracias maya

    4 participantes

    3[Talkactions] Comandos War sytems Tfs 1.1 Empty Re: [Talkactions] Comandos War sytems Tfs 1.1 Miér Abr 15, 2015 11:51 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    rikitrini escribió:
    [Admin] God Maya escribió:hola usuarios de tibiaface

    bueno aqui le traigo los comandos para la guild war system de la tfs 1.1

    instalacion:

    nos vamos a:

    data/talkactions/scripts
    copiamos un archivo y renombramos por gwarabsolute.lua y pegamos esto dentro

    Código:
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild()
            if(guild == nil) then
                    player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                    return false
            end
     
            local guild = getPlayerGuildId(cid)
            if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then
                    player:sendCancelMessage("You cannot execute this talkaction.")
                    return false
            end
     
            local t = string.split(param, ",")
            if(not t[2]) then      
                    player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    player:sendChannelMessage("", "Guild "" .. t[2] .. "" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            if(enemy == guild) then
                    player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if tmp ~= false then
                    enemyName = result.getDataString(tmp, "name")
                    result.free(tmp)
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                    end
     
                    tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp == false) then
                            player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
     
                            result.free(_tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
            if(tmp ~= false) then
                          
                            if(result.getDataInt(tmp, "status") == 0) then
                                    if(result.getDataInt(tmp, "guild1") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            result.free(tmp)
                    end
     
                    if(str ~= "") then
                            player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    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.floor(payment)+1000
                            tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = result.getDataInt(tmp, "balance") < payment
                            result.free(tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
            if(tmp ~= false) then
                    local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(status == 4) then
                    player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
            if(tmp ~= false) then
                    if(result.getDataInt(tmp, "ended") > 0) then
                            result.free(tmp)
                            player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
          
            player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            return false
    end

    en la misma carpeta copiamos otro archivo y renombramos por absolutebalance.lua y pegamos esto dentro

    Código:
    local function isValidMoney(value)
            if(value == nil) then
                    return false
            end
            return (value > 0 and value <= 99999999999999)
    end
     
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild():getId()
            if(guild == nil) then
                    return true
            end
     
            local t = string.split(param, ' ', 1)
          
            if(player:getGuildLevel() == GUILDLEVEL_LEADER and isInArray({'pick'}, t[1])) then
                    if(t[1] == 'pick') then
                            local money = {tonumber(t[2])}
                            if(not isValidMoney(money[1])) then
                                    player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            local resultId = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            if resultId == false then
                                    return false
                            end
                          
                            money[2] = result.getDataInt(resultId, "balance")
                            result.free(resultId)
     
                            if(money[1] > money[2]) then
                                    player:sendChannelMessage('', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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])
                            player:sendChannelMessage('', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    else
                            player:sendChannelMessage('', 'Invalid sub-command.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    end
            elseif(t[1] == 'donate') then
                    local money = tonumber(t[2])
                    if(not isValidMoney(money)) then
                            player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return true
                    end
     
                    if(getPlayerMoney(cid) < money) then
                            player:sendChannelMessage('', 'You don\'t have enough money.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            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;')
                    player:sendChannelMessage('', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            else
                    local resultId = db.storeQuery('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
                    if resultId == false then
                            return false
                    end
                    player:sendChannelMessage('', 'Current balance of guild ' .. result.getDataString(resultId, "name") .. ' is: ' .. result.getDataInt(resultId, "balance") .. ' bronze coins.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    result.free(resultId)
            end
    end

    Luego nos vamos a:

    data/talkactions/talkactions.xml
    y añadimos estas tag:

    Código:
    <talkaction words="/war" separator=" " script="gwarabsolute.lua" />
     <talkaction words="/balance" separator=" " script="absolutebalance.lua" />

    tabla de comandos:

    [Talkactions] Comandos War sytems Tfs 1.1 MMGQyUU


    creditos: Absolute

    Es para gesior?, lo dijo por que falta info en el sentido de que yo añadi los comandos i invitas y aceptas correctamente el problema es que de nada sirve en gesior x ejemplo ya que si pongo war a 10 frags por mucho que aga 10 frags y reinicie el server o loge o ag alo que aga sigo estando en war durante 1 semana, aver si puedes solucionarme eso>.< gracias maya

    el warsytem puede ser que este mal en tu php tendria que cambair el php de tu gesior para que te funicone correctamente



    [Talkactions] Comandos War sytems Tfs 1.1 YNU5B25
    4 participantes
    http://www.tibiaface.com

    Invitado

    Anonymous
    Invitado
    [Admin] God Maya escribió:
    rikitrini escribió:
    [Admin] God Maya escribió:hola usuarios de tibiaface

    bueno aqui le traigo los comandos para la guild war system de la tfs 1.1

    instalacion:

    nos vamos a:

    data/talkactions/scripts
    copiamos un archivo y renombramos por gwarabsolute.lua y pegamos esto dentro

    Código:
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild()
            if(guild == nil) then
                    player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                    return false
            end
     
            local guild = getPlayerGuildId(cid)
            if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then
                    player:sendCancelMessage("You cannot execute this talkaction.")
                    return false
            end
     
            local t = string.split(param, ",")
            if(not t[2]) then      
                    player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    player:sendChannelMessage("", "Guild "" .. t[2] .. "" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            if(enemy == guild) then
                    player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if tmp ~= false then
                    enemyName = result.getDataString(tmp, "name")
                    result.free(tmp)
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                    end
     
                    tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp == false) then
                            player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
     
                            result.free(_tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
            if(tmp ~= false) then
                          
                            if(result.getDataInt(tmp, "status") == 0) then
                                    if(result.getDataInt(tmp, "guild1") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            result.free(tmp)
                    end
     
                    if(str ~= "") then
                            player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    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.floor(payment)+1000
                            tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = result.getDataInt(tmp, "balance") < payment
                            result.free(tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
            if(tmp ~= false) then
                    local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(status == 4) then
                    player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
            if(tmp ~= false) then
                    if(result.getDataInt(tmp, "ended") > 0) then
                            result.free(tmp)
                            player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
          
            player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            return false
    end

    en la misma carpeta copiamos otro archivo y renombramos por absolutebalance.lua y pegamos esto dentro

    Código:
    local function isValidMoney(value)
            if(value == nil) then
                    return false
            end
            return (value > 0 and value <= 99999999999999)
    end
     
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild():getId()
            if(guild == nil) then
                    return true
            end
     
            local t = string.split(param, ' ', 1)
          
            if(player:getGuildLevel() == GUILDLEVEL_LEADER and isInArray({'pick'}, t[1])) then
                    if(t[1] == 'pick') then
                            local money = {tonumber(t[2])}
                            if(not isValidMoney(money[1])) then
                                    player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            local resultId = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            if resultId == false then
                                    return false
                            end
                          
                            money[2] = result.getDataInt(resultId, "balance")
                            result.free(resultId)
     
                            if(money[1] > money[2]) then
                                    player:sendChannelMessage('', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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])
                            player:sendChannelMessage('', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    else
                            player:sendChannelMessage('', 'Invalid sub-command.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    end
            elseif(t[1] == 'donate') then
                    local money = tonumber(t[2])
                    if(not isValidMoney(money)) then
                            player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return true
                    end
     
                    if(getPlayerMoney(cid) < money) then
                            player:sendChannelMessage('', 'You don\'t have enough money.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            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;')
                    player:sendChannelMessage('', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            else
                    local resultId = db.storeQuery('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
                    if resultId == false then
                            return false
                    end
                    player:sendChannelMessage('', 'Current balance of guild ' .. result.getDataString(resultId, "name") .. ' is: ' .. result.getDataInt(resultId, "balance") .. ' bronze coins.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    result.free(resultId)
            end
    end

    Luego nos vamos a:

    data/talkactions/talkactions.xml
    y añadimos estas tag:

    Código:
    <talkaction words="/war" separator=" " script="gwarabsolute.lua" />
     <talkaction words="/balance" separator=" " script="absolutebalance.lua" />

    tabla de comandos:

    [Talkactions] Comandos War sytems Tfs 1.1 MMGQyUU


    creditos: Absolute

    Es para gesior?, lo dijo por que falta info en el sentido de que yo añadi los comandos i invitas y aceptas correctamente el problema es que de nada sirve en gesior x ejemplo ya que si pongo war a 10 frags por mucho que aga 10 frags y reinicie el server o loge o ag alo que aga sigo estando en war durante 1 semana, aver si puedes solucionarme eso>.< gracias maya

    el warsytem puede ser que este mal en tu php tendria que cambair el php de tu gesior para que te funicone correctamente
    hm i mas facil me puedes decir que gesior queya venga bien puedo descargar para el tfs 1.1? gracias

    4 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    rikitrini escribió:
    [Admin] God Maya escribió:
    rikitrini escribió:
    [Admin] God Maya escribió:hola usuarios de tibiaface

    bueno aqui le traigo los comandos para la guild war system de la tfs 1.1

    instalacion:

    nos vamos a:

    data/talkactions/scripts
    copiamos un archivo y renombramos por gwarabsolute.lua y pegamos esto dentro

    Código:
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild()
            if(guild == nil) then
                    player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                    return false
            end
     
            local guild = getPlayerGuildId(cid)
            if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then
                    player:sendCancelMessage("You cannot execute this talkaction.")
                    return false
            end
     
            local t = string.split(param, ",")
            if(not t[2]) then      
                    player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    player:sendChannelMessage("", "Guild "" .. t[2] .. "" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            if(enemy == guild) then
                    player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if tmp ~= false then
                    enemyName = result.getDataString(tmp, "name")
                    result.free(tmp)
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                    end
     
                    tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp == false) then
                            player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
     
                            result.free(_tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
            if(tmp ~= false) then
                          
                            if(result.getDataInt(tmp, "status") == 0) then
                                    if(result.getDataInt(tmp, "guild1") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            result.free(tmp)
                    end
     
                    if(str ~= "") then
                            player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    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.floor(payment)+1000
                            tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = result.getDataInt(tmp, "balance") < payment
                            result.free(tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
            if(tmp ~= false) then
                    local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(status == 4) then
                    player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
            if(tmp ~= false) then
                    if(result.getDataInt(tmp, "ended") > 0) then
                            result.free(tmp)
                            player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
          
            player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            return false
    end

    en la misma carpeta copiamos otro archivo y renombramos por absolutebalance.lua y pegamos esto dentro

    Código:
    local function isValidMoney(value)
            if(value == nil) then
                    return false
            end
            return (value > 0 and value <= 99999999999999)
    end
     
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild():getId()
            if(guild == nil) then
                    return true
            end
     
            local t = string.split(param, ' ', 1)
          
            if(player:getGuildLevel() == GUILDLEVEL_LEADER and isInArray({'pick'}, t[1])) then
                    if(t[1] == 'pick') then
                            local money = {tonumber(t[2])}
                            if(not isValidMoney(money[1])) then
                                    player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            local resultId = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            if resultId == false then
                                    return false
                            end
                          
                            money[2] = result.getDataInt(resultId, "balance")
                            result.free(resultId)
     
                            if(money[1] > money[2]) then
                                    player:sendChannelMessage('', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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])
                            player:sendChannelMessage('', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    else
                            player:sendChannelMessage('', 'Invalid sub-command.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    end
            elseif(t[1] == 'donate') then
                    local money = tonumber(t[2])
                    if(not isValidMoney(money)) then
                            player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return true
                    end
     
                    if(getPlayerMoney(cid) < money) then
                            player:sendChannelMessage('', 'You don\'t have enough money.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            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;')
                    player:sendChannelMessage('', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            else
                    local resultId = db.storeQuery('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
                    if resultId == false then
                            return false
                    end
                    player:sendChannelMessage('', 'Current balance of guild ' .. result.getDataString(resultId, "name") .. ' is: ' .. result.getDataInt(resultId, "balance") .. ' bronze coins.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    result.free(resultId)
            end
    end

    Luego nos vamos a:

    data/talkactions/talkactions.xml
    y añadimos estas tag:

    Código:
    <talkaction words="/war" separator=" " script="gwarabsolute.lua" />
     <talkaction words="/balance" separator=" " script="absolutebalance.lua" />

    tabla de comandos:

    [Talkactions] Comandos War sytems Tfs 1.1 MMGQyUU


    creditos: Absolute

    Es para gesior?, lo dijo por que falta info en el sentido de que yo añadi los comandos i invitas y aceptas correctamente el problema es que de nada sirve en gesior x ejemplo ya que si pongo war a 10 frags por mucho que aga 10 frags y reinicie el server o loge o ag alo que aga sigo estando en war durante 1 semana, aver si puedes solucionarme eso>.< gracias maya

    el warsytem puede ser que este mal en tu php tendria que cambair el php de tu gesior para que te funicone correctamente
    hm i mas facil me puedes decir que gesior queya venga bien puedo descargar para el tfs 1.1? gracias


    lamentablemente no sabria decirte que gesior 2012 podrias usar ya no he utilizado todas la que ruedan por internet y no he utilizado el elf war system por la web solo por comando



    [Talkactions] Comandos War sytems Tfs 1.1 YNU5B25
    4 participantes
    http://www.tibiaface.com

    Invitado

    Anonymous
    Invitado
    [Admin] God Maya escribió:
    rikitrini escribió:
    [Admin] God Maya escribió:
    rikitrini escribió:
    [Admin] God Maya escribió:hola usuarios de tibiaface

    bueno aqui le traigo los comandos para la guild war system de la tfs 1.1

    instalacion:

    nos vamos a:

    data/talkactions/scripts
    copiamos un archivo y renombramos por gwarabsolute.lua y pegamos esto dentro

    Código:
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild()
            if(guild == nil) then
                    player:sendCancelMessage("You need to be in a guild in order to execute this talkaction.")
                    return false
            end
     
            local guild = getPlayerGuildId(cid)
            if not guild or (player:getGuildLevel() < GUILDLEVEL_LEADER) then
                    player:sendCancelMessage("You cannot execute this talkaction.")
                    return false
            end
     
            local t = string.split(param, ",")
            if(not t[2]) then      
                    player:sendChannelMessage("", "Not enough param(s).", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    player:sendChannelMessage("", "Guild "" .. t[2] .. "" does not exists.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            if(enemy == guild) then
                    player:sendChannelMessage("", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            local enemyName, tmp = "", db.storeQuery("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if tmp ~= false then
                    enemyName = result.getDataString(tmp, "name")
                    result.free(tmp)
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild1` = " .. enemy .. " AND `guild2` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild1` = " .. guild .. " AND `guild2` = " .. enemy
                    end
     
                    tmp = db.storeQuery("SELECT `id`, `started`, `ended`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp == false) then
                            player:sendChannelMessage("", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = result.getDataInt(_tmp, "balance") < result.getDataInt(tmp, "payment")
     
                            result.free(_tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. result.getDataInt(tmp, "payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`ended` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`started` = " .. os.time() .. ", `ended` = " .. (result.getDataInt(tmp, "ended") > 0 and (os.time() + ((result.getDataInt(tmp, "started") - result.getDataInt(tmp, "ended")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.storeQuery("SELECT `guild1`, `status` FROM `guild_wars` WHERE `guild1` IN (" .. guild .. "," .. enemy .. ") AND `guild2` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
            if(tmp ~= false) then
                          
                            if(result.getDataInt(tmp, "status") == 0) then
                                    if(result.getDataInt(tmp, "guild1") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            result.free(tmp)
                    end
     
                    if(str ~= "") then
                            player:sendChannelMessage("", str, TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    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.floor(payment)+1000
                            tmp = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = result.getDataInt(tmp, "balance") < payment
                            result.free(tmp)
                            if(state) then
                                    player:sendChannelMessage("", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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` (`guild1`, `guild2`, `started`, `ended`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    broadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `guild1` = " .. guild .. " AND `guild2` = " .. enemy .. " AND `status` = " .. status)
            if(tmp ~= false) then
                    local query = "UPDATE `guild_wars` SET `ended` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
     
            if(status == 4) then
                    player:sendChannelMessage("", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    return false
            end
     
            tmp = db.storeQuery("SELECT `id`, `ended` FROM `guild_wars` WHERE `guild1` = " .. enemy .. " AND `guild2` = " .. guild .. " AND `status` = 1")
            if(tmp ~= false) then
                    if(result.getDataInt(tmp, "ended") > 0) then
                            result.free(tmp)
                            player:sendChannelMessage("", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return false
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `ended` = " .. os.time() .. " WHERE `id` = " .. result.getDataInt(tmp, "id")
                    result.free(tmp)
     
                    db.query(query)
                    broadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return false
            end
          
            player:sendChannelMessage("", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            return false
    end

    en la misma carpeta copiamos otro archivo y renombramos por absolutebalance.lua y pegamos esto dentro

    Código:
    local function isValidMoney(value)
            if(value == nil) then
                    return false
            end
            return (value > 0 and value <= 99999999999999)
    end
     
    function onSay(cid, words, param)
     
            local player = Player(cid)
            local guild = player:getGuild():getId()
            if(guild == nil) then
                    return true
            end
     
            local t = string.split(param, ' ', 1)
          
            if(player:getGuildLevel() == GUILDLEVEL_LEADER and isInArray({'pick'}, t[1])) then
                    if(t[1] == 'pick') then
                            local money = {tonumber(t[2])}
                            if(not isValidMoney(money[1])) then
                                    player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            end
     
                            local resultId = db.storeQuery("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            if resultId == false then
                                    return false
                            end
                          
                            money[2] = result.getDataInt(resultId, "balance")
                            result.free(resultId)
     
                            if(money[1] > money[2]) then
                                    player:sendChannelMessage('', 'The balance is too low for such amount.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                                    return false
                            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])
                            player:sendChannelMessage('', 'You have just picked ' .. money[1] .. ' money from your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    else
                            player:sendChannelMessage('', 'Invalid sub-command.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    end
            elseif(t[1] == 'donate') then
                    local money = tonumber(t[2])
                    if(not isValidMoney(money)) then
                            player:sendChannelMessage('', 'Invalid amount of money specified.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            return true
                    end
     
                    if(getPlayerMoney(cid) < money) then
                            player:sendChannelMessage('', 'You don\'t have enough money.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                            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;')
                    player:sendChannelMessage('', 'You have transfered ' .. money .. ' money to your guild balance.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
            else
                    local resultId = db.storeQuery('SELECT `name`, `balance` FROM `guilds` WHERE `id` = ' .. guild)
                    if resultId == false then
                            return false
                    end
                    player:sendChannelMessage('', 'Current balance of guild ' .. result.getDataString(resultId, "name") .. ' is: ' .. result.getDataInt(resultId, "balance") .. ' bronze coins.', TALKTYPE_CHANNEL_R1, CHANNEL_GUILD)
                    result.free(resultId)
            end
    end

    Luego nos vamos a:

    data/talkactions/talkactions.xml
    y añadimos estas tag:

    Código:
    <talkaction words="/war" separator=" " script="gwarabsolute.lua" />
     <talkaction words="/balance" separator=" " script="absolutebalance.lua" />

    tabla de comandos:

    [Talkactions] Comandos War sytems Tfs 1.1 MMGQyUU


    creditos: Absolute

    Es para gesior?, lo dijo por que falta info en el sentido de que yo añadi los comandos i invitas y aceptas correctamente el problema es que de nada sirve en gesior x ejemplo ya que si pongo war a 10 frags por mucho que aga 10 frags y reinicie el server o loge o ag alo que aga sigo estando en war durante 1 semana, aver si puedes solucionarme eso>.< gracias maya

    el warsytem puede ser que este mal en tu php tendria que cambair el php de tu gesior para que te funicone correctamente
    hm i mas facil me puedes decir que gesior queya venga bien puedo descargar para el tfs 1.1? gracias


    lamentablemente no sabria decirte que gesior 2012 podrias usar ya no he utilizado todas la que ruedan por internet y no he utilizado el elf war system por la web solo por comando
    estube buscandfo en varios sitios y x lo que veo no es problema del gesior si no que nadie ha terminado el war system completamente para azerlo funcionar en tfs 1.1. o 1.0 con la pagina correctamente >.<

    4 participantes

    ervey000

    ervey000
    Miembro
    Miembro
    Esto funciona en Global tibiaface v20?

    4 participantes

    Juan Carlos

    Juan Carlos
    Miembro
    Miembro
    [Talkactions] Comandos War sytems Tfs 1.1 Vwz6nq

    Ahi algo que se pueda hacer?? :/ he intentado muchas cosas y no me sale
    este error me da sin moverle nada..

    4 participantes
    http://dybbuk.jimdo.com/

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Juan Carlos escribió:[Talkactions] Comandos War sytems Tfs 1.1 Vwz6nq

    Ahi algo que se pueda hacer?? :/ he intentado muchas cosas y no me sale
    este error me da sin moverle nada..

    el war system en tfs 1.2 solo se habilita por la pagina web amigo



    [Talkactions] Comandos War sytems Tfs 1.1 YNU5B25
    4 participantes
    http://www.tibiaface.com

    10[Talkactions] Comandos War sytems Tfs 1.1 Empty Re: [Talkactions] Comandos War sytems Tfs 1.1 Miér Mar 18, 2020 8:38 pm

    olekkox

    olekkox
    Nuevo Miembro
    Nuevo Miembro

    Lua Script Error: [TalkAction Interface]
    data/talkactions/scripts/gwarabsolute.lua:onSay
    data/talkactions/scripts/gwarabsolute.lua:11: attempt to compare number with nil
    stack traceback:
    [C]: in function '__lt'
    data/talkactions/scripts/gwarabsolute.lua:11: in function <data/talkactions/scripts/gwarabsolute.lua:1>

    how to fix? tfs 1.2

    4 participantes

    11[Talkactions] Comandos War sytems Tfs 1.1 Empty Re: [Talkactions] Comandos War sytems Tfs 1.1 Miér Mar 18, 2020 8:53 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    olekkox escribió:
    Lua Script Error: [TalkAction Interface]
    data/talkactions/scripts/gwarabsolute.lua:onSay
    data/talkactions/scripts/gwarabsolute.lua:11: attempt to compare number with nil
    stack traceback:
    [C]: in function '__lt'
    data/talkactions/scripts/gwarabsolute.lua:11: in function <data/talkactions/scripts/gwarabsolute.lua:1>

    how to fix? tfs 1.2

    su compilacion no soporta cast lo que quiere decir que su distribucion no contine la funcion en su fuente



    [Talkactions] Comandos War sytems Tfs 1.1 YNU5B25
    4 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    4 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).