Tudo que Imperius postou
- TFS 0.4 Jogadores não logam
-
[TFS 0.4] CreatureScripts (onOpenRuleViolation) + Telegram Notification
O propósito é criar uma nova função em creaturescripts que será acionada toda vez que um novo report (CTRL + R) for aberto. Eu implementei para enviar uma notificação no grupo do Telegram, contendo os dados do report. Isso garantirá que os GMs tenham acesso aos reports dos jogadores mesmo quando não estiverem logados, e também evitará que algum report seja perdido caso o jogador saia do servidor. A parte do Telegram é apenas um exemplo. Você pode ajustar o script para executar outras ações desejadas. creatureevent.cpp: Dentro deste arquivo, localize a função: uint32_t CreatureEvent::executeChannelLeave(Player* player, uint16_t channelId, UsersMap usersMap) abaixo dela, adicione: uint32_t CreatureEvent::executeOpenRuleViolation(Player* player, std::string message) { if (!m_interface->reserveEnv()) { std::clog << "[Error - CreatureEvent::executeOpenRuleViolation] Call stack overflow." << std::endl; return 0; } ScriptEnviroment* env = m_interface->getEnv(); env->setScriptId(m_scriptId, m_interface); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); lua_pushstring(L, message.c_str()); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } Após, procure por: std::string CreatureEvent::getScriptEventName() const abaixo de: case CREATURE_EVENT_CHANNEL_LEAVE: return "onLeaveChannel"; adicione: case CREATURE_EVENT_OPEN_RULE_VIOLATION: return "onOpenRuleViolation"; Agora, procure por: std::string CreatureEvent::getScriptEventParams() const abaixo de: case CREATURE_EVENT_CHANNEL_LEAVE: return "cid, channel, users"; adicione: case CREATURE_EVENT_OPEN_RULE_VIOLATION: return "cid, message"; Procure por: bool CreatureEvent::configureEvent(xmlNodePtr p) abaixo de: else if(tmpStr == "leavechannel") m_type = CREATURE_EVENT_CHANNEL_LEAVE; adicione: else if(tmpStr == "openruleviolation") m_type = CREATURE_EVENT_OPEN_RULE_VIOLATION; creatureevent.h: Dentro deste arquivo, localize: enum CreatureEventType_t adicione "CREATURE_EVENT_OPEN_RULE_VIOLATION" como o último item de enum CreatureEventType_t Exemplo: enum CreatureEventType_t { // ... CREATURE_EVENT_OPEN_RULE_VIOLATION }; Agora, procure por: uint32_t executeChannelLeave(Player* player, uint16_t channelId, UsersMap usersMap); abaixo dela, adicione: uint32_t executeOpenRuleViolation(Player* player, std::string message); game.cpp: Dentro deste arquivo, localize: bool Game::playerReportRuleViolation(Player* player, const std::string& text) e substitua por: bool Game::playerReportRuleViolation(Player* player, const std::string& text) { //Do not allow reports on multiclones worlds since reports are name-based if(g_config.getNumber(ConfigManager::ALLOW_CLONES)) { player->sendTextMessage(MSG_INFO_DESCR, "Rule violation reports are disabled."); return false; } cancelRuleViolation(player); boost::shared_ptr<RuleViolation> rvr(new RuleViolation(player, text, time(NULL))); ruleViolations[player->getID()] = rvr; ChatChannel* channel = g_chat.getChannelById(CHANNEL_RVR); if(!channel) return false; for(UsersMap::const_iterator it = channel->getUsers().begin(); it != channel->getUsers().end(); ++it) it->second->sendToChannel(player, SPEAK_RVR_CHANNEL, text, CHANNEL_RVR, rvr->time); CreatureEventList joinEvents = player->getCreatureEvents(CREATURE_EVENT_OPEN_RULE_VIOLATION); for(CreatureEventList::iterator it = joinEvents.begin(); it != joinEvents.end(); ++it) (*it)->executeOpenRuleViolation(player, text); return true; } Agora é só compilar a source. depois em "data > creaturescripts > creaturescripts.xml", adicione: <event type="login" name="loginNotifyRuleViolation" script="notifyRuleViolation.lua"/> <event type="openruleviolation" name="openNotifyRuleViolation" script="notifyRuleViolation.lua"/> em "data > creaturescripts > scripts", crie um arquivo notifyRuleViolation.lua e adicione: function onOpenRuleViolation(cid, message) local config = { token = "", -- Token do seu BOT no Telegram chatId = "" -- ID do chat do Telegram que será enviado a notificação. } local message = "Player: "..getCreatureName(cid).."\n\nReport:\n"..message.."" message = string.gsub(message, "\n", "%%0A") local url = "https://api.telegram.org/bot"..config.token.."/sendMessage" local data = "chat_id="..config.chatId.."&text="..message.."" local curl = io.popen('curl -d "'..data..'" "'..url..'"'):read("*a") return true end function onLogin(cid) registerCreatureEvent(cid, "openNotifyRuleViolation") return true end Demonstração: 1. Jogador abre um novo report (CTRL + R) 2. notifyRuleViolation.lua, definido em creaturescripts.xml, é acionado para enviar uma notificação ao grupo do Telegram.
-
(Resolvido)-=[TFS]=- 0.4 8.60 NPC PROMOTION COM MOEDA VIP 11192 SÓ PODE COMPRA PROMOTION SE TIVER 100 MOEDAS VIP
data > npc > scripts > NomeDoNPC.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 local config = { itemID = 11192, -- ID da Moeda VIP quantity = 100, -- Quantidade de moedas que o jogador precisa ter na mochila minLevel = 8 -- Level minimo que o jogador precisa ter para comprar a promotion } local itemName = getItemNameById(config.itemID) function checkPlayerHavePromotion(cid) local currentVocation = getPlayerVocation(cid) - 4 local vocationPromoted = getPromotedVocation(currentVocation) - 4 return currentVocation == vocationPromoted; end function checkPlayerHaveItems(cid, message, keywords, parameters, node) if (not npcHandler:isFocused(cid)) then return false end if (config.minLevel ~= nil and getPlayerLevel(cid) < config.minLevel) then npcHandler:say('You must reach level '..config.minLevel..' to buy promotion.', cid) return true end if checkPlayerHavePromotion(cid) then npcHandler:say('You are already promoted!', cid) return true end if (not doPlayerRemoveItem(cid, config.itemID, config.quantity)) then npcHandler:say('You do not have enough '..itemName..'!', cid) return true end doPlayerSetVocation(cid, getPlayerVocation(cid) + 4) npcHandler:say(parameters.text, cid) return true end local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, { npcHandler = npcHandler, onlyFocus = true, text = "I can promote you for "..config.quantity.." {"..itemName.."}. Do you want me to promote you?" }) node1:addChildKeyword({'yes'}, checkPlayerHaveItems, { npcHandler = npcHandler, text = "Congratulations! You are now promoted." }) node1:addChildKeyword({'no'}, StdModule.say, { npcHandler = npcHandler, onlyFocus = true, reset = true, text = "Alright then, come back when you are ready." }) npcHandler:addModule(FocusModule:new()) data > npc > NomeDoNPC.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="NomeDoNPC" script="data/npc/scripts/NomeDoNPC.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="160" head="77" body="79" legs="56" feet="115" addons="0"/> </npc>
-
Erro de sistema vip [MOD] | TFS 0.4 REV 3996
dá uma conferida no banco de dados se na tabela accounts tem a coluna vipdays ALTER TABLE `accounts` ADD `vipdays` INT(11) NOT NULL
-
Error script boss
data > creaturescripts > creaturescripts.xml <event type="kill" name="killTheBoss" event="script" value="killTheBoss.lua"/> <event type="login" name="killTheBossLogin" event="script" value="killTheBoss.lua"/> data > creaturescripts > scripts > killTheBoss.lua local config = { monsters = {"Boss Hits"}, rewards = { {itemID = 8300, chanceToGainInPercent = 10, quantity = 1}, {itemID = 8301, chanceToGainInPercent = 20, quantity = 1}, {itemID = 8302, chanceToGainInPercent = 30, quantity = 1}, {itemID = 8303, chanceToGainInPercent = 40, quantity = 1}, }, effect = 27, } -- Função para selecionar um item com base na porcentagem function selectRandomItem() local totalChance = 0 for _, reward in pairs(config.rewards) do totalChance = totalChance + reward.chanceToGainInPercent end local randomValue = math.random(1, totalChance) local cumulativeChance = 0 for _, reward in pairs(config.rewards) do cumulativeChance = cumulativeChance + reward.chanceToGainInPercent if randomValue <= cumulativeChance then return reward end end end function onKill(cid, target, lastHit) if isPlayer(cid) and isMonster(target) then if getCreatureMaster(target) ~= nil then return true end local monsterNameKilled = getCreatureName(target) if isInArray(config.monsters, monsterNameKilled) then local selectedItem = selectRandomItem() doPlayerAddItem(cid, selectedItem.itemID, selectedItem.quantity) doSendMagicEffect(getCreaturePosition(cid), config.effect) end end return true end function onLogin(cid) registerCreatureEvent(cid, "killTheBoss") return true end
-
[SQLite] -=[TFS]=- 0.4 8.60 ERRO NO SCRIPT --[MultipleExp System]-- [CREATURESCRIPT]
qual versão / servidor vc tá usando? Testei aqui sem erro na distro. única coisa que falta é colocar "return true" no final da function para os players conseguir logar no servidor
-
Sistema de encantamento
data > actions > scripts > enchantmentSystem.lua: function onUse(cid, item, frompos, item2, topos) local playerLocation = getCreaturePosition(cid) local weaponData = { -- ID da arma | ID do item de encantamento | quantidade do item de encantamento (opcional) | ID do item que a arma será transformada. {weaponId = 7735, enchantmentId = 2361, transformId = 2453}, {weaponId = 6132, enchantmentId = 2159, amountEnchantment = 10, transformId = 2646} } local positions = { weaponTable = {x = 32352, y = 31912, z = 7}, -- Onde o jogador deverá colocar a arma. enchantmentTable = {x = 32354, y = 31912, z = 7} -- Onde o jogador deverá colocar o item de encantamento. } function check() for _, data in pairs(weaponData) do local weapon = getTileItemById(positions.weaponTable, data.weaponId) local enchantment = getTileItemById(positions.enchantmentTable, data.enchantmentId) if weapon.itemid == data.weaponId and enchantment.itemid == data.enchantmentId then local amountEnchantment = enchantment.type and data.amountEnchantment or 1 if doRemoveItem(enchantment.uid, amountEnchantment) then doRemoveItem(weapon.uid, 1) doPlayerAddItem(cid, data.transformId, 1) doSendMagicEffect(playerLocation, 39) return true end end end end if not check() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sem itens necessários para o encantamento.") doSendMagicEffect(playerLocation, CONST_ME_POFF) end return true end data > actions > actions.xml: <!-- Coloque a sua ActionID da alavanca --> <action actionid="11404" event="script" value="enchantmentSystem.lua" />
-
Tirar vocation e botar por storage
Seria tipo isso? data > creaturescripts > creaturescripts.xml <event type="login" name="playerTextEffect" event="script" value="playerTextEffect.lua"/> data > creaturescripts > scripts > playerTextEffect.lua local config = { storage = 808072, -- Storage que o player precisa ter. colorsText = {10, 30, 50, 70}, -- valores que o player poderá ter no storage (cada valor corresponde a uma coloração diferente de texto) texts = {"' . ,", ". ' ,", "' . ,", ", ' ."} -- Textos que ficará saindo do jogador. } function ariseText(cid) if not isPlayer(cid) then return true end local playerColorTextEffect = getPlayerStorageValue(cid, config.storage) if not isInArray(config.colorsText, playerColorTextEffect) then return true end local playerPosition = getCreaturePosition(cid) local randomTextEffect = config.texts[math.random(1, #config.texts)] doSendAnimatedText(playerPosition, randomTextEffect, playerColorTextEffect) doSendMagicEffect(playerPosition, CONST_ME_MAGIC_GREEN) -- Efeito mágico adicionado addEvent(ariseText, 1000, cid) return true end function onLogin(cid) ariseText(cid) return true end
-
[Pedido] Spell de voltar no tempo - teleportar 5 seg no "passado"
Exemplo: data > spells > spells.xml <instant name="NOME DA MAGIA" words="NOME DA MAGIA" lvl="100" mana="160" prem="0" selftarget="1" exhaustion="60000" needlearn="0" event="script" value="support/nomedamagia.lua"> <vocation id="1"/> <vocation id="8"/> </instant> data > spells > scripts > support > nomedamagia.lua function teleportPlayer(player, position) doTeleportThing(player, position) doSendMagicEffect(position, CONST_ME_TELEPORT) end function onCastSpell(cid, var) local playerPosition = getCreaturePosition(cid) addEvent(teleportPlayer, 5000, cid, playerPosition) doSendMagicEffect(playerPosition, 13) return true end
-
(Resolvido)Script boss + teleport (Adaptação)
seria tipo isso? Não entendi mt bem como será feito p/ nascer boss, então fiz uma talkaction, aí é só vc adapta da maneira que quiser. data > lib > spawnBoss.lua BOSS_SPAWN_CONFIG = { bosses = { ["Boss Thdagger"] = { -- Nome do Boss. position = { spawnBoss = {x = 263, y = 349, z = 7 }, -- Onde o boss nascerá. openTP = {x = 0, y = 0, z = 0}, -- Onde o TP aparecerá. locationTP = {x = 0, y = 0, z = 0} -- Onde o TP levará o jogador. }, timeInSeconds = { closeTP = 60 -- segundos p/ fechar o TP após o boss ter nascido. } } -- Adicione outros bosses aqui se quiser ... } } -- Mostrará a contagem regressiva em cima do TP -- function spawnBossCountdownOnTeleport(bossCreature, teleport, timeToCloseTP) local bossName = getCreatureName(bossCreature); if not bossName then doRemoveItem(getTileItemById(teleport, 1387).uid) doSendMagicEffect(teleport, CONST_ME_POFF) return true end local timeToCloseTP = tonumber(timeToCloseTP) - 1; if timeToCloseTP == 0 then doRemoveItem(getTileItemById(teleport, 1387).uid) doSendMagicEffect(teleport, CONST_ME_POFF) return true end doSendAnimatedText(teleport, timeToCloseTP, 725) addEvent(spawnBossCountdownOnTeleport, 1000, bossCreature, teleport, timeToCloseTP); return true end data > talkactions > scripts > spawnBoss.lua function onSay(cid, words, param, channel) local bossName = param; if not BOSS_SPAWN_CONFIG.bosses[bossName] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Boss nao encontrado! Escreva o nome corretamente, incluindo letras maiuscula/minuscula.") return true end local bossCreature = doCreateMonster(bossName, BOSS_SPAWN_CONFIG.bosses[bossName].position.spawnBoss) doCreateTeleport(1387, BOSS_SPAWN_CONFIG.bosses[bossName].position.locationTP, BOSS_SPAWN_CONFIG.bosses[bossName].position.openTP) spawnBossCountdownOnTeleport(bossCreature, BOSS_SPAWN_CONFIG.bosses[bossName].position.openTP, BOSS_SPAWN_CONFIG.bosses[bossName].timeInSeconds.closeTP); doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOSS: "..bossName.." foi criado!") return true end data > talkactions > talkactions.xml <!-- Spawn Boss --> <talkaction access="5" words="/boss" script="spawnBoss.lua"/> /boss nome do boss
-
Eu Necessito de Um Script /online Que Mostrasse os Player o Level e as Vocações e os Resets Storage do Reset: 54676
data > talkactions > scripts > online.lua function onSay(cid, words, param, channel) local quantityOnline = 0 for _, pid in ipairs(getPlayersOnline()) do if getPlayerAccess(pid) < 4 then quantityOnline = quantityOnline + 1 local playerReset = getPlayerStorageValue(pid, 54676) playerReset = (playerReset > 0) and playerReset or 0 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..getCreatureName(pid).." ["..getPlayerLevel(pid).."] - "..getPlayerVocationName(pid).." | Resets: "..playerReset.."") end end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, quantityOnline.." Player(s) online") return true end
-
-=[TFS]=- 0.4 8.60 [NPC] eu tenho script de compra item no npc com moeda diferente porem nao pega mesmo tando com a moeda vip coin 11192
aqui funcionou de boa Só que tem um porém: o NPC só vai liberar a opção de "buy" se você tiver a mesma quantidade de gold na backpack em relação ao preço do item em moeda vip.
-
[TFS 0.4] Treasure Chest Lottery + PHP Page
Olá, pessoal! Acabei encontrando um script que tinha feito a um tempo atrás. Estou compartilhando aqui para quem quiser usar ou melhorar. É bem parecido com os outros sistemas de roleta, igual deste tópico: https://tibiaking.com/forums/topic/101557-action-cassino-roleta-de-items/ Como funciona? O "Treasure Chest" é um item custom, onde o jogador têm a possibilidade de ganhar itens raros ou bem meia boca. Tudo dependerá da sorte. O jogador precisa tacar o treasure chest na bancada e acionar a alavanca. O treasure chest irá se transformar em vários itens de forma randômica no qual o jogador poderá ou não ganhar. No final, apenas um item é entregue ao jogador. Para entender melhor o seu funcionamento, segue o GIF abaixo: em data > actions > actions.xml em data > actions > scripts > crie um arquivo chamado leverTreasureChest.lua no banco de dados do servidor, adicione o seguinte código em "SQL": Também estou disponibilizando uma página PHP, para quem quiser usar no site do servidor. Na página tem informações sobre o funcionamento, quais são os possíveis prêmios e a lista de jogadores que ganharam os itens raros. Espero ter ajudado de alguma forma! : ) treasure_chest.php
-
[AJUDA] Systema Vip
Você pode fazer algo do tipo: function calculaFimVip(storageValue) -- diferença em segundos local diferenca = storageValue - os.time() -- conversão em dias local diasRestantes = math.floor(diferenca / 86400) + 1 if diasRestantes >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "voce ainda tem "..diasRestantes.." dia(s) de VIP") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "seu VIP acabou") end end calculaFimVip(getPlayerStorageValue(cid, 55489))
-
[TFS 0.4] SafeZone Event - Adaptação de compatibilidade
Olá! Fiz uma adaptação no evento "SafeZone" criado e disponibilizado aqui no TK por @Movie e @luanluciano93. Agora o evento é compatível para TFS 0.4. IMPORTANTE: Como mencionado anteriormente, o evento foi criado por "Movie" e "LuanLuciano93". Eu (imperius) APENAS ADAPTEI para funcionar em TFS 0.4. Todos os créditos do evento vão para os criadores originais. Além disso, é importante alertar que esta adaptação não está 100%. Abaixo está todo o processo explicando como configurar e rodar o evento em seu servidor! Vídeo demonstrativo: em data > lib > crie um arquivo chamado safeZone.lua data > globalevents > globalevents.xml em data > globalevents > scripts > crie um arquivo chamado safeZoneEvent.lua data > movements > movements.xml em data > movements > scripts > crie um arquivo chamado safeZoneMovement.lua por fim, vá até o banco de dados do seu servidor e adicione o seguinte código em "SQL" É isso! Espero ter ajudado o pessoal do TFS 0.4
-
[8.60 | TFS 0.4] - NPC Gênio da Lâmpada
Olá! Estou disponibilizando um NPC que desenvolvi. Porém, devo avisar que só testei em TFS 0.4, e não posso garantir que funcionará em outras versões. Sobre: O NPC em questão é o "Gênio da Lâmpada". Para chegar até ele, o jogador precisa ter a "Lâmpada Mágica", que pode ser adquirida através de uma quest ou em algum evento do servidor, por exemplo. A lâmpada pode ser usada apenas uma vez e, mesmo que o jogador obtenha outra lâmpada, não poderá usá-la novamente. Ao usar a Lâmpada, o jogador será teleportado para a sala do Gênio. Lá, ele não poderá sair até realizar os três desejos. O Gênio pode atender desejos como "entregar itens", "reiniciar tasks", "completar addons" e até mesmo "matar um jogador". Você pode personalizar o NPC para oferecer outras recompensas, como "vip days", "premium points" ou "remover redskull". Seja criativo! :) Após o Gênio realizar os três desejos, o jogador será teleportado para o seu templo de origem. Vídeo demonstrativo: data > actions > actions.xml data > actions > lampadaDoGenio.lua data > npc > Genio.xml data > npc > scripts > Genio.lua Isso é tudo! Se tiverem sugestões ou dúvidas, estou à disposição!
-
[RESOLVIDO] VIP COIN
qual versão? Testei apenas em tfs 0.4 Veja se isso resolve o problema. Acesse o banco de dados do seu servidor e procure na tabela "accounts" pelo nome da coluna que corresponde aos pontos. Depois, altere a query do arquivo coin.lua para que fique de acordo com o nome exato da coluna dos pontos encontrada na tabela. query("UPDATE accounts SET NOME_DA_COLUNA_DOS_PONTOS = NOME_DA_COLUNA_DOS_PONTOS + 1 WHERE id = '"..pid.."' LIMIT 1")
-
[RESOLVIDO] VIP COIN
data > actions > actions.xml <!-- adicione a ID do item --> <action itemid="xxxx" script="coin.lua" /> data > actions > scripts > coin.lua function onUse(cid, item) local itemName = getItemNameById(item.itemid) local pid = getPlayerGUID(cid) local query = db.query or db.executeQuery query("UPDATE accounts SET premium_points = premium_points + 1 WHERE id = '"..pid.."' LIMIT 1") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "voce usou 1 "..itemName.." e ganhou 1 premium points") doSendMagicEffect(getCreaturePosition(cid), 28) doRemoveItem(item.uid, 1) return true end
-
Editar Items Imagem (Equipes) Gesior.
Outfit animado: http://outfit-images.ots.me/animatedOutfits1090/animoutfit.php?id=128&addons=0&head=115&body=69&legs=18&feet=95 Outfit estático: http://outfit-images.ots.me/outfit.php?id=128&addons=0&head=0&body=0&legs=0&feet=0 Só adicionar na tag img, (editando as propriedades, id, addons, head, body, etc..) exemplo: <img src="http://outfit-images.ots.me/animatedOutfits1090/animoutfit.php?id=128&addons=0&head=115&body=69&legs=18&feet=95" />
-
Monstro X nascer depois que 10 monstros Y forem mortos.
data > creaturescripts > creaturescripts.xml: <event type="kill" name="killMonster" script="killMonster.lua"/> creaturescripts > scripts > killMonster.lua: Contabilizar a morte do monstro para todos os jogadores. Ex: se um jogador matar 7 wolfs e algum outro jogador matar 3 O boss vai aparecer. Contabilizar de forma individual ex: o jogador precisará matar os 10 para nascer o boss. creaturescripts > scripts > login.lua > adicione isso antes do último return true: registerCreatureEvent(cid, "killMonster")
-
Pedido de ajuda Erro Rme
(não tenho certeza se vai funcionar), mas tente reinstalar o RME. Depois quando abrir normalmente, desative a opção "Check file signatures" que você encontra em File > Preferences > Client Version > desmarque a opção, clique em "Apply" e dps em "Ok". Agora, se o problema acontece quando você tenta abrir algum mapa em específico, tente ao em vez de abrir, importa-lo.
-
Alguém Me ajuda com esse erro, por favor.
Compartilhe o arquivo "goback.lua" que está em data > actions > scripts. Compartilhe também o arquivo "some functions.lua" em data > lib.
-
Ajuda criar tabela no mysql
Abra o banco de dados "baiak2" e executa isso no SQL: CREATE TABLE `top_mining` ( `id` int(11) NOT NULL, `player_id` int(11) DEFAULT NULL, `lvl` int(11) DEFAULT NULL, `exp` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ALTER TABLE `top_mining` ADD PRIMARY KEY (`id`), MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-
Baú de recompensa de item modificado
Tipo isso? em data > actions > actions.xml: <!-- Baú Recompensa --> <action uniqueid="6600" script="bauRecompensa.lua" /> actions > scripts> bauRecompensa.lua: function onUse(cid, item, fromPosition, itemEx, toPosition) local storage = 555000 local cooldown = 7 -- tempo em (dias). local recompensasID = {12624, 12625, 12626} local randomRecompensa = recompensasID[math.random(1, #recompensasID)] -- function de tempo by FeeTads. local function getTimeString(self) local format = { {'dia', self / 60 / 60 / 24}, {'hora', self / 60 / 60 % 24}, {'minuto', self / 60 % 60}, {'segundo', self % 60} } local out = {} for k, t in ipairs(format) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find('segundo') then local a, b = ret:find(' e ') ret = ret:sub(b+1) end return ret end if getPlayerStorageValue(cid, storage) - os.time() >= 1 then doPlayerSendCancel(cid, "Voce precisa aguardar "..getTimeString((getPlayerStorageValue(cid, storage)-os.time())).." para usar o bau.") return true end local item = doPlayerAddItem(cid, randomRecompensa, 1) doSendMagicEffect(getThingPos(cid), 30) if randomRecompensa == 12624 then -- NGO Kunai -- local attack = math.random(600, 1200) doItemSetAttribute(item, "attack", attack) doPlayerSendTextMessage(cid, 22, "Congratulations! You received a "..getItemNameById(randomRecompensa).. " with attack "..attack.."") elseif randomRecompensa == 12625 then -- NGO Shield -- local defense = math.random(100, 600) doItemSetAttribute(item, "defense", defense) doPlayerSendTextMessage(cid, 22, "Congratulations! You received a "..getItemNameById(randomRecompensa).. " with defense "..defense.."") elseif randomRecompensa == 12626 then -- NGO Sword -- local attack = math.random(600, 1200) doItemSetAttribute(item, "attack", attack) doPlayerSendTextMessage(cid, 22, "Congratulations! You received a "..getItemNameById(randomRecompensa).. " with attack "..attack.."") end setPlayerStorageValue(cid, storage, os.time() + (cooldown)*86400) -- Seta o Cooldown em (dias). return true end Só consegui fazer para setar alguns atributos, pelo que vi (não tenho certeza) os demais atributos não vem configurados, então você terá que mexer na source se quiser adiciona-los dessa forma.
-
spawn de estatua
faltou adicionar o getCreatureByName() veja se agora funciona: local id = 7307 -- ItemId da Estatua local intervalo = 5 -- Tempo em segundos para estatua voltar local npc = "defender" -- Nome do monsto a ser sumonado function onUse(cid, item, fromPosition, itemEx, toPosition) doRemoveItem(item.uid, 1) doCreateNpc(npc, toPosition) addEvent(function() doCreateItem(id, 1, toPosition) doSendMagicEffect(toPosition, 43) doRemoveCreature(getCreatureByName(npc), toPosition) end, intervalo * 1000) return true end