• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[7.72] Task Rank on Gesior

potinho

Intermediate OT User
Joined
Oct 11, 2009
Messages
1,397
Solutions
17
Reaction score
148
Location
Brazil
Hi guys good morning. I have a fully functional task system (4.0 by Vodkart). I would like to implement a rank in my Gesior, when finishing the tasks she gives points to the player on game, so I would like to create this rank visible on the website. can you help me? Follow task MOD

XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Simple Task" version="4.0" author="Vodkart" contact="tibiaking.com" enabled="yes">
<config name="task_func"><![CDATA[
task_sys = {
    [1] = {name = "Trolls", start = 176201, monsters_list = {"Troll"}, level = 8, count = 40, points = 0, items = {}, reward = {}, exp = 20000, money = 2000},
    [2] = {name = "rotworms", start = 176202, monsters_list = {"rotworm"}, level = 12, count = 50, points = 0, items = {}, reward = {}, exp = 25000, money = 3000},
    [3] = {name = "Minotaurs", start = 176216, monsters_list = {"minotaur","minotaur guard","minotaur archer","minotaur mage"}, level = 15, count = 150, points = 1, items = {}, reward = {}, exp = 30000, money = 10000},
    [4] = {name = "cyclops", start = 176203, monsters_list = {"cyclops"}, level = 19, count = 60, points = 1, items = {}, reward = {{2486,1}}, exp = 30000, money = 3000},
    [5] = {name = "Green Djinn", start = 176204, monsters_list = {"Green Djinn","Efreet"}, level = 23, count = 80, points = 1, items = {}, reward = {}, exp = 100000, money = 5000},
    [6] = {name = "Blue Djinn", start = 176205, monsters_list = {"Blue Djinn","Marid"}, level = 25, count = 80, points = 1, items = {}, reward = {}, exp = 100000, money = 5000},
    [7] = {name = "Terror Birds", start = 176206, monsters_list = {"Terror Bird"}, level = 30, count = 120, points = 2, items = {}, reward = {}, exp = 100000, money = 5000},
    [8] = {name = "Stone Golems", start = 176207, monsters_list = {"Stone Golem"}, level = 33, count = 130, points = 3, items = {}, reward = {}, exp = 120000, money = 7000},
    [9] = {name = "Carniphilas", start = 176208, monsters_list = {"carniphila"}, level = 36, count = 135, points = 3, items = {}, reward = {}, exp = 80000, money = 8000},
    [10] = {name = "Elephants", start = 176209, monsters_list = {"elephant"}, level = 40, count = 150, points = 2, items = {}, reward = {}, exp = 120000, money = 8200},
    [11] = {name = "Dwarves", start = 176210, monsters_list = {"dwarf","dwarf soldier","dwarf guard","dwarf geomancer"}, level = 42, count = 150, points = 3, items = {}, reward = {}, exp = 200000, money = 15000},
    [12] = {name = "Vampires", start = 176211, monsters_list = {"vampire"}, level = 46, count = 170, points = 2, items = {}, reward = {}, exp = 80000, money = 8500},
    [13] = {name = "Dragons", start = 176212, monsters_list = {"dragon"}, level = 50, count = 120, points = 1, items = {}, reward = {}, exp = 90000, money = 9000},
    [14] = {name = "Necromancer" ,start = 176213, monsters_list = {"Necromancer"}, level = 60, count = 200, points = 3, items = {}, reward = {}, exp = 200000, money = 15000},
    [15] = {name = "Bonebeasts" ,start = 176214, monsters_list = {"Bonebeast"}, level = 63, count = 250, points = 3, items = {}, reward = {}, exp = 250000, money = 11000},
    [16] = {name = "Giant Spider" ,start = 176215, monsters_list = {"Giant Spider","The old widow"}, level = 80, count = 500, points = 0, items = {}, reward = {}, exp = 200000, money = 32000},
    [17] = {name = "Dragon Lords" ,start = 176219, monsters_list = {"Dragon lord"}, level = 88, count = 650, points = 3, items = {}, reward = {}, exp = 30000, money = 35000},
    [18] = {name = "Hydras" ,start = 176222, monsters_list = {"Hydra"}, level = 100, count = 700, points = 3, items = {{4850,10}}, reward = {}, exp = 400000, money = 40000},
    [19] = {name = "Serpent Spawn" ,start = 176223, monsters_list = {"Serpent Spawn"}, level = 103, count = 720, points = 4, items = {{2445,1}}, reward = {}, exp = 500000, money = 45000},
    [20] = {name = "Behemoths" ,start = 176224, monsters_list = {"Behemoth"}, level = 108, count = 800, points = 4, items = {}, reward = {}, exp = 5000000, money = 200000},
    [21] = {name = "Demons" ,start = 176225, monsters_list = {"Demon"}, level = 110, count = 6666, points = 4, items = {}, reward = {{2495,1}}, exp = 6660000, money = 500000},
    [22] = {name = "Orshabaals" ,start = 176226, monsters_list = {"Orshabaal"}, level = 120, count = 300, points = 5, items = {}, reward = {{2341,1},{5114,1}}, exp = 9960000, money = 800000},
    [23] = {name = "Ferumbras" ,start = 176227, monsters_list = {"Ferumbras"}, level = 130, count = 50, points = 5, items = {}, reward = {{2345,1}}, exp = 6660000, money = 666000},
    [24] = {name = "Golden Knights" ,start = 176228, monsters_list = {"Golden Knight"}, level = 200, count = 10, points = 10, items = {}, reward = {{2646,1}}, exp = 10660000, money = 900000}
}
daily_task = {
    [1] = {name = "Orcs" ,monsters_list = {"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, count = 100, points = 0, reward = {}, exp = 5000, money = 10000},
    [2] = {name = "Tarantulas" ,monsters_list = {"Tarantula"}, count = 120, points = 1, reward = {}, exp = 9000, money = 12000},
    [3] = {name = "Cyclops" ,monsters_list = {"Cyclops"}, count = 125, points = 2, reward = {}, exp = 9000, money = 15000},
    [4] = {name = "Dragons" ,monsters_list = {"Dragon"}, count = 150, points = 0, reward = {}, exp = 2000, money = 10000},
    [5] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 200, points = 1, reward = {}, exp = 20000, money = 25000},
    [6] = {name = "Ancient Scarabs" ,monsters_list = {"Ancient Scarab"}, count = 180, points = 5, reward = {}, exp = 22000, money = 18000},
    [7] = {name = "Behemoths" ,monsters_list = {"Behemoth"}, count = 300, points = 3, reward = {}, exp = 50000, money = 60000},
    [8] = {name = "Heroes" ,monsters_list = {"Hero"}, count = 260, points = 2, reward = {}, exp = 40000, money = 55000},
    [9] = {name = "Giant Spiders" ,monsters_list = {"Giant Spider"}, count = 350, points = 3, reward = {}, exp = 60000, money = 70000},
    [10] = {name = "Warlocks" ,monsters_list = {"Warlock"}, count = 700, points = 3, reward = {{2173,1}}, exp = 90000, money = 120000},
    [11] = {name = "Hydras" ,monsters_list = {"Hydra"}, count = 700, points = 3, reward = {}, exp = 100000, money = 160000},
    [12] = {name = "Dragon Lords" ,monsters_list = {"Dragon Lord"}, count = 700, points = 3, reward = {{2445,1}}, exp = 1300000, money = 200000},
    [13] = {name = "The Old Widows" ,monsters_list = {"The Old Widow"}, count = 500, points = 5, reward = {{2472,1}}, exp = 2000000, money = 200000},
    [14] = {name = "Demodras" ,monsters_list = {"Demodras"}, count = 800, points = 5, reward = {{2492,1}}, exp = 2000000, money = 200000},
    [15] = {name = "Necropharus" ,monsters_list = {"Necropharus"}, count = 600, points = 8, reward = {{2663,1}}, exp = 2000000, money = 200000}
   
}
task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608} -- task, points, count, daily task, daily count, daily time , daily start, contador
function getTaskMission(cid)
    return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
end
function getDailyTaskMission(cid)
    return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
end
function getTaskPoints(cid)
    return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
end
function doRandomDailyTask(cid)
    local t = {
        [{6,49}] = {1,4},
        [{50,79}] = {5,9},
        [{80,129}] = {10,12},
        [{130,math.huge}] = {13,15}
    }
    for a , b in pairs(t) do
        if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
            return math.random(b[1], b[2])
        end
    end
    return 0
end
function GetRankTask(cid)
    local ranks = {
        [{1, 20}] = "Huntsman",
        [{21, 50}] = "Ranger",
        [{51, 100}] = "Big Game Hunter",
        [{101, 200}] = "Senior Hunter",       
        [{201, math.huge}] = "Extreme Hunter"
    }
    for v , r in pairs(ranks) do
        if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
            return r
        end
    end
    return 0
end
function getItemsFromList(items)
    local str = ''
    if table.maxn(items) > 0 then
        for i = 1, table.maxn(items) do
            str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
            if i ~= table.maxn(items) then str = str .. ', '
            end
        end
    end
    return str
end
function doRemoveItemsFromList(cid,items)
    local count = 0
    if table.maxn(items) > 0 then
        for i = 1, table.maxn(items) do
            if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
            count = count + 1 end
        end
    end
    if count == table.maxn(items) then
        for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
    else
        return false
    end
    return true
end
function getMonsterFromList(monster)
    local str = ''
    if #monster > 0 then
        for i = 1, #monster do
            str = str .. monster[i]
            if i ~= #monster then str = str .. ', ' end
        end
    end
    return str
end
function GiveRewardsTask(cid, items)
    local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
    for _, i_i in ipairs(items) do
        local item, amount = i_i[1],i_i[2]
        if isItemStackable(item) or amount == 1 then
            doAddContainerItem(backpack, item, amount)
        else
            for i = 1, amount do
                doAddContainerItem(backpack, item, 1)
            end
        end
    end
end
function isSummon(cid)
    if(not isCreature(cid)) then
        return false
    end
    return getCreatureMaster(cid) ~= cid
end
]]></config>
<event type="login" name="TaskLogin" event="script"><![CDATA[
function onLogin(cid)
    registerCreatureEvent(cid, "KillTask")
    registerCreatureEvent(cid, "TaskLook")
    return true
end]]></event>
<talkaction words="/task;!task" event="buffer"><![CDATA[
domodlib('task_func')
param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
if isInArray({"counter","contador"},param) then
    setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
elseif isInArray({"daily","diaria"},param) then
    if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
        doPlayerSendCancel(cid, "Desculpe, Mas você não está em nenhuma Daily Task.") return true
    elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
        doPlayerSendCancel(cid,"Desculpe, Mas Você não terminou a Daily Task a tempo! Por favor volte ao npc e comece uma nova Daily Task!") return true
    end
    return doShowTextDialog(cid, 1961, "[->] CURRENT DAILY TASK INFO [<-]\n\nNome: "..daily_task[daily].name.."\nProgresso: ["..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[5])).."/"..daily_task[daily].count.."]\nPrazo para entrega: "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).."\nMonstros para caçar: "..getMonsterFromList(daily_task[daily].monsters_list).."\n\n[->] CURRENT TASK REWARDS [<-]\n\nMoney: "..(daily_task[daily].money > 0 and daily_task[daily].money or 0).."\nExperiencia: "..(daily_task[daily].exp > 0 and daily_task[daily].exp or 0).."\nTask Points: "..daily_task[daily].points.."\nItems: "..(#daily_task[daily].reward > 0 and getItemsFromList(daily_task[daily].reward) or "Nenhum item de recompensa")..".")
end
if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
    doPlayerSendCancel(cid, "Voce nao esta em nenhuma task.") return true
end
return doShowTextDialog(cid, 1961, "-> CURRENT TASK ["..getTaskMission(cid).."/"..#task_sys.."] <-\n\nTask Name: "..task_sys[task].name.."\nTask Level: "..task_sys[task].level.."\nTask Progress: ["..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[3])).."/"..task_sys[task].count.."]\nMonster To Hunt: "..getMonsterFromList(task_sys[task].monsters_list)..".\nItens Para Entrega: "..(#task_sys[task].items > 0 and getItemsFromList(task_sys[task].items) or "Nenhum")..".\n\n[->] CURRENT TASK REWARDS [<-]\n\nReward Money: "..(task_sys[task].money > 0 and task_sys[task].money or 0).."\nReward Experiencia: "..(task_sys[task].exp > 0 and task_sys[task].exp or 0).."\nReward Points: "..task_sys[task].points.."\nReward Items: "..(#task_sys[task].reward > 0 and getItemsFromList(task_sys[task].reward) or "Nenhum item de recompensa")..".")
]]></talkaction>
<event type="look" name="TaskLook" event="script"><![CDATA[
domodlib('task_func')
function onLook(cid, thing, position, lookDistance)
    if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
        doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").. " is a "..GetRankTask(thing.uid))
    end   
    return true
end]]></event>
<event type="kill" name="KillTask" event="script"><![CDATA[
domodlib('task_func')
function onKill(cid, target)
    if isPlayer(cid) and isMonster(target) then
        local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
        if t and getPlayerStorageValue(cid, t.start) > 0 and isInArray(t.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
            setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
            if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Task do " .. t.name .. ".")
            end
            if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] Parabens! Voce terminou a Task do "..t.name..", volte ao npc parece receber sua recompensa.")
            end
        end
        if daily and getPlayerStorageValue(cid, task_sys_storages[7]) > 0 and getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() >= 0 and isInArray(daily.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
            setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
            if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Daily Task System] defeated Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Task do " .. daily.name .. ".")
            end
            if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Daily Task System] Parabens! Voce terminou a Task do "..daily.name..", volte ao npc parece receber sua recompensa.")
            end
        end
    end
    return true
end]]></event>
</mod>
 
