Postado Agosto 26, 2015 9 anos Olá, venho trazer para vocês um sistema de Task que vi em um servidor e nunca tinha encontrado em nenhum lugar antes e achei bem interessante. Como funciona? Você completa a task, ganha direito matar o boss/exp/itens 'editavel' e ganha pontos para usar no Shopping do servidor. Bom, vamos ao sistema: Em data/globalevents/scripts crie um arquivo chamado shoptask.lua e adicione o code a seguir: -- ### CONFIG ### -- message send to player by script "type" (types you can check in "global.lua") SHOP_MSG_TYPE = 18 -- time (in seconds) between connections to SQL database by shop script SQL_interval = 30 -- ### END OF CONFIG ### function onThink(interval, lastExecution) local result_plr = db.storeQuery("SELECT * FROM z_ots_shoptaskcomunication") if(result_plr ~= false) then repeat local id = tonumber(result.getDataInt(result_plr, "id")) local action = tostring(result.getDataString(result_plr, "action")) local delete = tonumber(result.getDataInt(result_plr, "delete_it")) local cid = getPlayerByName(tostring(result.getDataString(result_plr, "name"))) if(cid) then local itemtogive_id = tonumber(result.getDataInt(result_plr, "param1")) local itemtogive_count = tonumber(result.getDataInt(result_plr, "param2")) local container_id = tonumber(result.getDataInt(result_plr, "param3")) local container_count = tonumber(result.getDataInt(result_plr, "param4")) local add_item_type = tostring(result.getDataString(result_plr, "param5")) local add_item_name = tostring(result.getDataString(result_plr, "param6")) local received_item = 0 local full_weight = 0 if(add_item_type == 'container') then container_weight = getItemWeight(container_id, 1) if(isItemRune(itemtogive_id)) then items_weight = container_count * getItemWeight(itemtogive_id, 1) else items_weight = container_count * getItemWeight(itemtogive_id, itemtogive_count) end full_weight = items_weight + container_weight else full_weight = getItemWeight(itemtogive_id, itemtogive_count) if(isItemRune(itemtogive_id)) then full_weight = getItemWeight(itemtogive_id, 1) else full_weight = getItemWeight(itemtogive_id, itemtogive_count) end end local free_cap = getPlayerFreeCap(cid) if(full_weight <= free_cap) then if(add_item_type == 'container') then local new_container = doCreateItemEx(container_id, 1) local iter = 0 while(iter ~= container_count) do doAddContainerItem(new_container, itemtogive_id, itemtogive_count) iter = iter + 1 end received_item = doPlayerAddItemEx(cid, new_container) else local new_item = doCreateItemEx(itemtogive_id, itemtogive_count) received_item = doPlayerAddItemEx(cid, new_item) end if(type(received_item) == "number" and received_item == RETURNVALUE_NOERROR) then doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.') db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") db.query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";") else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.') end else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.') end end until not result.next(result_plr) result.free(result_plr) end return true end Em data/globalevents/globalevents.xml adicione a seguinte tag: <globalevent name="Shop" interval="60000" script="shoptask.lua" /> Pronto. A parte do servidor ta safo, vamos adicionar a database os codigos a seguir: ALTER TABLE `accounts` ADD `task_points` INTEGER(11) NOT NULL DEFAULT 0; ALTER TABLE `accounts` ADD `task_points_stats` INT NOT NULL DEFAULT '0'; CREATE TABLE `z_shoptask_offer` ( `id` int(11) NOT NULL auto_increment, `points` int(11) NOT NULL default '0', `itemid1` int(11) NOT NULL default '0', `count1` int(11) NOT NULL default '0', `itemid2` int(11) NOT NULL default '0', `count2` int(11) NOT NULL default '0', `offer_type` varchar(255) default NULL, `offer_description` text NOT NULL, `offer_name` varchar(255) NOT NULL, `pid` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`)) CREATE TABLE `z_shoptask_history_item` ( `id` int(11) NOT NULL auto_increment, `to_name` varchar(255) NOT NULL default '0', `to_account` int(11) NOT NULL default '0', `from_nick` varchar(255) NOT NULL, `from_account` int(11) NOT NULL default '0', `price` int(11) NOT NULL default '0', `offer_id` int(11) NOT NULL default '0', `trans_state` varchar(255) NOT NULL, `trans_start` int(11) NOT NULL default '0', `trans_real` int(11) NOT NULL default '0', PRIMARY KEY (`id`)) CREATE TABLE `z_shoptask_history_pacc` ( `id` int(11) NOT NULL auto_increment, `to_name` varchar(255) NOT NULL default '0', `to_account` int(11) NOT NULL default '0', `from_nick` varchar(255) NOT NULL, `from_account` int(11) NOT NULL default '0', `price` int(11) NOT NULL default '0', `pacc_days` int(11) NOT NULL default '0', `trans_state` varchar(255) NOT NULL, `trans_start` int(11) NOT NULL default '0', `trans_real` int(11) NOT NULL default '0', PRIMARY KEY (`id`)) CREATE TABLE IF NOT EXISTS `z_ots_shoptaskcomunication` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `action` varchar(255) NOT NULL, `param1` varchar(255) NOT NULL, `param2` varchar(255) NOT NULL, `param3` varchar(255) NOT NULL, `param4` varchar(255) NOT NULL, `param5` varchar(255) NOT NULL, `param6` varchar(255) NOT NULL, `param7` varchar(255) NOT NULL, `delete_it` int(2) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13107; Pronto, terminamos quase tudo né? Servidor, Database.. Falta Web. Irei deixar a vocês uma php pronto para download, mas se vocês quiserem usar o de vocês basta trocar. shop_system para shoptask_systempremium_points para shoptask_points premium points para shoptask pointsz_shop_offer para z_shoptask_offershopsystem para shoptaskz_shop_history_pacc para z_shoptask_history_paccz_shop_history_item para z_shoptask_history_item z_ots_comunication para z_ots_shoptaskcomunication shoptask.php Agora é só adicionar no seu layout. Vá em layouts.php adicione abaixo de buypoints: <a href='?subtopic=shoptask'> <div id='submenu_shoptask' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)'onMouseOut='MouseOutSubmenuItem(this)'> <div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div> <div id='ActiveSubmenuItemIcon_shoptask' class='ActiveSubmenuItemIcon'style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div> <div class='SubmenuitemLabel'>Shop Task</div> <div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div> </div> </a> Bem é isso, é meio similar ao Guild Shop, porém ele usa o sistema de task. Então vamos ao sistema. Vamos em data/creaturescript/creaturescript.xml e adicione as seguintes Tags; <event type="modalwindow" name="taskw" script="task_window.lua"/> <event type="kill" name="KillingInTheNameOf" script="task.lua"/> Em seguida vá em scripts e adicione. Crie um task.lua e adicione. local questCreatures = { ["troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15000, killsRequired = 100, raceName = "Trolls"}, ["frost troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15001, killsRequired = 100, raceName = "Trolls"}, ["furious troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15002, killsRequired = 100, raceName = "Trolls"}, ["island troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15003, killsRequired = 100, raceName = "Trolls"}, ["swamp troll"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15004, killsRequired = 100, raceName = "Trolls"}, ["troll champion"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15005, killsRequired = 100, raceName = "Trolls"}, ["troll legionnaire"] = {questStarted = 65000, questStorage = 65100, creatureStorage = 15006, killsRequired = 100, raceName = "Trolls"}, ["goblin"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15007, killsRequired = 5, raceName = "Goblins"}, ["goblin assassin"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15008, killsRequired = 5, raceName = "Goblins"}, ["goblin leader"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15009, killsRequired = 5, raceName = "Goblins"}, ["goblin scavenger"] = {questStarted = 65001, questStorage = 65101, creatureStorage = 15010, killsRequired = 5, raceName = "Goblins"}, ["rotworm"] = {questStarted = 65002, questStorage = 65102, creatureStorage = 15011, killsRequired = 300, raceName = "Rotworms"}, ["carriom worm"] = {questStarted = 65002, questStorage = 65102, creatureStorage = 15012, killsRequired = 300, raceName = "Rotworms"}, ["cyclops"] = {questStarted = 65003, questStorage = 65103, creatureStorage = 15013, killsRequired = 500, raceName = "Cyclops"}, ["cyclops smith"] = {questStarted = 65003, questStorage = 65103, creatureStorage = 15014, killsRequired = 500, raceName = "Cyclops"}, ["cyclops drone"] = {questStarted = 65003, questStorage = 65103, creatureStorage = 15015, killsRequired = 500, raceName = "Cyclops"}, ["crocodile"] = {questStarted = 14007, questStorage = 14107, creatureStorage = 15016, killsRequired = 300, raceName = "Crocodiles"}, ["tarantula"] = {questStarted = 14008, questStorage = 14108, creatureStorage = 15017, killsRequired = 300, raceName = "Tarantulas"}, ["carniphila"] = {questStarted = 14009, questStorage = 14109, creatureStorage = 15018, killsRequired = 150, raceName = "Carniphilas"}, ["stone golem"] = {questStarted = 14010, questStorage = 14110, creatureStorage = 15019, killsRequired = 200, raceName = "Stone Golems"}, ["mammoth"] = {questStarted = 14011, questStorage = 14111, creatureStorage = 15020, killsRequired = 300, raceName = "Mammoths"}, ["ice golem"] = {questStarted = 14012, questStorage = 14112, creatureStorage = 15021, killsRequired = 300, raceName = "Ice Golems"}, ["quara predator scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15022, killsRequired = 300, raceName = "Quaras Scout"}, ["quara constrictor scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15023, killsRequired = 300, raceName = "Quaras Scout"}, ["quara hydromancer scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15024, killsRequired = 300, raceName = "Quaras Scout"}, ["quara mantassin scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15025, killsRequired = 300, raceName = "Quaras Scout"}, ["quara pincher scout"] = {questStarted = 14013, questStorage = 14113, creatureStorage = 15026, killsRequired = 300, raceName = "Quaras Scout"}, ["quara predator"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15027, killsRequired = 300, raceName = "Quaras"}, ["quara constrictor"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15028, killsRequired = 300, raceName = "Quaras"}, ["quara hydromancer"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15029, killsRequired = 300, raceName = "Quaras"}, ["quara mantassin"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15030, killsRequired = 300, raceName = "Quaras"}, ["quara pincher"] = {questStarted = 14014, questStorage = 14114, creatureStorage = 15031, killsRequired = 300, raceName = "Quaras"}, ["water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15032, killsRequired = 70, raceName = "Water Elementals"}, ["roaring water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15033, killsRequired = 70, raceName = "Water Elementals"}, ["slick water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15034, killsRequired = 70, raceName = "Water Elementals"}, ["massive water elemental"] = {questStarted = 14015, questStorage = 14115, creatureStorage = 15035, killsRequired = 70, raceName = "Water Elementals"}, ["earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15036, killsRequired = 70, raceName = "Earth Elementals"}, ["jagged earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15037, killsRequired = 70, raceName = "Earth Elementals"}, ["massive earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15038, killsRequired = 70, raceName = "Earth Elementals"}, ["muddy earth elemental"] = {questStarted = 14016, questStorage = 14116, creatureStorage = 15039, killsRequired = 70, raceName = "Earth Elementals"}, ["energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15040, killsRequired = 70, raceName = "Energy Elementals"}, ["charged energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15041, killsRequired = 70, raceName = "Energy Elementals"}, ["massive energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15042, killsRequired = 70, raceName = "Energy Elementals"}, ["overcharged energy elemental"] = {questStarted = 14017, questStorage = 14117, creatureStorage = 15043, killsRequired = 70, raceName = "Energy Elementals"}, ["fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15044, killsRequired = 70, raceName = "Fire Elementals"}, ["blazing fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15045, killsRequired = 70, raceName = "Fire Elementals"}, ["blistering fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15046, killsRequired = 70, raceName = "Fire Elementals"}, ["massive fire elemental"] = {questStarted = 14018, questStorage = 14118, creatureStorage = 15047, killsRequired = 70, raceName = "Fire Elementals"}, ["mutated rat"] = {questStarted = 14019, questStorage = 14119, creatureStorage = 15048, killsRequired = 200, raceName = "Mutated Rats"}, ["giant spider"] = {questStarted = 14020, questStorage = 14120, creatureStorage = 15049, killsRequired = 500, raceName = "Giant Spiders"}, ["hydra"] = {questStarted = 14021, questStorage = 14121, creatureStorage = 15050, killsRequired = 500, raceName = "Hydras"}, ["sea serpent"] = {questStarted = 14001, questStorage = 14101, creatureStorage = 15051, killsRequired = 500, raceName = "Sea Serpents"}, ["behemoth"] = {questStarted = 14022, questStorage = 14122, creatureStorage = 15052, killsRequired = 500, raceName = "Behemoths"}, ["serpent spawn"] = {questStarted = 14002, questStorage = 14102, creatureStorage = 15053, killsRequired = 375, raceName = "Serpents Spawn"}, ["green djinn"] = {questStarted = 65022, questStorage = 65122, creatureStorage = 15054, killsRequired = 125, raceName = "Green Djinns"}, ["efreet"] = {questStarted = 65022, questStorage = 65122, creatureStorage = 15055, killsRequired = 125, raceName = "Green Djinns"}, ["blue djinn"] = {questStarted = 65023, questStorage = 65123, creatureStorage = 15056, killsRequired = 125, raceName = "Blue Djinns"}, ["marid"] = {questStarted = 65023, questStorage = 65123, creatureStorage = 15057, killsRequired = 125, raceName = "Blue Djinns"}, ["pirate buccaneer"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15058, killsRequired = 300, raceName = "Pirates"}, ["pirate corsair"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15059, killsRequired = 300, raceName = "Pirates"}, ["pirate cutthroat"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15060, killsRequired = 300, raceName = "Pirates"}, ["pirate ghost"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15061, killsRequired = 300, raceName = "Pirates"}, ["pirate marauder"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15062, killsRequired = 300, raceName = "Pirates"}, ["pirate skeleton"] = {questStarted = 65024, questStorage = 65124, creatureStorage = 15063, killsRequired = 300, raceName = "Pirates"}, ["minotaur"] = {questStarted = 14004, questStorage = 14104, creatureStorage = 15070, killsRequired = 500, raceName = "Minotaurs"}, ["necromancer"] = {questStarted = 14003, questStorage = 14103, creatureStorage = 15071, killsRequired = 1000, raceName = "Magicians"}, ["priestess"] = {questStarted = 14003, questStorage = 14103, creatureStorage = 15072, killsRequired = 1000, raceName = "Magicians"}, ["dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15065, killsRequired = 500, raceName = "Dragons"}, ["dragon lord"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15066, killsRequired = 500, raceName = "Dragons"}, ["frost dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15067, killsRequired = 500, raceName = "Dragons"}, ["ghastly dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15068, killsRequired = 500, raceName = "Dragons"}, ["undead dragon"] = {questStarted = 65030, questStorage = 65130, creatureStorage = 15069, killsRequired = 500, raceName = "Dragons"}, ["demon"] = {questStarted = 14023, questStorage = 14123, creatureStorage = 15075, killsRequired = 6666, raceName = "Demons"} } local msgType = MESSAGE_STATUS_CONSOLE_ORANGE function onKill(cid, target, lastHit) local creature = questCreatures[getCreatureName(target):lower()] if creature then if isPlayer(target) then return true end if getCreatureStorage(cid, creature.questStarted) > 0 then if getCreatureStorage(cid, creature.questStorage) < creature.killsRequired then if getCreatureStorage(cid, creature.questStorage) < 0 then doCreatureSetStorage(cid, creature.questStorage, 0) end if (not isSummon(target)) then if getCreatureStorage(cid, creature.creatureStorage) < 0 then doCreatureSetStorage(cid, creature.creatureStorage, 0) end doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1) doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1) doPlayerSendTextMessage(cid, msgType, "[Mission]: " .. getCreatureStorage(cid,creature.questStorage) .. "/" .. creature.killsRequired .. " " .. creature.raceName .. " defeated.") end end end end return true end depois task_window e adicione; function onModalWindow(cid, modalWindowId, buttonId, choiceId) if modalWindowId ~= 1900 then return false end local rank = getCreatureStorage(cid, rankStorage) if rank < 0 then doCreatureSetStorage(cid, rankStorage, 0) end local r_string = function() if tasks[choiceId].repeatable then return "repeatable" end return "not repeatable" end local r_article_string = function (id, amount) task_item_word = "" if amount > 1 then task_item_word = task_item_word .. amount .. "x " .. getItemName(id) else if ItemType(itemId):getArticle() == "" then task_item_word = task_item_word .. getItemName(id) else task_item_word = task_item_word .. ItemType(itemId):getArticle() .. " " .. getItemName(id) end end return task_item_word end local storage_string = {[80000] = "The Snapper", [80001] = "Demodras", [80002] = "The Hide", [80003] = "The Bloodtusk", [80004] = "The Shardhead", [80005] = "Thul", [80006] = "Esmeralda", [80007] = "The Old Widow", [80008] = "The Many", [80009] = "The Leviathan", [80010] = "The Stonecracker", [80011] = "The Noxious Spawn", [80012] = "Merikh The Slaughterer", [80013] = "Fahim The Wise", [80014] = "pirate leader", [80015] = "The Horned Fox", [80016] = "Necropharus" } if buttonId == 1 then -- confirm task if getCreatureStorage(cid, tasks[choiceId].questStarted) < 1 then doCreatureSetStorage(cid, tasks[choiceId].questStarted, 1) doCreatureSetStorage(cid, tasks[choiceId].questStorage, 0) doCreatureSay(taskNPCuid, "In this mission you have to hunt " .. tasks[choiceId].killsRequired .. " " .. tasks[choiceId].raceName .. " down. Good luck!", TALKTYPE_PRIVATE_NP, false, cid, getThingPos(taskNPCuid)) else if getCreatureStorage(cid, tasks[choiceId].questStarted) == 1 then if tasks[choiceId].killsRequired > getCreatureStorage(cid, tasks[choiceId].questStorage) then doPlayerPopupFYI(cid,"Status: Active\nKills: " .. getCreatureStorage(cid, tasks[choiceId].questStorage) .. "/" .. tasks[choiceId].killsRequired .. " (" .. tasks[choiceId].killsRequired - getCreatureStorage(cid, tasks[choiceId].questStorage) .. " left)\n\nThis mission is " .. r_string() .. ".") sendTaskWindow(cid) else doCreatureSetStorage(cid, tasks[choiceId].questStarted, 2) task_reward_str = "Reward(s):\n" for i = 1, table.maxn(tasks[choiceId].rewards) do if(tasks[choiceId].rewards[i].enable) then if isInArray({"boss", "teleport", 1}, tasks[choiceId].rewards[i].type) then doTeleportThing(cid, tasks[choiceId].rewards[i].values) task_reward_str = task_reward_str .. "You have been teleported.\n" elseif isInArray({"exp", "experience", 2}, tasks[choiceId].rewards[i].type) then doPlayerAddExperience(cid, tasks[choiceId].rewards[i].values) task_reward_str = task_reward_str .. "+ " .. tasks[choiceId].rewards[i].values .. " exp\n" elseif isInArray({"item", 3}, tasks[choiceId].rewards[i].type) then doPlayerAddItem(cid, tasks[choiceId].rewards[i].values[1], tasks[choiceId].rewards[i].values[2]) task_reward_str = task_reward_str .. r_article_string(tasks[choiceId].rewards[i].values[1], tasks[choiceId].rewards[i].values[2]) .. "\n" elseif isInArray({"money", 4}, tasks[choiceId].rewards[i].type) then doPlayerAddMoney(cid, tasks[choiceId].rewards[i].values) task_reward_str = task_reward_str .. "+ " .. tasks[choiceId].rewards[i].values .. " gp\n" elseif isInArray({"storage", "stor", 5}, tasks[choiceId].rewards[i].type) then doCreatureSetStorage(cid, tasks[choiceId].rewards[i].values[1], tasks[choiceId].rewards[i].values[2]) task_reward_str = task_reward_str .. "Chance to duel " .. storage_string[tasks[choiceId].rewards[i].values[1]] .. ".\n" elseif isInArray({"points", "rank", 2}, tasks[choiceId].rewards[i].type) then db.query("UPDATE `accounts` SET `task_points` = `task_points` + " .. tasks[choiceId].rewards[i].values .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks[choiceId].rewards[i].values) task_reward_str = task_reward_str .. "+ " .. tasks[choiceId].rewards[i].values .. " rank points.\n" else print("[Warning - Npc::KillingInTheNameOf] Wrong reward type: " .. (tasks[choiceId].rewards[i].type or "nil") .. ", reward could not be loaded.") end end end if task_reward_str == "Reward(s):\n" then doPlayerPopupFYI(cid,task_reward_str .. "none") else doPlayerPopupFYI(cid,task_reward_str) end doCreatureSay(taskNPCuid, "Great job" .. (((rank > 4 and rank < 10) and (", Huntsman") or (rank > 9 and rank < 20) and (", Ranger") or (rank > 19 and rank < 30) and (", Big Game Hunter") or (rank > 29 and rank < 50) and (", Trophy Hunter") or (rank > 49) and (", Elite Hunter")) or ", my Beginner") .. "! Here is your reward. Keep hunting and good luck!", TALKTYPE_PRIVATE_NP, false, cid, getThingPos(taskNPCuid)) end else if tasks[choiceId].repeatable then for i = 1, table.maxn(tasks[choiceId].rewards) do if isInArray({"storage", "stor", 5}, tasks[choiceId].rewards[i].type) then doPlayerPopupFYI(cid,"To repeat this mission again, fight with " .. storage_string[tasks[choiceId].rewards[i].values[1]] .. " first.") break end if i == table.maxn(tasks[choiceId].rewards) then doPlayerPopupFYI(cid,"You can't repeat this mission.") end end else doPlayerPopupFYI(cid,"You can't repeat this mission.") end sendTaskWindow(cid) end end elseif buttonId == 255 then doPlayerPopupFYI(cid,"Please use a button.") sendTaskWindow(cid) end return true end Agora vamos até data\lib e crie e adicione; rankStorage = 32150 THESNAPPER = {80000, 1} DEMODRAS = {80001, 1} HIDE = {80002, 1} THEBLOODTUSK = {80003, 1} SHARDHEAD = {80004, 1} THUL = {80005, 1} ESMERALDA = {80006, 1} THEOLDWIDOW = {80007, 1} THEMANY = {80008, 1} LEVIATHAN = {80009, 1} STONECRACKER = {80010, 1} THENOXIUSSPAWN = {80011, 1} MERIKHTHESLAUGHTERER = {80012, 1} FAHIMTHEWISE = {80013, 1} RANDOMPIRATEBOSS = {80014, 1} THEHORNEDFOX = {80015, 1} NECROPHARUS = {80016, 1} tasks = { [1] = {questStarted = 65000, questStorage = 65100, killsRequired = 100, raceName = "Trolls", repeatable = false, rewards = {{enable = true, type = "exp", values = 40000}, {enable = true, type = "money", values = 4000}}}, [2] = {questStarted = 65001, questStorage = 65101, killsRequired = 150, raceName = "Goblins", repeatable = false, rewards = {{enable = true, type = "exp", values = 70000}, {enable = true, type = "money", values = 5000}}}, [3] = {questStarted = 65002, questStorage = 65102, killsRequired = 300, raceName = "Rotworms", repeatable = false, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "money", values = 6000}}}, [4] = {questStarted = 65003, questStorage = 65103, killsRequired = 500, raceName = "Cyclops", repeatable = false, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "money", values = 8000}}}, [5] = {questStarted = 14007, questStorage = 14107, killsRequired = 300, raceName = "Crocodiles", repeatable = true, rewards = {{enable = true, type = "exp", values = 100000}, {enable = true, type = "storage", values = THESNAPPER}, {enable = true, type = "points", values = 2}}}, [6] = {questStarted = 14008, questStorage = 14108, killsRequired = 300, raceName = "Tarantulas", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = HIDE}, {enable = true, type = "points", values = 2}}}, [7] = {questStarted = 14009, questStorage = 14109, killsRequired = 150, raceName = "Carniphilas", repeatable = false, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 15000}}}, [8] = {questStarted = 14010, questStorage = 14110, killsRequired = 200, raceName = "Stone Golems", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 15000}}}, [9] = {questStarted = 14011, questStorage = 14111, killsRequired = 300, raceName = "Mammoths", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = THEBLOODTUSK}, {enable = true, type = "points", values = 2}}}, [10] = {questStarted = 14012, questStorage = 14112, killsRequired = 300, raceName = "Ice Golems", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = SHARDHEAD}, {enable = true, type = "points", values = 2}}}, [11] = {questStarted = 14013, questStorage = 14113, killsRequired = 300, raceName = "Quaras Scout", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "money", values = 25000}}}, [12] = {questStarted = 14014, questStorage = 14114, killsRequired = 300, raceName = "Quaras", repeatable = true, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "storage", values = THUL}, {enable = true, type = "points", values = 2}}}, [13] = {questStarted = 14015, questStorage = 14115, killsRequired = 70, raceName = "Water Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}}, [14] = {questStarted = 14016, questStorage = 14116, killsRequired = 70, raceName = "Earth Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}}, [15] = {questStarted = 14017, questStorage = 14117, killsRequired = 70, raceName = "Energy Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}}, [16] = {questStarted = 14018, questStorage = 14118, killsRequired = 70, raceName = "Fire Elementals", repeatable = false, rewards = {{enable = true, type = "exp", values = 200000}, {enable = true, type = "money", values = 20000}}}, [17] = {questStarted = 14019, questStorage = 14119, killsRequired = 200, raceName = "Mutated Rats", repeatable = true, rewards = {{enable = true, type = "exp", values = 150000}, {enable = true, type = "storage", values = ESMERALDA}, {enable = true, type = "points", values = 2}}}, [18] = {questStarted = 14020, questStorage = 14120, killsRequired = 500, raceName = "Giant Spiders", repeatable = true, rewards = {{enable = true, type = "exp", values = 250000}, {enable = true, type = "storage", values = THEOLDWIDOW}, {enable = true, type = "points", values = 2}}}, [19] = {questStarted = 14021, questStorage = 14121, killsRequired = 500, raceName = "Hydras", repeatable = true, rewards = {{enable = true, type = "storage", values = THEMANY}, {enable = true, type = "points", values = 4}}}, [20] = {questStarted = 14001, questStorage = 14101, killsRequired = 500, raceName = "Sea Serpents", repeatable = true, rewards = {{enable = true, type = "storage", values = LEVIATHAN}, {enable = true, type = "points", values = 4}}}, [21] = {questStarted = 14022, questStorage = 14122, killsRequired = 500, raceName = "Behemoths", repeatable = true, rewards = {{enable = true, type = "storage", values = STONECRACKER}, {enable = true, type = "points", values = 4}}}, [22] = {questStarted = 14002, questStorage = 14102, killsRequired = 375, raceName = "Serpents Spawn", repeatable = true, rewards = {{enable = true, type = "storage", values = THENOXIOUSSPAWN}, {enable = true, type = "points", values = 4}}}, [23] = {questStarted = 65022, questStorage = 65122, killsRequired = 125, raceName = "Green Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = MERIKHTHESLAUGHTERER}}}, [24] = {questStarted = 65023, questStorage = 65123, killsRequired = 125, raceName = "Blue Djinns", repeatable = true, rewards = {{enable = true, type = "exp", values = 230000}, {enable = true, type = "money", values = 5000}, {enable = true, type = "storage", values = FAHIMTHEWISE}}}, [25] = {questStarted = 65024, questStorage = 65124, killsRequired = 300, raceName = "Pirates", repeatable = false, rewards = {{enable = true, type = "exp", values = 300000}, {enable = true, type = "money", values = 40000}, {enable = true, type = "storage", values = RANDOMPIRATEBOSS}}}, [26] = {questStarted = 14004, questStorage = 14104, killsRequired = 500, raceName = "Minotaurs", repeatable = false, rewards = {{enable = true, type = "storage", values = THEHORNEDFOX}}}, [27] = {questStarted = 14003, questStorage = 14103, killsRequired = 1000, raceName = "Magicians", repeatable = false, rewards = {{enable = true, type = "storage", values = NECROPHARUS}}}, [28] = {questStarted = 65030, questStorage = 65130, killsRequired = 500, raceName = "Dragons", repeatable = true, rewards = {{enable = true, type = "storage", values = DEMODRAS}, {enable = true, type = "exp", values = 400000}}}, [29] = {questStarted = 14023, questStorage = 14123, killsRequired = 6666, raceName = "Demons", repeatable = false, rewards = {{enable = true, type = "exp", values = 1000000}, {enable = true, type = "item", values = {10305,1}}}}} function getTasksStarted(cid) local tmp = {} for k, v in pairs(tasks) do if getCreatureStorage(cid, v.questStarted) == 1 then table.insert(tmp, k) end end return tmp end function getTaskByName(name) for k, v in pairs(tasks) do if v.raceName:lower() == name:lower() then return k end end return false end function sendTaskWindow(cid) taskWindow = ModalWindow(1900, "Mission Management", "Select a task:") local task_status = {} if taskWindow:getId() == 1900 then taskWindow:addButton(1, "Select") taskWindow:setDefaultEnterButton(1) taskWindow:addButton(2, "Cancel") taskWindow:setDefaultEscapeButton(2) for i = 1, #tasks do if getCreatureStorage(cid, tasks[i].questStarted) == 2 then task_status[i] = "[completed]" else if getCreatureStorage(cid, tasks[i].questStarted) == 1 then task_status[i] = "[" .. getCreatureStorage(cid, tasks[i].questStorage) .. "/" .. tasks[i].killsRequired .. "]" else if getCreatureStorage(cid, tasks[i].questStarted) < 1 then task_status[i] = tasks[i].killsRequired else task_status[i] = tasks[i].killsRequired .. " [unknown]" end end end if getCreatureStorage(cid, tasks[i].questStarted) == 1 and getCreatureStorage(cid, tasks[i].questStorage) >= tasks[i].killsRequired then taskWindow:addChoice(i, tasks[i].raceName .. " [click for reward]") else taskWindow:addChoice(i, tasks[i].raceName .. ", " .. task_status[i]) end end end taskWindow:sendToPlayer(cid) return true end Agora vamos até data\npc crie Victor.xml e adicione <?xml version="1.0" encoding="UTF-8"?> <npc name="Victor" script="Victor.lua" walkinterval="2000" floorchange="0"> <health now="150" max="150" /> <look type="131" head="76" body="20" legs="116" feet="1" addons="1" /> <parameters> <parameter key="message_greet" value="Ola, eu posso te ajudar com algumas missões, e como recompensa te darei exp e direito a matar alguns bosses diga {task}"/> </parameters> </npc> agora vamos até scripts crie Victor.lua e adicione local choose = {} local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid if isInArray({"task", "tasks"}, msg:lower()) then selfSay("Here.", cid) taskNPCuid = getNpcCid() if getPlayerStorageValue(cid, 32150) < 0 then setPlayerStorageValue(cid, 32150, 0) end return sendTaskWindow(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Caso vocês queiram adicionar a recompensa no próprio sistema de task de vocês basta adicionar na recompensa a seguinte query. db.query("UPDATE `accounts` SET `task_points` = `task_points` + " .. tasks[choiceId].rewards[i].values .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") Pronto, terminamos. Créditos: Jobs. Tópico exclusivo para o TK. Editado Agosto 26, 2015 9 anos por Jobs (veja o histórico de edições)
Postado Agosto 26, 2015 9 anos Em nome da comunidade do TK, muito obrigado pela contribuição! Seu tópico de conteúdo foi aprovado e será movido para a seção adequada. Você ganhou 1 REP+!
Postado Setembro 25, 2015 9 anos Onde realizo esse passo ? shop_system para shoptask_system premium_points para shoptask_points premium points para shoptask points z_shop_offer para z_shoptask_offer shopsystem para shoptask z_shop_history_pacc para z_shoptask_history_pacc z_shop_history_item para z_shoptask_history_item z_ots_comunication para z_ots_shoptaskcomunication Editado Setembro 26, 2015 9 anos por Nuzzy (veja o histórico de edições)
Postado Setembro 28, 2015 9 anos quando entro no sie apareçe isso: Shop is currently closed. [to admin: edit it in 'config/config.php']
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.