
Solutions
-
Vodkart's post in (Resolvido)To Frags Online was marked as the answer<?xml version="1.0" encoding="ISO-8859-1"?> <mod name="rank frag" version="1.0" author="Vodkart" contact="xtibia.com" enabled="yes"> <config name="rankf_func"><![CDATA[ storage = 824544 function 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 setFrags(cid) if not isCreature(cid) then return LUA_ERROR end setPlayerStorageValue(cid, storage, getPlayerFrags(cid)) doPlayerSave(cid) end function getRankStorage(value, max, RankName) local str = "".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."\n" local players = getPlayersOnline() table.sort(players, function(a, b) return getPlayerStorageValue(a, value) > getPlayerStorageValue(b,value) end) k = 0 for x = 1, table.maxn(players) do k = k + 1 str = str .. "\n " .. k .. ". "..getCreatureName(players[x]).." - " .. getPlayerStorageValue(players[x], value) .. " frags" if k == max then break end end return str end ]]></config> <globalevent name="RankFrags_Broad" interval="120" event="script"><![CDATA[ domodlib('rankf_func') function onThink(interval, lastExecution) doBroadcastMessage(getRankStorage(storage, 5, "Top 5 Fraggers Online!"), 21) return true end]]></globalevent> <event type="login" name="RankfLogin" event="script"><![CDATA[ domodlib('rankf_func') function onLogin(cid) registerCreatureEvent(cid, "RankfKill") setFrags(cid) return true end]]></event> <event type="kill" name="RankfKill" event="script"><![CDATA[ domodlib('rankf_func') function onKill(cid, target, lastHit) if (isPlayer(cid) == true) and (isPlayer(target) == true) then addEvent(setFrags, 1000, cid) end return true end]]></event> </mod>
-
Vodkart's post in (Resolvido)Ganhar X quantia de Soul Points por Y segundos on was marked as the answerna lib
function getSoulPoints(cid) if not isCreature(cid) then return LUA_ERROR end -- aqui caso o jogador deslogue if getPlayerSoul(cid) < 100 then -- 100 eh o max de soul points local t = { [{1,8}] = 10, [{9,16}] = 20, [{17,24}] = 30, [{25,32}] = 40, [{33,math.huge}] = 50 } for var, ret in pairs(t) do if getPlayerVocation(cid) >= var[1] and getPlayerVocation(cid) <= var[2] then doPlayerAddSoul(cid, ret) end end end addEvent(getSoulPoints, 15*1000, cid) end
ai no script de onLogin tu adc antes do ultimo 'return true'
getSoulPoints(cid)
-
Vodkart's post in (Resolvido)[AJUDA] preciso de um Npc que venda por points was marked as the answerquer pelo trade say né? aquele que vc fla tipo
hi
sword
yes
tem esse aqui que é por trade normal, mas tem que ter GP na bp
lib
function getAccountPoints(cid) local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'') return res:getDataInt("premium_points") < 0 and 0 or res:getDataInt("premium_points") end function doAccountRemovePoints(cid, count) return db.executeQuery("UPDATE `accounts` SET `premium_points` = '".. getAccountPoints(cid) - count .."' WHERE `name` ='"..getPlayerAccount(cid).."'") end
Npc:
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 = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,string.lower(msg) local shopWindow = {} local t = { [2195] = 1, [2493] = 25, [2361] = 30, [8851] = 20, [8925] = 30, [2640] = 50, [2494] = 100, [9932] = 50, [2472] = 70, [8931] = 100 } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getAccountPoints(cid) < t[item] then selfSay("You need "..t[item].." points to buy this item.", cid) else doAccountRemovePoints(cid, t[item]) doPlayerAddItem(cid, item) selfSay("Here your 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, 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)[TOP FRAGS] was marked as the answer<?xml version="1.0" encoding="ISO-8859-1"?> <mod name="rank frag" version="1.0" author="Vodkart" contact="xtibia.com" enabled="yes"> <config name="rankf_func"><![CDATA[ storage = 824544 function 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 setFrags(cid) if not isCreature(cid) then return LUA_ERROR end setPlayerStorageValue(cid, storage, getPlayerFrags(cid)) doPlayerSave(cid) end function getRankStorage(value, max, RankName) local str = "--[".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."]--\n\n" local query = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..value.." ORDER BY cast(value as INTEGER) DESC;") if (query:getID() ~= -1) then k = 1 repeat str = str .. "\n " .. k .. ". "..getPlayerNameByGUID(query:getDataString("player_id")).." - [" .. query:getDataInt("value") .. "]" k = k + 1 until k > max or not query:next() end return str end ]]></config> <globalevent name="RankFrags_Broad" interval="300" event="script"><![CDATA[ domodlib('rankf_func') function onThink(interval, lastExecution) doBroadcastMessage(getRankStorage(storage, 5, "Top 5 Fraggers!"), 22) return true end]]></globalevent> <event type="login" name="RankfLogin" event="script"><![CDATA[ domodlib('rankf_func') function onLogin(cid) registerCreatureEvent(cid, "RankfKill") setFrags(cid) return true end]]></event> <event type="kill" name="RankfKill" event="script"><![CDATA[ domodlib('rankf_func') function onKill(cid, target, lastHit) if (isPlayer(cid) == true) and (isPlayer(target) == true) then addEvent(setFrags, 1000, cid) end return true end]]></event> </mod>
-
Vodkart's post in (Resolvido)[TalkAction] Preciso de uma ajuda com /verban was marked as the answerfunction onSay(cid, words, param) local param = param:lower() if not getPlayerGUIDByName(param) then doPlayerSendCancel(cid, "Desculpe, mas o jogador [" .. param .. "] não existe.") return true end return doPlayerPopupFYI(cid, " ==========Status========== \n Jogador: " .. param .. " \n Situacao: "..(isAccountBanished(getAccountIdByName(param)) and "Banido" or "Não Banido").." \n ==========Status==========") end
-
Vodkart's post in (Resolvido)broadcast apenas pra quem tem storage was marked as the answertem certeza? fiz algo de proposito aí, te garanto que não ta funcionando corretamente
enfim eu coloquei 'cid' para mandar o nome da guild que está dominando, ou seja, vai mandar a mensagem dizendo que a própria guild está dominando? meio sem nexo, não é mesmo?
Queria ver como você testava seus códigos '-'
function MsgGuildPlayersCastle(msg) for _, tid in pairs(getPlayersOnline()) do if getPlayerGuildId(tid) > 0 and getPlayerGuildName(tid) == getGlobalStorageValue(COH_STATUS) then doPlayerSendTextMessage(tid, MESSAGE_STATUS_WARNING, msg) end end return true end function onStepIn(cid, item, pos, fromPosition) local pos = getThingPos(cid) if item.actionid == 16203 then if not isPlayer(cid) then return true end if getGlobalStorageValue(COH_STATUS) == getPlayerGuildName(cid) then doSendMagicEffect(getThingPos(cid), 14) doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) else doSendMagicEffect(getThingPos(cid), 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[CoH] Você nao pertence a guild "..getGlobalStorageValue(COH_STATUS)..".") end return true end if item.actionid == 16202 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then if (getGlobalStorageValue(COH_STATUS) ~= getPlayerGuildName(cid)) then doPlayerSendTextMessage(cid, 20, "[Castle of Honor] Você e sua guild estão no comando, os antigos donos ["..tostring(getGlobalStorageValue(COH_STATUS)).."] podem se vingar!") setGlobalStorageValue(COH_PREPARE1, -1) setGlobalStorageValue(COH_PREPARE2, -1) setGlobalStorageValue(COH_STATUS, getPlayerGuildName(cid)) doCastleRemoveEnemies() doBroadcastMessage("[Castle of Honor] O jogador ["..getCreatureName(cid).."] e sua guild ["..getPlayerGuildName(cid).."] estao no comando do castelo, va dominar e impedir isso!") end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") end return true end if item.actionid == 16200 then if not isPlayer(cid) then return true end if getPlayerGuildId(cid) > 0 then doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) -- primeiro tile -- if (getGlobalStorageValue(COH_PREPARE1) ~= getPlayerGuildName(cid)) then MsgGuildPlayersCastle("[Castle of Honor] Atencao! A guild "..getPlayerGuildName(cid).." esta tentando dominar o castelo, preparem-se!") setGlobalStorageValue(COH_PREPARE1, getPlayerGuildName(cid)) end else doSendMagicEffect(pos, 2) doTeleportThing(cid, fromPosition, false) doPlayerSendCancel(cid, "[Castle of Honor] Voce nao possui uma guild.") return true end end if item.actionid == 16201 then if not isPlayer(cid) then return true end doSendAnimatedText(pos, "[CoH]", math.random(1, 255)) if (getGlobalStorageValue(COH_PREPARE2) ~= getPlayerGuildName(cid)) then MsgGuildPlayersCastle("[Castle of Honor] Atençao! A guild "..getPlayerGuildName(cid).." esta muito proxima do domíinio, ataquem!") setGlobalStorageValue(COH_PREPARE2, getPlayerGuildName(cid)) end end return true end
-
Vodkart's post in (Resolvido)[AJUDA] Erro GlobalEvent Interface - Database? was marked as the answeré num MODS chamado Staff time, são 3 storages para mudar o valor, mas não tem nada a ver com oq vc falou, é que em algum servidores sqlite usa 'executeQuery' e em alguns MySQL usa 'db.query'
-
Vodkart's post in (Resolvido)[Duvida] tempo para voltar da area was marked as the answerlocal teleportar_para = {x = 1024, y = 913, z = 4} local time = 10 -- in seconds local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, 10) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) function removeTeleport(pos) tp = getTileItemById(pos, 1387).uid doRemoveItem(tp, 1) doSendMagicEffect(pos, 2) end function x(p, d) local t = {{x=p.x,y=p.y-1,z=p.z},{x=p.x+1,y=p.y,z=p.z},{x=p.x,y=p.y+1,z=p.z},{x=p.x-1,y=p.y,z=p.z}} return t[d+1] end function TeleportLastPos(cid, pos) if not isCreature(cid) then return LUA_ERROR end return doTeleportThing(cid,pos) end function onCastSpell(cid, var) if getPlayerStorageValue(cid, 5677) == 1 then doPlayerSendCancel(cid, "Você não pode usar tal magia aqui") return false end local pos = getCreaturePosition(cid) -- pos onde o jogador usou a spell local criar_tp = pos doCreateTeleport(1387, teleportar_para, criar_tp) local tp = getTileItemById(criar_tp, 1387).uid doItemSetAttribute(tp, "aid", 5678) addEvent(TeleportLastPos, time*1000, cid, pos) -- dps de alguns segundos o jogador volta para a pos que estava doTeleportThing(cid, teleportar_para, false) --Tira essa linha se nao for teleportar o player q usou a magia automaticamente. for i = 1, 5 do addEvent(doSendMagicEffect, i*1000, criar_tp, 134) end addEvent(removeTeleport, 5000, criar_tp) return doCombat(cid, combat, var) end
-
Vodkart's post in (Resolvido)[Resolvido]Event onTimer not found was marked as the answerlocal days, hours = {"Tuesday", "Thursday", "Saturday"}, {"00:00", "16:00", "21:00"} -- defina os dias e horários dos eventos local monsters = {"Mummy", "Snake Easy", "Fighter", "Wolf"} local time_min, max = 11, 30 -- Em minutos local premios, gold = {{639, 20}, {640, 10}}, 0 -- {id do item, quantidade} que o jogador ganha e quantia de gold function winMonsterEvent() local max_sto, winner = 0, 0 local monster = getGlobalStorageValue(1919211) for _, pid in pairs(getPlayersOnline()) do local sto = getPlayerStorageValue(pid, 1814210) if sto > max_sto then max_sto = sto winner = pid end end if isPlayer(winner) then local artigo = getPlayerSex(winner) == 0 and "A jogadora" or "O jogador" doBroadcastMessage(artigo.." "..getCreatureName(winner).." matou "..getPlayerStorageValue(winner, 1814210).." "..monster.."s e venceu o evento. Recompensas: 10 Senzu Beans e 20 Magic Senzu Beans. Parabéns!") for _, prize in pairs(premios) do doPlayerAddItem(winner, prize[1], prize[2]) end doPlayerAddMoney(winner, gold) else doBroadcastMessage("[Monstro Evento] O evento terminou e nao houve nenhum vencedor.") end setGlobalStorageValue(1919211, 0) end function onThink(interval, lastExecution) if isInArray(days, os.date("%A")) and isInArray(hours, tostring(os.date("%X")):sub(1, 5)) then local random = math.random(1, #monsters) local time = math.random(time_min, max) for _, pid in pairs(getPlayersOnline()) do doPlayerSetStorageValue(pid, 1814210, 0) end setGlobalStorageValue(1919211, monsters[random]) doBroadcastMessage("[Monstro Evento] O evento começou e vai durar "..time.." minuto. O Monstro sorteado foi "..monsters[random].."! Quem matar mais deles até o fim será o vencedor!") addEvent(winMonsterEvent, time*1000*60) end return true end
-
Vodkart's post in (Resolvido)Quest que da % em EXP was marked as the answerlocal config = { storage = 2141, key_id = 5927, -- Key ID } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, config.storage) > 0 then doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "The treasure chest is empty.") return true end setPlayerStorageValue(cid, config.storage, 1) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a bag.") key = doPlayerAddItem(cid, config.key_id, 1) doAddContainerItem(key, 2560, 1) doAddContainerItem(key, 2152, 10) doPlayerAddExperience(cid, (getExperienceForLevel(getPlayerLevel(cid)+1) - getExperienceForLevel(getPlayerLevel(cid))) * 0.1) -- 10% return true end
-
Vodkart's post in (Resolvido)GLOBALEVENTS da premio apenas para o ultimo player em certa area was marked as the answerbasicamente é assim:
function LastPlayerInEvent() local from,to = {x=10,y=10,z=7}, {x=20,y=20,z=7} -- pos começo e final da area local reward = {2160,10} -- defina aqui seu premio local players = {} -- n mexa for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), from, to) then table.insert(players, pid) end end if #players == 1 then doPlayerAddItem(players[1],reward[1],reward[2]) doTeleportThing(players[1],getTownTemplePosition(getPlayerTown(players[1]))) else addEvent(LastPlayerInEvent, 60000) -- a cada 1 min vai executar o script end end
-
Vodkart's post in (Resolvido)Piso ou porta de resets was marked as the answerfunction getPlayerReset(cid) local query = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid)) return query:getDataInt("reset") <= 0 and 0 or query:getDataInt("reset") end function onStepIn(cid, item, position, fromPosition) local resets = 20 if getPlayerReset(cid) < resets then doTeleportThing(cid, fromPosition, true) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "voce precisa de "..resets.." para passar neste tile.") doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE) return true end return true end
-
Vodkart's post in (Resolvido)bug GuildFragSystem was marked as the answeré pq teu serve o globale events é em milesegundos
tem que trocar o "interval" do globalevents, por exemplo está 1800 -- no meu serve seria a cada 30 minutos
no seu 60000 significa 1 minuto, entendeu? só aumentar aquele time do interval
-
Vodkart's post in (Resolvido)Alavanca que só passe 1 player was marked as the answera arena da arena ta configurada certa?
se nao tenta assim:
function getPlayersInArena(fromPos, toPos) local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then players[#players+1] = pid end end return players end function onUse(cid, item) local from, to = {x=10, y=20, z = 7},{x=19, y=26, z = 7} -- coloque a pos da arena começo e final da sala if #getCreatureSummons(cid) >= 1 then doPlayerSendCancel(cid, "[Torneio] Nao Pode Usar o Bau com Pokemon Fora Da Ball!.") return true elseif #getPlayersInArena(from, to) > 1 then doPlayerSendTextMessage(cid, 20 ,"Somente o Ultimo Sobrevivente poderar Usar essa Alavanca") return true end doTeleportThing(cid, torneio.playerTemple) doPlayerAddItem(cid,6569,10) doPlayerSendTextMessage(cid, 21, "[Torneio] Jovem Treinador Parabéns, você ganhou o torneio e ganhou [10] Candy UP + ["..getItemNameById(torneio.awardTournament).."] .") setPlayerStorageValue(cid,130131, getPlayerStorageValue(cid,130131)+1) doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE,"[Torneio-Score] Voce Agora Tem ["..(getPlayerStorageValue(cid,130131) + 1).."] Torneio SCORES.") doPlayerAddItem(cid, torneio.awardTournament, torneio.awardAmount) return true end
-
Vodkart's post in (Resolvido)Verificação Storage was marked as the answerlocal config = { pos = {x = 5065, y = 5047, z = 6}, itens = {11230, 11231}, new_id = 2130, storage = 789458 } function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid,config.storage) > 0 then doPlayerSendCancel(cid, "Você já fez está quest.") return true end for _, itemid in ipairs(config.itens) do if getTileItemById(config.pos, itemid).uid < 100 then doPlayerSendCancel(cid, "Você não tem os ítens necessários para forjar o capacete.") return true end end for _, itemid in ipairs(config.itens) do doRemoveItem(getTileItemById(config.pos, itemid).uid, 1) end doCreatureSay(cid, "Yaay", 19) doCreateItem(config.new_id, 1, config.pos) setPlayerStorageValue(cid,config.storage,1) return true end
-
Vodkart's post in (Resolvido)[SCRIPT] Item para Last Hit was marked as the answerfunction onDeath(cid, corpse, deathList) if isPlayer(deathList[1]) then doPlayerAddItem(deathList[1], 2173, 1) -- itemid, amount doSendMagicEffect(getPlayerPosition(deathList[1]), 12) end return true end
-
Vodkart's post in (Resolvido)[Duvida] Função de chamar informação da database was marked as the answerfunction getPlayerReset(cid) local query = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid)) return query:getDataInt("reset") <= 0 and 0 or query:getDataInt("reset") end ou
function getPlayerReset(cid) return db.getResult("SELECT `reset` FROM `players` WHERE `id = "..getPlayerGUID(cid)):getDataInt("resets") end
as 2 funcionam normalmente
-
Vodkart's post in (Resolvido)PEDIDO [GLOBALEVENTS] - Mandar players pro templo por AREA was marked as the answer/\ esse script é usado pra outra coisa, usa assim:
local from, to = {x = 235, y = 20, z = 7}, {x = 287, y = 53, z = 7} function onTime() for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), from, to) then doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid))) end end return true end
-
Vodkart's post in (Resolvido)Erro ao puxa a lavancar(Quest Anihi) was marked as the answerlocal t = { lvl = 100, entrada = { {x = 710, y = 1420, z = 5}, -- pos players {x = 709, y = 1420, z = 5}, {x = 708, y = 1420, z = 5}, {x = 707, y = 1420, z = 5} }, saida = { {x = 710, y = 1420, z = 6}, -- pos para onde eles irão {x = 709, y = 1420, z = 6}, {x = 708, y = 1420, z = 6}, {x = 707, y = 1420, z = 6} }, monstros = { {{x = 707, y = 1418, z = 6}, "Demon"}, -- defina pos dos montros e nomes {{x = 709, y = 1418, z = 6}, "Demon"}, {{x = 708, y = 1422, z = 6}, "Demon"}, {{x = 710, y = 1422, z = 6}, "Demon"}, {{x = 712, y = 1420, z = 6}, "Hellfire Fighter"}, {{x = 713, y = 1420, z = 6}, "Hellfire Fighter"}, {{x = 711, y = 1420, z = 6}, "Ghazbaran"} } } function onUse(cid, item, fromPosition, itemEx, toPosition) local check = {} for _, k in ipairs(t.entrada) do local x = getTopCreature(k).uid if(x == 0 or not isPlayer(x) or getPlayerLevel(x) < t.lvl) then doPlayerSendCancel(cid, 'Está faltando player ou alguém não possui level '..t.lvl..' ou mais.') return true end table.insert(check, x) end for _, summon in pairs(t.monstros) do local creature = getTopCreature(summon[1]).uid if(creature > 0 and not isPlayer(creature)) then doRemoveCreature(creature) end doCleanTile(summon[1]) doCreateMonster(summon[2], summon[1]) end for i, tid in ipairs(check) do doSendMagicEffect(t.entrada[i], CONST_ME_POFF) doTeleportThing(tid, t.saida[i], false) doSendMagicEffect(t.saida[i], CONST_ME_ENERGYAREA) end doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end
-
Vodkart's post in (Resolvido)Erro Onsay was marked as the answervc está chamando a função de pegar a posição do jogador mesmo sem saber se ele está lá...
function onSay(cid, words, param) local config = { seconds = 5, storage = 19, msg = "Você não consegue fazer na velocidade 5." } function useAgain(cid) return setPlayerStorageValue(cid, config.storage, 2) end local playerPos = getCreaturePosition(cid) if getPlayerLookDir(cid) == 0 then position = {x = playerPos.x, y = playerPos.y-1, z = playerPos.z, stackpos = 253} elseif getPlayerLookDir(cid) == 1 then position = {x = playerPos.x+1, y = playerPos.y, z = playerPos.z, stackpos = 253} elseif getPlayerLookDir(cid) == 2 then position = {x = playerPos.x, y = playerPos.y+1, z = playerPos.z, stackpos = 253} elseif getPlayerLookDir(cid) == 3 then position = {x = playerPos.x-1, y = playerPos.y, z = playerPos.z, stackpos = 253} end local alvo = getThingfromPos(position) local direcself = getPlayerLookDir(cid) if isPlayer(alvo.uid) then local direcalvo = getPlayerLookDir(alvo.uid) if direcself == direcalvo then if getPlayerStorageValue(cid, config.storage) == -1 then setPlayerStorageValue(cid, config.storage, os.time()-config.seconds) end if config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)) > 0 then doPlayerSendCancel(cid, string.format(config.msg, config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)))) return true end setPlayerStorageValue(cid, config.storage, os.time()) doSendAnimatedText(getPlayerPosition(cid), "CREEEU!", TEXTCOLOR_RED) doSendAnimatedText(getPlayerPosition(alvo.uid), "AII!", TEXTCOLOR_ORANGE) return true else doPlayerSendCancel(cid, "Precisa estar de costas para você.") return true end else doPlayerSendCancel(cid, "Não tem nenhum player na sua frente.") return true end return true end
-
Vodkart's post in (Resolvido)Script Npc event seller was marked as the answere vc já tem o script dos coins? se é item ou alguma função que adc os coins?
-
Vodkart's post in (Resolvido)Pedido Stafftime was marked as the answerStaffTime.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Staff Time System" version="1.0" author="vodkart" contact="none" enabled="yes"> <config name="stafftime_lib"><![CDATA[ _Staff_Config_ = { storages = {448501,448502}, min_group_id = 1 -- aqui vai contar a partir do 2, 3, 4 ... } function timeString(timeDiff) local dateFormat = { {"day", timeDiff / 60 / 60 / 24}, {"hour", timeDiff / 60 / 60 % 24}, {"minute", timeDiff / 60 % 60}, {"second", timeDiff % 60} } local out = {} for k, t in ipairs(dateFormat) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find("second") then local a, b = ret:find(" and ") ret = ret:sub(b+1) end return ret end function getStaffTime(name) local target_online = getPlayerByNameWildcard(name) if not isPlayer(target_online) then local info = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[1]) if info:getID() ~= -1 then var_time = timeString((-(info:getDataInt("value")))) else var_time = 0 end else if getPlayerStorageValue(target_online, _Staff_Config_.storages[2]) <= 0 then var_time = 0 else var_time = timeString((os.time() - getPlayerStorageValue(target_online, _Staff_Config_.storages[1]))) end end return var_time end function getAllStaffTime() local query, str = db.getResult("SELECT `name`, `group_id` FROM `players` WHERE `group_id` > ".._Staff_Config_.min_group_id), "--> STAFF TIME <--\n\n[Group]Nick - Tempo Online\n" if (query:getID() ~= -1) then repeat local _ = query:getDataString("name") str = str .. "\n ["..getGroupInfo(query:getDataInt("group_id")).name.."]".._.." - "..getStaffTime(_) until not(query:next()) query:free() end return str end function doSaveStaffTime(cid) if getPlayerStorageValue(cid, _Staff_Config_.storages[2]) >= 1 then setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) - os.time()) setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) + os.time()) end end function deleteAllStaffTimes() db.executeQuery("DELETE FROM `player_storage` WHERE `key` = ".._Staff_Config_.storages[1]) db.executeQuery("DELETE FROM `player_storage` WHERE `key` = ".._Staff_Config_.storages[2]) for _, player in ipairs(getPlayersOnline()) do if getPlayerGroupId(player) > _Staff_Config_.min_group_id then setPlayerStorageValue(player, _Staff_Config_.storages[1], os.time()) setPlayerStorageValue(player, _Staff_Config_.storages[2], 1) end end end function deletePlayerStaffTimes(name) local target_online = getPlayerByNameWildcard(name) if not isPlayer(target_online) then db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[1]) db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[2]) else setPlayerStorageValue(target_online, _Staff_Config_.storages[1], os.time()) setPlayerStorageValue(target_online, _Staff_Config_.storages[2], 1) end end ]]></config> <globalevent name="Salve-StaffTime" interval="1800" event="script"><![CDATA[ domodlib('stafftime_lib') function onThink(interval, lastExecution, thinkInterval) if #getPlayersOnline() > 0 then for _, cid in ipairs(getPlayersOnline()) do if getPlayerGroupId(cid) > _Staff_Config_.min_group_id then doSaveStaffTime(cid) end end end return true end]]></globalevent> <talkaction words="/stafftime;/allstafftime;/stafftimecleall;/stafftimeclear" event="buffer"><![CDATA[ domodlib('stafftime_lib') if (words == "/stafftime") then local t = string.explode(param:lower(), ",") if (param == "") then doPlayerSendCancel(cid, "use um comando valido") return true elseif not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Desculpe, mas o jogador [" .. t[1] .. "] não existe.") return true elseif db.getResult("SELECT `group_id` FROM `players` WHERE `id` = "..getPlayerGUIDByName(t[1])):getDataInt("group_id") <= _Staff_Config_.min_group_id then doPlayerSendCancel(cid,"este jogador não é um membro da staff.") return true end return doPlayerPopupFYI(cid, "Tempo Total Online:\n\n"..t[1].." - "..getStaffTime(t[1])..".") elseif (words == "/allstafftime") then if getPlayerAccess(cid) < 5 then doPlayerSendCancel(cid, "você não tem permissão para usar este comando") return true end return doPlayerPopupFYI(cid, getAllStaffTime()) elseif (words == "/stafftimecleall") then if getPlayerAccess(cid) < 5 then doPlayerSendCancel(cid, "você não tem permissão para usar este comando") return true end deleteAllStaffTimes() return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você limpou a Staff Time de toda a equipe do servidor.") elseif (words == "/stafftimeclear") then local t = string.explode(param:lower(), ",") if getPlayerAccess(cid) < 5 then doPlayerSendCancel(cid, "você não tem permissão para usar este comando") return true elseif (param == "") then doPlayerSendCancel(cid, "use um comando valido") return true elseif not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Desculpe, mas o jogador [" .. t[1] .. "] não existe.") return true elseif db.getResult("SELECT `group_id` FROM `players` WHERE `id` = "..getPlayerGUIDByName(t[1])):getDataInt("group_id") <= _Staff_Config_.min_group_id then doPlayerSendCancel(cid,"este jogador não é um membro da staff.") return true end deletePlayerStaffTimes(t[1]) return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você limpou a Staff Time do jogador "..t[1]) end ]]></talkaction> <event type="login" name="StaffTimeLogin" event="script"><![CDATA[ domodlib('stafftime_lib') function onLogin(cid) if getPlayerGroupId(cid) > _Staff_Config_.min_group_id then if getPlayerStorageValue(cid, _Staff_Config_.storages[2]) <= 0 then setPlayerStorageValue(cid, _Staff_Config_.storages[1], os.time()) setPlayerStorageValue(cid, _Staff_Config_.storages[2], 1) else setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) + os.time()) end end return true end]]></event> <event type="logout" name="StaffTimeLogout" event="script"><![CDATA[ domodlib('stafftime_lib') function onLogout(cid) if getPlayerGroupId(cid) > _Staff_Config_.min_group_id then setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) - os.time()) end return true end]]></event> </mod>
Moleza hein? nem precisa instalar os scripts na pasta, fiz em MODS p/ vc malandrão! haha
-
Vodkart's post in (Resolvido)Ajustando Skull System was marked as the answeradc no MODS a função onPrepareDeath e coloca para não dropar nenhum item...
function onPrepareDeath(cid, lastHitKiller, mostDamageKiller) if isPlayer(cid) then doCreatureSetDropLoot(cid, false) end return true end
-
Vodkart's post in (Resolvido)Alavanca que leva o player até a house was marked as the answerfunction onUse(cid, item, frompos, item2, topos) if not getHouseByPlayerGUID(getPlayerGUID(cid)) then doPlayerSendTextMessage(cid,22,"You still do not have a house, buy a talking '!buyhouse' front of her.") return true end doTeleportThing(cid, getHouseEntry(getHouseByPlayerGUID(getPlayerGUID(cid)))) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end
-
Vodkart's post in (Resolvido)Reward Item was marked as the answerfunction onUse(cid, item, frompos, item2, topos) local t,r = { [{1, 2}] = {2173,1}, [{1, 5}] = {2161,2}, [{1, 10}] = {2163,1}, [{1, 40}] = {2162,1}, [{1, 60}] = {2160,10} }, math.random(1, 100) for var, ret in pairs(t) do if r >= var[1] and r <= var[2] then doPlayerAddItem(cid, ret[1], ret[2]) doRemoveItem(item.uid) doBroadcastMessage("Parabéns, "..getCreatureName(cid).."! Você achou a "..ret[2].." "..getItemNameById (ret[1]).."!");break end end if r > 60 then doPlayerSendTextMessage(cid, 19, "Seu item falhou, tente novamente!") end return true end
não testei