Last edited:
Solution
Solved with this page (works for any storage value, just change variable):

PHP:
<?PHP
$storage_number = 176602;

$values = $SQL->query("SELECT name, level, value FROM players, player_storage WHERE group_id < 3 AND players.id = player_storage.player_id AND player_storage.key = ".$storage_number." ORDER BY value DESC LIMIT 50");

$main_content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><CENTER><H2>Ranking for Task Points</H2></CENTER><BR>";
$main_content .= "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR='".$config['site']['vdarkborder']."'><TD WIDTH=10% CLASS=whites><B>Rank</B></TD><TD WIDTH=50% CLASS=whites><B>Name</B></TD><TD...
Solved with this page (works for any storage value, just change variable):

PHP:
<?PHP
$storage_number = 176602;

$values = $SQL->query("SELECT name, level, value FROM players, player_storage WHERE group_id < 3 AND players.id = player_storage.player_id AND player_storage.key = ".$storage_number." ORDER BY value DESC LIMIT 50");

$main_content .= "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%><TR><TD><CENTER><H2>Ranking for Task Points</H2></CENTER><BR>";
$main_content .= "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR='".$config['site']['vdarkborder']."'><TD WIDTH=10% CLASS=whites><B>Rank</B></TD><TD WIDTH=50% CLASS=whites><B>Name</B></TD><TD WIDTH=10% CLASS=whites><B>Level</B></TD><TD WIDTH=30% CLASS=whites><B>Task Points</B></TD>";
foreach($values as $value)
{
if(!is_int($number_of_rows /2))
{
    $bgcolor = $config["site"]["darkborder"];
}
else
{
    $bgcolor = $config["site"]["lightborder"];
}
$number_of_rows++;
$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>'.$number_of_rows.'</TD><TD><a href="?subtopic=characters&name='.urlencode($value["name"]).'">'.$value["name"].'</a></TD><TD>'.$value["level"].'</TD><TD>'.$value["value"].'</TD></TR>';
}
$main_content .= '</TABLE></TD><TD WIDTH=5%><IMG SRC="'.$layout_name.'/images/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD><TD WIDTH=15% VALIGN=top ALIGN=right><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD CLASS=whites><B>Choose a skill</B></TD></TR><TR BGCOLOR="'.$config['site']['lightborder'].'"><TD><A HREF="?subtopic=highscores&list=experience" CLASS="size_xs">Experience</A><BR><A HREF="?subtopic=highscores&list=magic" CLASS="size_xs">Magic</A><BR><A HREF="?subtopic=highscores&list=shield" CLASS="size_xs">Shielding</A><BR><A HREF="?subtopic=highscores&list=distance" CLASS="size_xs">Distance</A><BR><A HREF="?subtopic=highscores&list=club" CLASS="size_xs">Club</A><BR><A HREF="?subtopic=highscores&list=sword" CLASS="size_xs">Sword</A><BR><A HREF="?subtopic=highscores&list=axe" CLASS="size_xs">Axe</A><BR><A HREF="?subtopic=highscores&list=fist" CLASS="size_xs">Fist</A><BR><A HREF="?subtopic=highscores&list=fishing" CLASS="size_xs">Fishing</A><BR><A HREF="?subtopic=taskrank" CLASS="size_xs">Task Points</A><BR></TD></TR></TABLE></TD><TD><IMG SRC="'.$layout_name.'/images/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';

$main_content .= "</TR></TABLE>";

?>
 
Last edited:
Solution
Back
Top