
Solutions
-
Vodkart's post in (Resolvido)EXHAUSTION SCRIPT was marked as the answerfunction onUse(cid, item, frompos, item2, topos) local store,exausted = 986532,2 if item2.itemid == 2739 then doTransformItem(item2.uid,2737) doDecayItem(item2.uid) doCreateItem(2694,1,topos) elseif item2.itemid == 5471 then doTransformItem(item2.uid,5463) doDecayItem(item2.uid) doCreateItem(5467,1,topos) elseif item2.itemid == 806 then if math.random(1,5) == 1 and getPlayerStorageValue(cid, store) - os.time() <= 0 then doSummonCreature("Rotworm", topos) return setPlayerStorageValue(cid, store, os.time()+exausted) else return doSendMagicEffect(topos, 2) end end return true end
-
Vodkart's post in (Resolvido)Como coloco um math.random nesse script? was marked as the answermto estranho, testei aqui e funcionou. Teste assim:
-- CONFIGURAÇÕES aurastr = 25950 -- storage da aura estr = 25951 -- storage para o exhaust porcentagem = 50 -- chance de curar em cada volta da aura, em porcentagem quantheal = 1 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura) tempo = 1180 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar) efeitocura = 28 -- número do efeito quando a cura chega ao player (efeito de posição fixa, pode ser identificado com /z no jogo) -- Função que chama a aura function efeitosAura(i,tm,cid) if(isCreature(cid)) then tipoaura = getPlayerStorageValue(cid, 789635) <= 0 and 37 or getPlayerStorageValue(cid, 789635) local atual = getCreaturePosition(cid) local posaura = { {x=(atual.x)-1, y=(atual.y)-1, z=atual.z}, {x=atual.x, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=atual.y, z=atual.z}, {x=(atual.x)+1, y=(atual.y)+1, z=atual.z}, {x=atual.x, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=atual.y, z=atual.z}, } local chances = math.random(100) if(chances<=porcentagem/8 and getCreatureHealth(cid)<getCreatureMaxHealth(cid)) then if(i<=8 and i>1) then doSendDistanceShoot({x=posaura.x, y=posaura.y, z=posaura.z}, atual, tipoaura) else doSendDistanceShoot({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, atual, tipoaura) end doSendMagicEffect(atual, efeitocura) end if(i==8) then doSendDistanceShoot({x=posaura.x, y=posaura.y, z=posaura.z}, {x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, tipoaura) elseif(i<8) then doSendDistanceShoot({x=posaura.x, y=posaura.y, z=posaura.z}, {x=posaura[i+1].x, y=posaura[i+1].y, z=posaura[i+1].z}, tipoaura) end if(i<=8 and getPlayerStorageValue(cid, aurastr)==2) then i = i+1 tm = tempo/8 return addEvent(efeitosAura,tm,i,tm,cid) elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then return efeitosAura(1,0,cid) else return TRUE end else return TRUE end end -- Função principal function onLogin(cid) if isPremium(cid) == true and getPlayerGroupId(cid) < 4 then if getPlayerStorageValue(cid, estr) > os.time() then doPlayerSendCancel(cid, "Espere "..(getPlayerStorageValue(cid, estr) - os.time()).." segundos para poder habilitar aura novamente.") elseif(getPlayerStorageValue(cid, aurastr)==-1) and getPlayerPremiumDays(cid) >= 1 then doPlayerSendCancel(cid,"Aura ligada!") setPlayerStorageValue(cid, aurastr, 2) efeitosAura(1,tempo/8,cid) elseif(getPlayerStorageValue(cid, aurastr)==-1) and isPremium(cid) == false then doPlayerSendCancel(cid,"Voce nao tem VIP") end end return TRUE end
-
Vodkart's post in (Resolvido)ERRO GUILD POINTS Query was marked as the answerexecuta no seu banco de dados
ALTER TABLE `accounts` ADD `guild_points` INTEGER(11) NOT NULL DEFAULT 0; ALTER TABLE `accounts` ADD `guild_points_stats` INT NOT NULL DEFAULT '0'; ALTER TABLE `guilds` ADD `last_execute_points` INT NOT NULL DEFAULT '0'; CREATE TABLE `z_shopguild_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_shopguild_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_shopguild_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`))
-
Vodkart's post in (Resolvido)Task System was marked as the answerdomodlib('task_func') 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,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"","" local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24 if isInArray({"task","tasks","missao","mission"}, msg) then if task_sys[task] then if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then if getPlayerLevel(cid) >= task_sys[task].level then setPlayerStorageValue(cid, task_sys[task].start, 1) npcHandler:say("[Task System] Parabéns, agora você está participando da Task do "..task_sys[task].name.." e deverá matar "..task_sys[task].count.." desta lista: "..getMonsterFromList(task_sys[task].monsters_list)..". "..(#task_sys[task].items > 0 and "Ah e por favor me traga "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid) else npcHandler:say("Desculpe, Mas você precisa alcançar level "..task_sys[task].level.." para poder participar da Task dos "..task_sys[task].name.."!", cid) end else npcHandler:say("Desculpe, Mas você atualmente está na task "..task_sys[task].name..". Você pode {entregar} caso já tenha terminado.", cid) end else npcHandler:say("Desculpe, Mas por enquanto não tenho mais nenhuma task para você!", cid) end elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova task diaria!", cid) return true elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then npcHandler:say("Desculpe, você tem task para {entregar} !", cid) return true end local r = doRandomDailyTask(cid) if r == 0 then npcHandler:say("Desculpe, mas você não tem level para completar nenhuma Task diaria.", cid) return true end setPlayerStorageValue(cid, task_sys_storages[4], r) setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600) setPlayerStorageValue(cid, task_sys_storages[7], 1) setPlayerStorageValue(cid, task_sys_storages[5], 0) local dtask = daily_task[r] npcHandler:say("[Daily Task System] Parabéns, agora você está participando da Task Diaria do "..dtask.name.." e deverá matar "..dtask.count.." monstros desta lista: "..getMonsterFromList(dtask.monsters_list).." até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa sorte!" , cid) elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then local v, k = task_sys[task], daily_task[daily] if v then -- original task if getPlayerStorageValue(cid, v.start) > 0 then if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then npcHandler:say("Desculpe, Mas você também precisa entregar os itens desta lista: "..getItemsFromList(v.items), cid) return true end if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end npcHandler:say("Obrigado pela sua ajuda Recompensas: "..(str == "" and "nenhuma" or ""..str.."").." por ter completado a task do "..v.name, cid) setPlayerStorageValue(cid, task_sys_storages[3], 0) setPlayerStorageValue(cid, task_sys_storages[1], (task+1)) if not task_sys[getTaskMission(cid)] then -- end all mission setPlayerStorageValue(cid, 89745, 6) local vocs = { -- [vocation] and outfit [1] = {[0] = 136, [1] = 128}, -- sex 0 female outfit, sex 1 male outfit [2] = {[0] = 142, [1] = 134}, [3] = {[0] = 139, [1] = 129}, [4] = {[0] = 141, [1] = 133} { doPlayerAddOutfit(cid, vocs[getPlayerVocation(cid)][getPlayerSex(cid)], 3) npcHandler:say("Parabens! Você completou todas as quest e recebeu uma outfit nova!", cid) end else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task do "..v.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes monstros terriveis!", cid) end end end if k then -- daily task if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then if k.exp > 0 then doPlayerAddExp(cid, v.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end npcHandler:say("Obrigado pela sua ajuda! Recompensas: "..(rst == "" and "nenhuma" or ""..rst.."").." por ter completado a task do "..k.name, cid) setPlayerStorageValue(cid, task_sys_storages[4], 0) setPlayerStorageValue(cid, task_sys_storages[5], 0) setPlayerStorageValue(cid, task_sys_storages[7], 0) else npcHandler:say("Desculpe, Mas você ainda não terminou a sua task diaria do "..k.name..". Preciso que mate mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes monstros!", cid) end end end elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Vodkart's post in (Resolvido)Patente Na Frags E Kill was marked as the answerfunction getPlayerFrags(cid) 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 = {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) } return size.day + size.week + size.month end function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d end function GetPatenteLook(cid) local ranks, kills = { [{0, 9}] = "Iniciante", [{10, 49}] = "Matador", [{50, 99}] = "Assassino", [{100, 149}] = "Heroico", [{150, 199}] = "Sanguinario", [{200, math.huge}] = "Serial Killer" },getDeathsAndKills(cid, "kill") for v , r in pairs(ranks) do if kills >= v[1] and kills <= v[2] then return r end end end function onLogin(cid) registerCreatureEvent(cid, "newlook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,"\n"..(getPlayerSex(thing.uid) == 0 and "She" or "").." Ele Matou ["..getDeathsAndKills(thing.uid, "kill").."]Players.\n"..(getPlayerSex(thing.uid) == 0 and "She" or "").." Ele Morreu ["..getDeathsAndKills(thing.uid, "death").."] Veses...\nSua Patente é "..GetPatenteLook(thing.uid)..".") return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,"\nVoce Matou ["..getDeathsAndKills(cid, "kill").."]Players.\nVoce Morreu ["..getDeathsAndKills(cid, "death").."] Veses...\nSua Patente é "..GetPatenteLook(cid)..".") local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'\n' if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end
-
Vodkart's post in (Resolvido)NPC GUIDE was marked as the answeronde estiver a função:
doPlayerAddMapMark
troque por:
doAddMapMark
-
Vodkart's post in (Resolvido)verificar tempo was marked as the answerfunction onSay(cid, words, param) local a = os.time() local b = math.floor((getPlayerStorageValue(cid, 19234) - a)/(24 * 60 * 60)) return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. (b < 0 and 0 or b) .." dias de VIP no character.") end
-
Vodkart's post in (Resolvido)Erro no console, autoloot was marked as the answersó colocar os corpse certos no items.xml que não tem problema!
-
Vodkart's post in (Resolvido)Npc de Task Points e 1 movements was marked as the answerdomodlib('task_func') 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_DEFAULT and 0 or cid local shopWindow = {} local t = { [2195] = {price = 5}, -- [id do item] e em price qnto task points vai custar [2493] = {price = 25}, [2361] = {price = 30}, [8851] = {price = 20}, [8925] = {price = 30}, [2640] = {price = 50}, [2494] = {price = 100}, [9932] = {price = 50}, [2472] = {price = 70}, [8931] = {price = 100} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getTaskPoints(cid) < t[item].price then selfSay("you do not have "..t[item].price.." Task Points", cid) else doPlayerAddItem(cid, item) setPlayerStorageValue(cid, task_sys_storages[2], getTaskPoints(cid) - t[item].price) selfSay("Here you item", cid) end return true end if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then for var, ret in pairs(t) do table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)}) end openShopWindow(cid, shopWindow, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
Vodkart's post in (Resolvido)Acrescentar parte no script was marked as the answerfunction getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d end function onLogin(cid) registerCreatureEvent(cid, "fraglook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getDeathsAndKills(thing.uid, 'kill')..'], [Death: '..getDeathsAndKills(thing.uid, 'death')..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(thing.uid,48902)) or 0))..']') return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,' [Frags: '..getDeathsAndKills(cid, 'kill')..'], [Death: '..getDeathsAndKills(cid, 'death')..'], [Critical: '..math.max(0,(tonumber(getCreatureStorage(cid,48903)) or 0))..'], [Dodge: '..math.max(0,(tonumber(getCreatureStorage(cid,48902)) or 0))..']') local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'' if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.' end if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end
-
Vodkart's post in (Resolvido)Ajuda Script de Voc para outfit was marked as the answerfunction onLogin(cid) local config = { [1] = {[0] = 311, [1] = 312}, [2] = {[0] = 309, [1] = 310} } local voc = config[getPlayerVocation(cid)] if voc and getPlayerStorageValue(cid, 13000) < 0 then local newtype = {lookType = voc[getPlayerSex(cid)]} doCreatureChangeOutfit(cid, newtype) setPlayerStorageValue(cid, 13000, 1) end return true end
-
Vodkart's post in (Resolvido)Por Deus, alguém ajuda um problema com quest? was marked as the answerjá declarou todos os itens na tabela? se sim, deixa eu ver ele terminado.
local specialQuests = { [2001] = 30015 --Annihilator } local questsExperience = { [30015] = 10000 } function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF, cid) return true end local storage = specialQuests[item.actionid] if(not storage) then storage = item.uid if(storage > 65535) then return false end end if(getPlayerStorageValue(cid, storage) > 0) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.") return false end local items = {} local reward = 0 local size = isContainer(item.uid) and getContainerSize(item.uid) or 0 if(size == 0) then reward = doCopyItem(item, false) else for i = 0, size do local tmp = getContainerItem(item.uid, i) if(tmp.itemid > 0) then table.insert(items, tmp) end end end size = table.maxn(items) if(size == 1) then reward = doCopyItem(items[1], true) end local result = "" if(reward ~= 0) then local ret = getItemDescriptions(reward.uid) if(reward.type > 0 and isItemRune(reward.itemid)) then result = reward.type .. " charges " .. ret.name elseif(reward.type > 0 and isItemStackable(reward.itemid)) then result = reward.type .. " " .. ret.plural else result = ret.article .. " " .. ret.name end else if(size > 20) then reward = doCopyItem(item, false) elseif(size > 8) then reward = getThing(doCreateItemEx(1988, 1)) else reward = getThing(doCreateItemEx(1987, 1)) end for i = 1, size do local tmp = doCopyItem(items[i], true) if(doAddContainerItemEx(reward.uid, tmp.uid) ~= RETURNVALUE_NOERROR) then print("[Warning] QuestSystem:", "Could not add quest reward") else local ret = ", " if(i == 2) then ret = " and " elseif(i == 1) then ret = "" end result = result .. ret ret = getItemDescriptions(tmp.uid) if(tmp.type > 0 and isItemRune(tmp.itemid)) then result = result .. tmp.type .. " charges " .. ret.name elseif(tmp.type > 0 and isItemStackable(tmp.itemid)) then result = result .. tmp.type .. " " .. ret.plural else result = result .. ret.article .. " " .. ret.name end end end end if(doPlayerAddItemEx(cid, reward.uid, false) ~= RETURNVALUE_NOERROR) then result = "You have found a reward weighing " .. getItemWeight(reward.uid) .. " oz. It is too heavy or you have not enough space." else result = "You have found " .. result .. "." setPlayerStorageValue(cid, storage, 1) if(questsExperience[storage] ~= nil) then doPlayerAddExp(cid, questsExperience[storage]) doSendAnimatedText(getCreaturePosition(cid), questsExperience[storage], TEXTCOLOR_WHITE) end end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, result) return true end
-
Vodkart's post in (Resolvido)VIP ACCOUNT BY KILLUA [AJUDA] was marked as the answerfunction installVipSystem() local func = db.query or db.executeQuery if func("CREATE TABLE `killua_vip_time` (`account_id` int(11) NOT NULL default '0', `time` varchar(255) NOT NULL default '0')") then return print(os.date("%X").." - Killua VIP System instalado com sucesso.") and true end return print(os.date("%X").." - Killua VIP System ja esta instalado.") and false end function getAccountVipTime(accid) local time_ = db.getResult("SELECT `time` FROM `killua_vip_time` WHERE `account_id` = "..accid) if time_:getID() ~= -1 then return time_:getDataInt("time") end return false end function setAccountVipTime(accid, time) local func = db.query or db.executeQuery local time_ = db.getResult("SELECT `time` FROM `killua_vip_time` WHERE `account_id` = "..accid) if time_:getID() ~= -1 then func("UPDATE `killua_vip_time` SET `time` = '"..time.."' WHERE `account_id` = "..accid) time_:free() return true end return func("INSERT INTO `killua_vip_time` (`account_id`, `time`) VALUES ('"..accid.."', '"..time.."')") end function isVip(cid) if getAccountVipTime(getPlayerAccountId(cid)) then return getAccountVipTime(getPlayerAccountId(cid)) >= os.time() end return false end function doPlayerSetVipDays(cid, days) if days and tonumber(days) and tonumber(days) >= 0 then if tonumber(days) == 0 then return setAccountVipTime(getPlayerAccountId(cid), days) end return setAccountVipTime(getPlayerAccountId(cid), (os.time() + (days * 60 * 60 * 24))) end return print("Aviso: Nao foi possivel executar a funcao doPlayerAddVipDays. O parametro days deve ser um numero.") end function getPlayerVipDays(cid) if getAccountVipTime(getPlayerAccountId(cid)) then return getAccountVipTime(getPlayerAccountId(cid)) > 0 and math.ceil((getAccountVipTime(getPlayerAccountId(cid)) - os.time()) / 60 / 60 / 24) or 0 end return 0 end
-
Vodkart's post in (Resolvido)[Pedido] Checkagem de Monstro was marked as the answerfunction getMonsterInArena(area) local t = {} for x = area[1].x - 1, area[2].x + 1 do for y = area[1].y - 1, area[2].y + 1 do local pos = {x=x, y=y, z=area[1].z} local m = getTopCreature(pos).uid if m ~= 0 and isMonster(m) then t[#t+1] = m end end end return t end local position = {{x = 541, y = 34, z = 7}, {x = 560, y = 55, z = 7}} -- começo e final da arena function onThink(interval) if #getMonsterInArena(position) > 0 then doSendAnimatedText(position[1], "Vivo", 50) -- pos onde o efeito vai aparecer end return true end
-
Vodkart's post in (Resolvido)Bug DISTRO devido a uma falha no creaturescript was marked as the answertenta remover o autoloot e testa para ver se o erro persiste
-
Vodkart's post in (Resolvido)comando !rank com falha was marked as the answerlocal config = { MaxPlayer = 20, fight_skills = { ['fist'] = 0, ['club'] = 1, ['sword'] = 2, ['axe'] = 3, ['distance'] = 4, ['shielding'] = 5, ['fishing'] = 6, ['dist'] = 4, ['shield'] = 5, ['fish'] = 6, }, other_skills = { [''] = "level", ['level'] = "level", ['magic'] = "maglevel", ['health'] = "healthmax", ['reset'] = "reset", ['mana'] = "manamax" }, vocations = { ['sorcerer'] = {1,5}, ['druid'] = {2,6}, ['paladin'] = {3,7}, ['knight'] = {4,8} } } function onSay(cid, words, param) local store,exausted = 156201,5 local param,str = param:lower(),"" if not config.fight_skills[param] and not config.other_skills[param] and not config.vocations[param] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "this ranking does not exists.") return true elseif getPlayerStorageValue(cid, store) >= os.time() then doPlayerSendCancel(cid, "wait " .. getPlayerStorageValue(cid, store) - os.time() .. " seconds to use this command again.") return true end str = "--[ RANK "..(param == "" and "LEVEL" or string.upper(param)).." ]--\n\n" local query = config.fight_skills[param] and db.getResult("SELECT `player_id`, `value` FROM `player_skills` WHERE `skillid` = "..config.fight_skills[param].." ORDER BY `value` DESC;") or config.other_skills[param] and db.getResult("SELECT `name`, `"..config.other_skills[param].."` FROM `players` WHERE `id` > 6 AND `group_id` < 2 ORDER BY `"..config.other_skills[param].."` DESC, `name` ASC;") or db.getResult("SELECT `name`, `level` FROM `players` WHERE `group_id` <= 2 AND `vocation` = "..config.vocations[param][1].." or `vocation` = "..config.vocations[param][2].." ORDER BY `level` DESC;") if (query:getID() ~= -1) then k = 1 repeat str = str .. "\n " .. k .. ". "..(config.fight_skills[param] and getPlayerNameByGUID(query:getDataString("player_id")) or query:getDataString("name")).." - [" .. query:getDataInt((config.fight_skills[param] and "value" or config.vocations[param] and "level" or config.other_skills[param])) .. "]" k = k + 1 until not(query:next()) or k > config.MaxPlayer query:free() end doShowTextDialog(cid,6500, str) setPlayerStorageValue(cid, store, os.time()+exausted) return true end
-
Vodkart's post in (Resolvido)Death Look Frags was marked as the answerfunction getPlayerFrags(cid) 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 = {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) } return size.day + size.week + size.month end function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d end function onLogin(cid) registerCreatureEvent(cid, "newlook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,"\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." Has Killed: ["..getDeathsAndKills(thing.uid, "kill").."]Players.\n"..(getPlayerSex(thing.uid) == 0 and "She" or "He").." has Died: ["..getDeathsAndKills(thing.uid, "death").."] Times\n[Frags: "..getPlayerFrags(thing.uid).."]") return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,"\nYou Has Killed: ["..getDeathsAndKills(cid, "kill").."]Players.\nYou has Died: ["..getDeathsAndKills(cid, "death").."] Times.\n[Frags: "..getPlayerFrags(cid).."]") local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'\n' if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end
-
Vodkart's post in (Resolvido)Sistema de Pesca quase pronto ajuda was marked as the answer--nothing
--------------
editei uma parte
local t = { [{100,105}] = {{5,"Water Elemental",400}}, -- chance, name, min level [{106,110}] = {{5,"Massive Water Elemental",400}, {10,"Water Elemental",500}}, [{111,119}] = {{5,"Blood Crab",500},{10,"Massive Water Elemental",520},{15,"Water Elemental",540}}, [{120,129}] = {{5,"Quara Constrictor",550},{10,"Blood Crab",555},{15,"Massive Water Elemental",560},{20,"Water Elemental",580}}, [{130,math.huge}] = {{5,"Quara Predator Scout",600},{10,"Quara Constrictor",650},{15,"Blood Crab",700}, {20,"Massive Water Elemental",700},{25,"Water Elemental",700}} } local lvl, fish_level = 400, 100 local useWorms = true local waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625} function onUse(cid, item, fromPosition, itemEx, toPosition) if isInArray(waterIds, itemEx.itemid) == TRUE then if itemEx.itemid ~= 493 then if getPlayerLevel(cid) >= lvl and getPlayerSkill(cid, SKILL_FISHING) >= fish_level then for v , r in pairs(t) do if getPlayerSkill(cid, SKILL_FISHING) >= v[1] and getPlayerSkill(cid, SKILL_FISHING) <= v[2] then for _ , var in pairs(r) do if getPlayerLevel(cid) >= var[3] and var[1] > math.random(1, 100) then doCreateMonster(var[2], getPlayerPosition(cid)) return true end end end end end if math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) <= getPlayerSkill(cid, SKILL_FISHING) then if useWorms then if getPlayerItemCount(cid, ITEM_WORM) > 0 then doPlayerRemoveItem(cid, ITEM_WORM, 1) doPlayerAddItem(cid, ITEM_FISH, 1) end else doPlayerAddItem(cid, ITEM_FISH, 1) end end doPlayerAddSkillTry(cid, SKILL_FISHING, 1) end doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY) return true end return false end
-
Vodkart's post in (Resolvido)proibir pk em determinada area was marked as the answervocê não queria uma área que nao poderia usar spells? só editar as magias e nesse caso que vc pediu, faz pelo onCombat
function onCombat(cid, target) local from,to = {x = 140, y = 41, z = 7}, {x = 168, y = 56, z = 7} if isPlayer(cid) and isPlayer(target) and isInRange(getCreaturePosition(cid), from, to) then return false end return true end
-
Vodkart's post in (Resolvido)ao Pisar no Sqm (chão/piso), Remover Monster da Área checada was marked as the answernome do seu script.lua
function HaveCreatureFromArea(area) for x = area[1].x - 1, area[2].x + 1 do for y = area[1].y - 1, area[2].y + 1 do local pos = {x=x, y=y, z=area[1].z} local m = getTopCreature(pos).uid if m ~= 0 and isMonster(m) then doRemoveCreature(m) end end end end function onStepIn(cid, item, position, fromPosition) local positions = {{x=110,y=297,z=7},{x=145,y=321,z=7}} -- area total começo e final HaveCreatureFromArea(positions) return true end TAG
<movevent type="StepIn" actionid="46897" event="script" value="nome do seu script.lua"/>
ai no colocar no aid do tile = 46897
-
Vodkart's post in (Resolvido)Erro onTHINK was marked as the answer--[[ Gems System By Maxwell Denisson(MaXwEllDeN) V 1.0 --]] function onThink(cid) if not isCreature(cid) then return LUA_ERROR end local gemid = getPlayerStorageValue(cid, 71473) if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then deAtiveGem(cid, gemid) doRemoveCondition(cid, CONDITION_ATTRIBUTES) end return true end function onLogin(cid) local gemid = getPlayerStorageValue(cid, 71473) if (getPlayerStorageValue(cid, 45783) > 0) and (checkGemTimeFinish(cid, gemid)) then deAtiveGem(cid, gemid) end if (gemid > 0) and (not checkGemTimeFinish(cid, gemid)) then local pedra = pedras_add[gemid] if not (pedra) then return true end local skills = pedra.skills doAddCondition(cid, pedras_add_c[gemid]) doPlayerSendTextMessage(cid, 27, "O efeito da gema mágica foi retomado.") doPlayerSetExperienceRate(cid, pedra.xp) registerCreatureEvent(cid, "EffectCheck") sendGemEffect(cid, gemid) end registerCreatureEvent(cid, "EffectDeath") return true end
-
Vodkart's post in (Resolvido)Que tipo de script pesa mais em um servidor ? movements, creature, mods.. was marked as the answerNão é que o CreatureScript pesa mais, é que geralmente é o mais chamado, porque acontece ao atacar, combat, target, death, preparedeath, kill, etc...
E como você falou, depende do que o código vai fazer, imagina ele fazer um loop no banco de dados para pegar todas as death's dos jogadores e fazer um rank para ver qual morreu mais? Se o servidor tiver 1k de jogadores no banco de dados e ir fazendo as contas 1 por 1, vai da um certo lagzinho.
-
Vodkart's post in (Resolvido)Remove tal Monster was marked as the answerlocal pos = {fromPosition = {x=533, y=222, z=7},toPosition = {x=544, y=230, z=7}} local time = 1 -- minutes local monsters = {"7 Hydra", "4 Demon"} function removeCreature(table) for x = ((pos.fromPosition.x)-10), ((pos.toPosition.x)+10) do for y = ((pos.fromPosition.y)-10), ((pos.toPosition.y)+10) do local m = getTopCreature({x=x, y=y, z= pos.fromPosition.z}).uid if m ~= 0 and isMonster(m) and isInArray(table, getCreatureName(m)) then doRemoveCreature(m) end end end end function startinvasion() local t = {} for _,x in pairs(monsters) do t[#t+1] = x:match("%s(.+)") for s = 1, tonumber(x:match("%d+")) do local pos2 = {x = math.random(pos.fromPosition.x, pos.toPosition.x), y = math.random(pos.fromPosition.y, pos.toPosition.y), z = pos.fromPosition.z} doSummonCreature(x:match("%s(.+)"), pos2) broadcastMessage("Acaba de nasce os bosses!", MESSAGE_STATUS_WARNING) end end addEvent(removeCreature, time*60*1000, t) end function onThink(interval, lastExecution) if os.date("%A") == "Monday" then if (os.date("%X") == "00:10:00") or (os.date("%X") == "00:15:00") then broadcastMessage("Bosses caminham para a cidade, nascem em frente ao templo ajude a protege a cidade!", MESSAGE_STATUS_WARNING) addEvent(startinvasion, 80000) end end return true end
falha minha
esqueci de declarar na função
-
Vodkart's post in (Resolvido)Como adicionar vocação e srcoll Aqui Ajuda DBO was marked as the answerEsta é uma mensagem automática! Este tópico foi movido para a área correta.
Pedimos que você leia as regras do fórum.
-
Vodkart's post in (Resolvido)Palavra magica was marked as the answerfunction doCreateFerumbras(amount) local vetor = 0 local Area = {{x=7649,y=16379,z=5},{x=7735,y=16443,z=7}} repeat local pos = {x=math.random(Area[1].x, Area[2].x), y=math.random(Area[1].y,Area[2].y), z=math.random(Area[1].z,Area[2].z)} if isWalkable(pos, false, false, false) then doSummonCreature("Ferumbras", pos) vetor = vetor + 1 end until vetor == amount end function onSay(cid, words, param, channel) local avisoproibido = "Desculpe isso não é possível." local horario = "Apenas uma vez por dia os deuses podem ser liberados." if getTileHouseInfo(getThingPos(cid)) then return doPlayerSendCancel(cid,avisoproibido) end if getTilePzInfo(getThingPos(cid)) then return doPlayerSendCancel(cid,avisoproibido) end if getTileHouseInfo(getThingPos(cid)) then return doPlayerSendCancel(cid,horario) end local M = { Pos = {x=32369,y=32228,z=7}, id= 1355, time = 86400} local x = M function criar() local parede = getTileItemById(x.Pos, x.id) doCreateItem(x.id, 1, x.Pos) end local tempo = 1*24*60*60 local storage = 94368 if x then local parede = getTileItemById(x.Pos, x.id) if getTileInfo(getCreaturePosition(cid)).itemid == 3217 or 3216 then if (getPlayerStorageValue(cid, storage) <= os.time()) then if parede then setPlayerStorageValue(cid, storage, os.time()+tempo) doRemoveItem(parede.uid, 1) --doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))-- doPlayerSendTextMessage(cid, 25, "A furia dos Deuses foi liberada tenha cuidado") doCreateFerumbras(30) addEvent(criar, x.time*1000) end else doPlayerSendCancel(cid, "A furia dos deuses só pode ser liberada a cada 24 horas.") end end end return true end
obs: só adicionei a parte que cria ferumbras no mapa, você pediu.