Ir para conteúdo

Thiago Virtuoso

Membro
  • Registro em

  • Última visita

  1. Thiago Virtuoso alterou sua foto pessoal
  2. ------------------------------------------------------ -- Script by: Lwkass -- Mod: Vittu -- Version: 2.0 -- Tested in: TFS 0.4 --------------------------- -- Configurations -- --------------------------- local STORAGE_SKILL_LEVEL = 10002 local STORAGE_SKILL_TRY = 10003 local config = { levels = { {level = {0,9}, quant = {1,2}, percent = 5}, {level = {10,19}, quant = {2,4}, percent = 10}, {level = {20,29}, quant = {3,6}, percent = 15}, {level = {30,39}, quant = {4,8}, percent = 20}, {level = {40,49}, quant = {5,10}, percent = 25}, {level = {50,59}, quant = {6,12}, percent = 30}, {level = {60,69}, quant = {7,14}, percent = 30}, {level = {70,79}, quant = {8,16}, percent = 35}, {level = {80,89}, quant = {9,18}, percent = 35}, {level = {90,99}, quant = {10,20}, percent = 40}, {level = {100}, quant = {11,22}, percent = 50} }, rocks = {1356, 1285, 3607, 3616}, -- Id das rochas que podem ser quebradas stones = {}, -- Modelo = {rock_id, rock_id} default_stone = 2157, -- pedra padrão rock_delay = 480, -- Tempo de volta da rocha (Em segundos) bonus_chance = 3, -- Chance (em porcentagem) de se conseguir um bonus de exp bonus_exp = 1 -- Bonus extra } ------------------------------------ -- END Configurations --- ------------------------------------ function getMiningLevel(cid) return getPlayerStorageValue(cid, STORAGE_SKILL_LEVEL) end function setPlayerMiningLevel(cid, n) setPlayerStorageValue(cid, STORAGE_SKILL_LEVEL, n) end function addMiningLevel(cid, n) setPlayerMiningLevel(cid, getMiningLevel(cid) + (isNumber(n) and n or 1)) setMiningTry(cid, 0) end function getMiningInfo(cid) for i = 1, #config.levels do min = config.levels.level[1]; max = config.levels.level[2] if (getMiningLevel(cid) >= min and getMiningLevel(cid) <= max) then return {quantity = {min = config.levels.quant[1], max = config.levels.quant[2]}, chance = config.levels.percent} end end end function getStoneByRock(rockid) for i = 1, #config.stones do if (config.stones[2] == rockid) then return config.stones[1] end end return config.default_stone end function getMiningTries(cid) return getPlayerStorageValue(cid, STORAGE_SKILL_TRY) end function setMiningTry(cid, n) setPlayerStorageValue(cid, STORAGE_SKILL_TRY, n) end function addMiningTry(cid, bonus) setMiningTry(cid, getMiningTries(cid) + 1 + (bonus and config.bonus_exp or 0)) if (getMiningTries(cid) >= getMiningExpTo(getMiningLevel(cid))) then -- Up doPlayerSendTextMessage(cid, 22, "You advanced from level " .. getMiningLevel(cid) .. " to level ".. (getMiningLevel(cid) + 1) .." in mining.") if ((getMiningLevel(cid)+1) == getMiningMaxLevel()) then doPlayerSendTextMessage(cid, 22, "Max level reached in mining.") end addMiningLevel(cid) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) setMiningTry(cid, 0) end end function getMiningExpTo(level) return ((level*1.5)+((level+1)*7)) end function getMiningMaxLevel() return config.levels[#config.levels].level[#config.levels[#config.levels].level] end --------------------------- function onUse(cid, item, fromPosition, itemEx, toPosition) rock = { id = itemEx.itemid, uid = itemEx.uid, position = toPosition } player = { position = getCreaturePosition(cid) } if (getMiningLevel(cid) < 0) then setPlayerMiningLevel(cid, 0) end if (isInArray(config.rocks, rock.id)) then addMiningTry(cid) if (math.random(1,100) <= getMiningInfo(cid).chance) then local collected = math.random(getMiningInfo(cid).quantity.min, getMiningInfo(cid).quantity.max) doPlayerAddItem(cid, getStoneByRock(rock.id), collected) doPlayerSendTextMessage(cid, 22, "You got " .. collected .. " gold" .. (collected > 1 and "s" or "") .. " nuggets.") if (math.random(1,100) <= config.bonus_chance) then -- Bonus calc addMiningTry(cid, true) doCreatureSay(player.position, "Bonus!", COLOR_ORANGE) end event_rockCut(rock) else if (math.random(1,100) <= (10-getMiningInfo(cid).chance/10)) then doPlayerSendTextMessage(cid, 22, "You got nothing.") event_rockCut(rock) else doSendMagicEffect(rock.position, 3) doCreatureSay(rock.position, "Poff!", COLOR_GREEN) end end else doPlayerSendCancel(cid, "This can't be cut.") end end function event_rockCut(rock) addEvent(event_rockGrow, config.rock_delay * 1000, rock.position, rock.id) doTransformItem(rock.uid, 3610) doSendMagicEffect(rock.position, 3) doCreatureSay(rock.position, "Tack!", COLOR_GREEN) doItemSetAttribute(rock.uid, "name", "A trunk of " .. getItemName(rock.id)) end function event_rockGrow(rockPos, old_id) local rock = getThingfromPos(rockPos).uid doTransformItem(rock, old_id) doItemSetAttribute(rock, "name", getItemName(old_id)) doSendMagicEffect(rockPos, 3) end --Lumberjack 2.0 by: Lwkass tente isso
  3. helix758 reagiu a uma resposta no tópico: Ajuda com !frags comando no default
  4. local config = { useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')), } function onSay(cid, words, param, channel) if(not config.useFragHandler) then return false end local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = { name = result:getDataString("name"), level = result:getDataInt("level"), date = result:getDataInt("date") } if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = { day = table.maxn(contents.day), week = table.maxn(contents.week), month = table.maxn(contents.month) } doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.") if(size.day > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").") end local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)) end return true end testa assim, não testei aqui
  5. helix758 reagiu a uma resposta no tópico: Ajuda com !frags comando no default
  6. local config = { useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')), advancedFragList = getBooleanFromString(getConfigValue('advancedFragList')) } function onSay(cid, words, param, channel) if(not config.useFragHandler) then return false end local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = { name = result:getDataString("name"), level = result:getDataInt("level"), date = result:getDataInt("date") } if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = { day = table.maxn(contents.day), week = table.maxn(contents.week), month = table.maxn(contents.month) } if(config.advancedFragList) then local result = "Frags gained today: " .. size.day .. "." if(size.day > 0) then for _, content in ipairs(contents.day) do result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level end result = result .. "\n" end result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "." if(size.week > 0) then for _, content in ipairs(contents.week) do result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level end result = result .. "\n" end result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "." if(size.month > 0) then for _, content in ipairs(contents.month) do result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level end result = result .. "\n" end local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, result) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.") if(size.day > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").") end local skullEnd = getPlayerSkullEnd(cid) if(skullEnd > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)) end end return true end Tente isso
  7. Tente assim.. Não tive tempo de testar ;-; local config = { level = 2 } local SKINS = { -- Minotaurs [2830] = {25000, 5878}, [2871] = {25000, 5878}, [2866] = {25000, 5878}, [2876] = {25000, 5878}, [3090] = {25000, 5878}, [11133] = {25000, 11130}, -- Lizards [4259] = {25000, 5876}, [4262] = {25000, 5876}, [4256] = {25000, 5876}, [11271] = {25000, 5876}, [11275] = {25000, 5876}, [11267] = {25000, 5876}, [11279] = {25000, 5876}, [11263] = {25000, 5876}, -- Dragons [3104] = {25000, 5877}, [2844] = {25000, 5877}, -- Dragon Lords [2881] = {25000, 5948}, -- Behemoths [2931] = {25000, 5893}, -- Bone Beasts [3031] = {25000, 5925}, } local breakChance = 60 local rustyItems = { [7441] = {7442}, --head [7442] = {7444}, --tusk [7444] = {7445}, --mammoth [7445] = {7446}, --done [11337] = {11338}, -- 1 [11338] = {11339}, -- 2 [11339] = {11340}, -- 3 } function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerLevel(cid) < config.level) then doPlayerSendCancel(cid, "You have to be at least Level " .. config.level .. " to use this tool.") return true end if itemEx.itemid == 9010 then if getPlayerStorageValue(cid, 65049) <= 0 then doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN) doPlayerAddItem(cid, 8310, 1) setPlayerStorageValue(cid, 65049, 1) else doCreatureSayWithRadius(cid, "You already used your knife on the corpse.", TALKTYPE_ORANGE_1, 1, 1) end return TRUE end if itemEx.uid == 1705 then if (getPlayerStorageValue(cid, 300017) <= 0) and (getPlayerItemCount(cid, 12616) >= 1) then doSendMagicEffect(toPosition, CONST_ME_HITBYPOISON) doCreatureSay(cid, "The plant feels cold but dry and very soft. You streak the plant gently with your knife and put a fragment in the almanach.", TALKTYPE_ORANGE_1) doPlayerSendTextMessage(cid,24,"The plant feels cold but dry and very soft. You streak the plant gently with your knife and put a fragment in the almanach.") setPlayerStorageValue(cid, 300017, 1) else doCreatureSayWithRadius(cid, "You cannot collect your plant sample.", TALKTYPE_ORANGE_1, 1, 1) end return TRUE end if itemEx.uid == 1706 then if (getPlayerStorageValue(cid, 300018) <= 0) and (getPlayerItemCount(cid, 12616) >= 1) then doSendMagicEffect(toPosition, CONST_ME_HITBYPOISON) doCreatureSay(cid, "You cut a leaf from a branch and put it in the almanach. It smells strangely sweet and awfully bitter at the same time.", TALKTYPE_ORANGE_1) doPlayerSendTextMessage(cid,24,"You cut a leaf from a branch and put it in the almanach. It smells strangely sweet and awfully bitter at the same time.") setPlayerStorageValue(cid, 300018, 1) else doCreatureSayWithRadius(cid, "You cannot collect your plant sample.", TALKTYPE_ORANGE_1, 1, 1) end return TRUE end if(itemEx.itemid == 12256 and getPlayerStorageValue(cid,42828) < 0) then doPlayerAddItem(cid,12263,1) doPlayerRemoveItem(cid, 12256,1) setPlayerStorageValue(cid, 42828, 1) doCreatureSay(cid, 'You carve a solid bowl out of the chunk of wood.', TALKTYPE_ORANGE_1) end local skin = SKINS[itemEx.itemid] if(not skin) then if (itemEx.itemid == 9009) then if (getPlayerStorageValue(cid, 27005) == EMPTY_STORAGE) then doPlayerAddItem(cid, 8310, 1) doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN) setPlayerStorageValue(cid, 27005, 1) else doCreatureSay(cid, "You cannot skin the corpse more than once.", TALKTYPE_MONSTER_YELL) end return true else doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE) return true end end if rustyItems[itemEx.itemid] ~= nil then if math.random(100) <= breakChance then doRemoveItem(itemEx.uid) doCreatureSay(cid, 'The attempt of sculpting failed miserably.', TALKTYPE_ORANGE_1) doSendMagicEffect(toPosition,3) else local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])] doTransformItem(itemEx.uid,newId) doSendMagicEffect(toPosition,9) return true end end local random, effect = math.random(1, 100000), CONST_ME_DRAWBLOOD if(random <= skin[1]) then doPlayerAddItem(cid, skin[2], 1) elseif(skin[3] and random >= skin[3]) then doPlayerAddItem(cid, skin[4], 1) else effect = CONST_ME_POFF end doSendMagicEffect(toPosition, effect) doTransformItem(itemEx.uid, itemEx.itemid + 1) return true end
  8. Thiago Virtuoso reagiu a uma resposta no tópico: Lib 000-Const
  9. Thiago Virtuoso reagiu a uma resposta no tópico: (Resolvido)Bug Creaturescript
  10. muito obrigado Suicide e xWhiteWolf funcionou certinho agora vlw
  11. Thiago Virtuoso reagiu a uma resposta no tópico: (Resolvido)Bug Creaturescript
  12. Agora funcionou mas continua com o mesmo bug ele executa o script varias vezes quando 2 ou mais players atacam o monstro.. [2/1/2015 17:6:11] > Broadcasted message: "Os geradores primários foram destruídos, acesso aos geradores reservas liberado!". [2/1/2015 17:6:11] > Broadcasted message: "Os geradores primários foram destruídos, acesso aos geradores reservas liberado!".
  13. Testei aqui mas ocorre o seguinte erro: [2/1/2015 16:48:23] [Error - CreatureScript Interface] [2/1/2015 16:48:23] data/creaturescripts/scripts/Castle/CastleGeneratorI.lua:onKill [2/1/2015 16:48:23] Description: [2/1/2015 16:48:23] .../creaturescripts/scripts/Castle/CastleGeneratorI.lua:31: attempt to index global 't' (a nil value) [2/1/2015 16:48:23] stack traceback: [2/1/2015 16:48:23] .../creaturescripts/scripts/Castle/CastleGeneratorI.lua:31: in function <.../creaturescripts/scripts/Castle/CastleGeneratorI.lua:30>
  14. Preciso de ajuda com esse script, ele funciona normalmente quando somente um player hita no monstro, mas quando 2 ou mais hitam o script buga e executa varias vezes bugando tudo.. local config = { generator ={ ["Castle Generator I"] = {brother = "Castle Generator II"}, ["Castle Generator II"] = {brother = "Castle Generator I"}, generatorArea ={ fromPos = {x = 1130, y = 1751, z = 7}, toPos = {x = 1134, y = 1813, z = 7} } } } function onKill(cid, target, lastHit) if(config.generator[getCreatureName(target)]) then local t = config.generator[getCreatureName(target)] local brother = getCreatureByName(t.brother) if(isMonster(brother) == true) then if (isInRange(getCreaturePosition(brother), config.generator.generatorArea.fromPos, config.generator.generatorArea.toPos) == true) then return TRUE end else doBroadcastMessage("Os geradores primários foram destruídos, acesso aos geradores reservas liberado!",MESSAGE_STATUS_WARNING) doRemoveItem(getTileItemById({x= 1050, y= 1813, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1812, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1811, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1810, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1809, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1049, y= 1809, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1048, y= 1809, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1047, y= 1809, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1050, y= 1752, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1753, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1754, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1050, y= 1755, z= 7}, 9533).uid) doRemoveItem(getTileItemById({x= 1047, y= 1755, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1048, y= 1755, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1049, y= 1755, z= 7}, 9485).uid) doRemoveItem(getTileItemById({x= 1050, y= 1755, z= 7}, 9485).uid) end end return TRUE end
  15. @Edit consegui resolver depois que olhei as callbacks eu consegui criar o script.. Muito obrigado Elwyn. Achei as sources.. e encontrei essas callbacks: case CREATURE_EVENT_DEATH: return "onDeath"; case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath"; case CREATURE_EVENT_EXTENDED_OPCODE: return "onExtendedOpcode"; case CREATURE_EVENT_MOUNT: return "onMount"; case CREATURE_EVENT_DISMOUNT: return "onDismount"; case CREATURE_EVENT_NONE: default: break; } return ""; }
  16. Não tenho as sources ;-; sei um pouco de programação em Lua, fiz alguns scripts pro meu server mas esse eu não estou conseguindo :/
  17. Seria isso? http://www.tibiaking.com/forum/topic/25474-teleporte-random/

Informação Importante

Confirmação de Termo