Tudo que Anderson Sacani postou
-
SÓ VENDE ITEM PRA NPC SE TIVER STORAGE
Eu consigo te ajudar, mas preciso que faça um teste. Use esse script e venda o ancient amulet pro NPC. Fica de olho no console do teu servidor e me diz se vai retornar o nome do teu persaongem: 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 shopModule = ShopModule:new() npcHandler:addModule(shopModule) shopModule:addSellableItem({ 'ancient amulet' }, 2142, 200, 'ancient amulet', function() print(player:getName()) end) npcHandler:addModule(FocusModule:new()) Se retornar o nome do teu personagem, já consigo resolver
-
-=[TFS]=- 0.4 8.60 USAR MAGIA SE TIVER "X" ITEM QUERO YELLOW GEM QUE QUANDO DA USE ELE USA A MAGIA E SOME YELLOW GEM SE JA USOU A MAGIA AI PRECISA DE OUTRA YELLOW GEM
local config = { itemId = 2154, vocationId = 2, vocationName = "clerigo", minLevel = 500, } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1000.0, -1000.0, -1000.0, -1000.0) local arr = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, } setCombatArea(combat, createCombatArea(arr)) function onUse(cid, item, fromPosition, itemEx, toPosition) if not getPlayerVocation(cid) == config.vocationId then doPlayerSendCancel(cid, "Para usar a gema voce precisa ser um " .. config.vocationId) return false end if getPlayerLevel(cid) < config.minLevel then doPlayerSendCancel(cid, "Para usar a gema voce precisa ter pelo menos nivel " .. config.minLevel) return false end local itemId, amount = config.itemId, 1 if getPlayerItemCount(cid, config.itemId) >= amount then doPlayerRemoveItem(cid, itemId, amount) return doCombat(cid, combat, var) and true end end Melhoramento no script: local config = { itemId = 2154, vocationId = 2, vocationName = "clerigo", minLevel = 500, } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1000.0, -1000.0, -1000.0, -1000.0) local arr = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, } setCombatArea(combat, createCombatArea(arr)) function onUse(cid, item, fromPosition, itemEx, toPosition) if not getPlayerVocation(cid) == config.vocationId then return doPlayerSendCancel(cid, "Para usar a gema voce precisa ser um " .. config.vocationId) and false end if getPlayerLevel(cid) < config.minLevel then return doPlayerSendCancel(cid, "Para usar a gema voce precisa ter pelo menos nivel " .. config.minLevel) and false end local itemId, amount = config.itemId, 1 if getPlayerItemCount(cid, config.itemId) >= amount then doPlayerRemoveItem(cid, itemId, amount) return doCombat(cid, combat, var) and true else return doPlayerSendCancel(cid, getItemNameById(config.itemId) .. " precisa estar com voce.") and false end end
-
(Resolvido)Change Name Scroll
local scrollId = 1234 function onSay(cid, words, param) if param == "" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'To use the command: !changename "NEW_NAME') return false end if getPlayerItemCount(cid, scrollId) < 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need a ' .. getItemNameById(scrollId)) return false end if getTilePzInfo(getPlayerPosition(cid)) ~= true then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You can only use this command in a protected area.') return false end doPlayerRemoveItem(cid, scrollId, 1) local guid = getPlayerGUID(cid) doRemoveCreature(cid) db.executeQuery("UPDATE `players` SET `name` = '" .. param .. "' WHERE `id` = " .. guid .. ";") doRemoveCreature(guid) return true end Achei um script bem mais completo do que esse que criei: local config = { item = {Id = 1111, count = 0}, paramBlacklist = {"account manager", "god", "tutor", "tester"}, kick = {enabled = true, delay = 2 * 1000}, forceLogout = false, namelockCheck = true, vowelsCheck = true, maxTextLenght = 29, minWordLenght = 2, maxWordLenght = 14, maxWords = 3 } config.kick.enabled = getBooleanFromString(config.kick.enabled) config.forceLogout = getBooleanFromString(config.forceLogout) config.namelockCheck = getBooleanFromString(config.namelockCheck) config.vowelsCheck = getBooleanFromString(config.vowelsCheck) function onSay(cid, words, param, channel) local t = string.explode(param, ",") local len, firstWord, wordCount, textCancel, limit = string.len(tostring(t[1])), true, 0, '', ";" if(getConfigValue('sqlType') == 'mysql') then limit = db.updateLimiter() end if(param == '') then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") elseif(getPlayerGUIDByName(t[1], true) ~= nil) then textCancel = "That name is already in use." elseif(getPlayerItemCount(cid, config.item.Id) < config.item.count) then textCancel = "You do not fulfill the requirements." elseif(not getTilePzInfo(getCreaturePosition(cid))) then textCancel = "You must be inside a protection zone to use this command." elseif(len > config.maxTextLenght) then textCancel = "A name must have at least " .. config.minWordLenght .. " but no more than " .. config.maxTextLenght .. " letters!" elseif(config.namelockCheck and db.getResult("SELECT * FROM `player_namelocks` WHERE `name` = " .. db.escapeString(t[1]) .. "" .. limit .. ""):getID() ~= 1) then textCancel = "That name is namelocked." elseif(string.find(t[1]:lower(), "[^%l%s]") ~= nil) then textCancel = "This name contains invalid letters. Please use only A-Z, a-z and space!" else paramTemp = '' for word in string.gmatch(t[1], "%a+") do len, wordCount = string.len(word), wordCount + 1 if(isInArray(config.paramBlacklist, paramTemp:lower())) then textCancel = "Invalid name entry." break elseif(len < config.minWordLenght) then textCancel = "This name contains a word with only " .. len .. " letter" .. (len > 1 and "s" or '') .. ". Please use more than " .. len .. " letter" .. (len > 2 and "s" or '') .. " for each word!" break elseif(len > config.maxWordLenght) then textCancel = "This name contains a word that is too long. Please use no more than " .. config.maxWordLenght .. " letters for each word!" break elseif(wordCount > config.maxWords) then textCancel = "This name contains more than 3 words. Please choose another name!" break elseif(config.vowelsCheck and string.find(word:lower(), "[aeiouy]") == nil) then textCancel = "This name contains a word without vowels. Please choose another name!" break else wordTemp = '' for i = 1, len do letter = string.sub(word, i, i) if(i == 1) then if(getBooleanFromString(firstWord) and string.find(letter, "%l")) then letter = string.upper(letter) end else if(string.find(letter, "%u")) then letter = string.lower(letter) end end firstWord = false wordTemp = "" .. wordTemp .. "" .. letter .. "" end end paramTemp = "" .. paramTemp .. "" .. (paramTemp ~= '' and " " or '') .. "" .. wordTemp .. "" end end if(textCancel ~= '') then doPlayerSendCancel(cid, textCancel) return true end local oldName, guid = getCreatureName(cid), getPlayerGUID(cid) t[1] = paramTemp doPlayerRemoveItem(cid, config.item.Id, config.item.count) if(pcall(doPlayerChangeName, guid, oldName, t[1]) ~= true) then db.executeQuery("INSERT INTO `player_namelocks` (`player_id`, `name`, `new_name`, `date`) VALUES (" .. guid .. ", " .. db.escapeString(oldName) .. ", " .. db.escapeString(t[1]) .. ", " .. os.time() .. ");") db.executeQuery("UPDATE `players` SET `name` = " .. db.escapeString(t[1]) .. " WHERE `id` = " .. guid .. "" .. limit .. "") end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your name has been changed successfully." .. (config.kick.enabled and " You will be kicked in " .. config.kick.delay / 1000 .. " seconds." or " Re-enter the game to see the changes.") .. "") if(config.kick.enabled) then addEvent(function(cid, forceLogout) if(isPlayer(cid)) then doRemoveCreature(cid, forceLogout) end end, config.kick.delay, cid, config.forceLogout) end return true end A parte do .xml fica assim: <talkaction log="yes" words="!changename;/changename;!namechange;/namechange" access="0" event="script" value="changename.lua"/>
-
(Resolvido)Change Name Scroll
Desta maneira que pediu é bem complicado fazer. Não é impossível, mas é complicado e precisará de um Otclient, além disso precisará do sistema de ExtendedOpcode pra enviar e receber pacotes custom, mas eu tenho uma solução. Vou criar um script de talkaction que ao usar o comando !changename, o algorítimo removerá o scroll. Caso o jogador não tenho o scroll, o algorítimo retornará que é impossível de realizar esta ação.
-
(Resolvido)Change Name Scroll
Onde o jogador define qual será o novo nome? Preciso saber disso pra ajeitar esse script
-
Script para limitar o uso da corda igual nas versões antigas
Não entendi, mas se teu servidor tem suporte à revscripts usa esse script que criei um tempo atrás: local holeId = { 294, 369, 386, 370, 385, 394, 411, 412, 413, 432, 433, 435, 8709, 594, 595, 615, 609, 610, 615, 1156, 482, 483, 868, 874, 4824, 7768, 433, 432, 413, 7767, 411, 370, 369, 7737, 7755, 7768, 7767, 7515, 7516, 7517, 7518, 7519, 7520, 7521, 7522, 7762, 8144, 8690, 8709, 12203, 12961, 17239, 19220, 23364 } local ropeSpots = { 386, 421, 386, 7762, 12202, 12936, 14238, 17238, 23363, 21965, 21966, 21967, 21968 } local specialRopeSpots = { 12935 } local rope = Action() function rope.onUse(player, item, fromPosition, target, toPosition, isHotkey) newPos = { x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0 } target = getThingfromPos(newPos) blockingItem = getThingfromPos({ x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE }) if ((isInArray(ropeSpots, target.itemid)) or (isInArray(specialRopeSpots, target.itemid))) then newPos.y = newPos.y + 1 newPos.z = newPos.z - 1 if ((blockingItem.itemid > 0) or (isCreature(target.uid) == true)) then player:sendTextMessage(MESSAGE_FAILURE, "Sorry, not possible.") else player:teleportTo(newPos) end elseif isInArray(holeId, target.itemid) then newPos.y = newPos.y + 1 downPos = { x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = 255 } downItem = getThingfromPos(downPos) if (downItem.itemid > 0) then doTeleportThing(downItem.uid, newPos) else player:sendTextMessage(MESSAGE_FAILURE, "Sorry, not possible.") end end return true end rope:id(3003, 646) rope:register()
-
Script para limitar o uso da corda igual nas versões antigas
Qual versão do teu servidor?
-
[Revscripts] Premium Scroll
Qual versão de servidor está usando? Provavelmente teu servidor não aceita revscripts.
-
[Revscripts] Premium Scroll
local config = { scrollId = 14758, premiumDays = 30, } local days = config.premiumDays local premiumScroll = Action() function premiumScroll.onUse(player, item, fromPosition, target, toPosition, isHotkey) player:addPremiumDays(days) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu " .. days .. " dias de conta premium.") item:remove(1) addEvent(function() if player:isPlayer() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "No total voce tem " .. player:getPremiumDays() .. " dias de conta premium.") end end, 2500) return true end premiumScroll:id(config.scrollId) premiumScroll:register() Percebi que alguns servidores estão vindo sem o script do premium scroll, então criei esse script para adicionar 30 dias de premium na conta do jogador que usar o premium scroll.
-
-=[TFS]=- 0.4 8.60 Server Crachando [ENCERRANDO] em "Running Database" Mudei Pra SQLite Pra Mysql
No config.lua, como está a parte do SQL? Mostra aqui pra nós
-
Idiomas para o jogo, português e espanhol
Estou criando um servidor com base nos scripts de TFS 1.x e voltado ao público da america latina por causa do baixo ping na VPS... Argentina, Bolívia, Brasil, Chile, entre outros, portanto sei que falamos em português e nossos vizinhos em espanhol. Todos os sistemas do meu servidor são pensados para terem traduções e venho por meio deste tópico compartilhar à vocês algumas dessas funções: Antes de qualquer coisa, você precisará adicionar a seguinte variável em alguma biblioteca: USER_LANGUAGE = 1022118443 Agora que adicionou essa variável em alguma biblioteca, poderá adicionar as seguintes funções na mesma biblioteca, porém a baixo da variável USER_LANGUAGE. A primeira função serve para retornar qual idioma o player está usando: --[[ getLanguage, how to use: player:getLanguage() ]] function Player.getLanguage(self) if self:isPlayer() then if self:getStorageValue(USER_LANGUAGE) < 1 then return "portuguese" else return "spanish" end else print("getLanguage: Only works on players..") end end Um exemplo de como usar: player:getLanguage() A segunda função serve para alterar o idioma do player. O ideal é que seja usada na primeira vez em que o player loga no servidor: --[[ setLanguage, how to use: player:setLanguage("portuguese") ]] function Player.setLanguage(self, language) local value = 0 if self:isPlayer() then if language == "portuguese" then value = 0 elseif language == "spanish" then value = 1 else print("setLanguage: Only two options available. Choose one of them: 'portuguese' or 'spanish'.") end return self:setStorageValue(USER_LANGUAGE, value) else print("setLanguage: Only works on players..") end end Exemplos de como usar: player:setLanguage("portuguese") ou player:setLanguage("spanish") A terceira e não menos importante função, serve para mandar uma mensagem de texto ao jogador, porém ele receberá no idioma em que escolheu: --[[ sendLanguageTextMessage, how to use: local portugueseMessage = "Ola, tudo bom? Isto aqui é um algoritmo!" local spanishMessage = "Hola todo bien? Esto de aqui es un algoritmo!" player:sendLanguageTextMessage(MESSAGE_EVENT_ADVANCE, portugueseMessage,spanishMessage) ]] function Player.sendLanguageTextMessage(self, type, portugueseMessage, spanishMessage) if self:isPlayer() then if self:getStorageValue(USER_LANGUAGE) < 1 then return self:sendTextMessage(type, portugueseMessage) else return self:sendTextMessage(type, spanishMessage) end else print("sendLanguageTextMessage: Only works on players..") end end Um exemplo de como usar: player:sendLanguageTextMessage(MESSAGE_EVENT_ADVANCE, portugueseMessage, spanishMessage) O primeiro parâmetro é o tipo de mensagem, o segundo parâmetro será a mensagem em português e o terceiro parâmetro será em espanhol.
-
Change Sex Com HAT
Como falei, você adicionou as linhas fora da função 'function onLogin', no caso substitua por esse: local config = { loginMessage = getConfigValue('loginMessage'), useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) } function onLogin(cid) if (getBooleanFromString(getConfigValue('accountManager')) == false) then if (getCreatureName(cid) == "Account Manager") then return doRemoveCreature(cid, true) end end local loss = getConfigValue('deathLostPercent') if (loss ~= nil and getPlayerStorageValue(cid, "bless") ~= 5) then doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 7) end if (getPlayerStorageValue(cid, "death_bless") == 1) then local t = { PLAYERLOSS_EXPERIENCE, PLAYERLOSS_SKILLS, PLAYERLOSS_ITEMS, PLAYERLOSS_CONTAINERS } for i = 1, #t do doPlayerSetLossPercent(cid, t[i], 100) end setPlayerStorageValue(cid, "death_bless", 0) end local accountManager = getPlayerAccountManager(cid) if (accountManager == MANAGER_NONE) then local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage if (lastLogin > 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." else str = str .. " Please choose your outfit." doPlayerSendOutfitWindow(cid) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) elseif (accountManager == MANAGER_NAMELOCK) then addEvent(valid(doCreatureSay), 500, cid, "Hello, it appears that your character has been locked for name violating rules, what new name would you like to have?" , TALKTYPE_PRIVATE_NP, true, cid) elseif (accountManager == MANAGER_ACCOUNT) then addEvent(valid(doCreatureSay), 500, cid, "Hello, type 'account' to manage your account. If you would like to start over, type 'cancel' anywhere.", TALKTYPE_PRIVATE, true, cid) else addEvent(valid(doCreatureSay), 500, cid, "Hello, type 'account' to create an account or 'recover' to recover an account.", TALKTYPE_PRIVATE, true, cid) end if (not isPlayerGhost(cid)) then doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) end registerCreatureEvent(cid, "Idle") registerCreatureEvent(cid, "Mail") registerCreatureEvent(cid, "PVPCreature") registerCreatureEvent(cid, "ReportBug") if (config.useFragHandler) then registerCreatureEvent(cid, "SkullCheck") end registerCreatureEvent(cid, "GuildEvents") registerCreatureEvent(cid, "AdvanceSave") registerCreatureEvent(cid, "FimVip") registerCreatureEvent(cid, "ProtectLevel") if (InitArenaScript ~= 0) then InitArenaScript = 1 for i = 42300, 42309 do setGlobalStorageValue(i, 0) setGlobalStorageValue(i + 100, 0) end end if getPlayerStorageValue(cid, 42309) < 1 then for i = 42300, 42309 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42319) < 1 then for i = 42310, 42319 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42329) < 1 then for i = 42320, 42329 do setPlayerStorageValue(cid, i, 0) end end if getPlayerStorageValue(cid, 42355) == -1 then setPlayerStorageValue(cid, 42355, 0) end setPlayerStorageValue(cid, 42350, 0) setPlayerStorageValue(cid, 42352, 0) doPlayerSendTextMessage(cid, TALKTYPE_PRIVATE, "New feature: now you can use command <!auto spell, mana> ex: <!auto exura, 25>") doPlayerSendTextMessage(cid, TALKTYPE_PRIVATE, "This command will automatically eat food for you, It work for making runes.>.") --[[ Se o persoangem têm a storage 5937910, irá automáticamente receber o addon do chapéu; Se for homem, receberá o chapéu do mage; Se for mulher, receberá o chapéu da summoner; ]] if getPlayerStorageValue(cid, 5937910) ~= -1 then if getPlayerSex(cid) == 1 then doPlayerAddOutfit(cid, 412, 2) else doPlayerAddOutfit(cid, 316, 2) end end return true end
-
Change Sex Com HAT
Mostra o arquivo de login.lua, provavelmente tu adicionou estas linha a cima da função 'function onLogin'
-
Change Sex Com HAT
Agora entendi tua pergunta haha Quando for masculino, ele terá o mage full, que no caso tem hat; Quando for feminino, ele terá o summoner full, que também tem o hat; Modifique o script já existente para este: function onUse(cid, item, itemEx, toPosition) local sex, outfit = 1, getCreatureOutfit(cid) if getPlayerSex(cid) == 1 then sex = 0 end local look = outfit.lookType if (((look == 412) or (look == 316)) and (outfit.lookAddons > 1)) then doPlayerSetStorageValue(cid, 5937910, 1) end doPlayerSetSex(cid, sex) doRemoveItem(item.uid, 1) doPlayerSendTextMessage(cid, 22, "Changesex successfully!") addEvent(function() if isPlayer(cid) then doRemoveCreature(cid) end end, 1500) return true end E no script de login.lua adicione essas linhas: if getPlayerStorageValue(cid, 5937910) ~= -1 then if getPlayerSex(cid) == 1 then doPlayerAddOutfit(cid, 412, 2) else doPlayerAddOutfit(cid, 316, 2) end end
-
Change Sex Com HAT
Faz teste invertendo os looktype do Summoner e do Mage, mas apenas do sexo que ta dando problema. E mais uma coisa... Esse teu script não precisa ser tão grande, recomendo substituir por esse: function onUse(cid, item, itemEx, toPosition) local sex = 1 if getPlayerSex(cid) == 1 then sex = 0 end doPlayerSetSex(cid, sex) doRemoveItem(item.uid, 1) doPlayerSendTextMessage(cid, 22, "Changesex successfully!") addEvent(function() if isPlayer(cid) then doRemoveCreature(cid) end end, 1500) return true end
-
Change Sex Com HAT
Posta o arquivo outfits.xml também
-
Script Moviments Tilers
Acabei de criar o script pra tu testar, não testei porque não tenho otserv aqui, mas pela lógica é para funcionar: local config = { storage = 6687438, text = "You can only spend once every 20 hours.", walk = true, hour = 20, -- Twenty hours } function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then local osTime = os.time() if getPlayerStorageValue(cid, config.storage) > osTime then doTeleportThing(cid, fromPosition, config.walk) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, config.text) else doPlayerSetStorageValue(cid, config.storage, osTime + (config.hour * 60 * 60)) end end return true end Fiz uma modificação e agora adicionei uma condição extra. Caso queira que esse piso teleporte o jogador para outro local, basta deixar a variável active como true, caso queira que funcione apenas da maneira que você pediu basta deixar como false: local config = { storage = 6687438, text = "You can only spend once every 20 hours.", walk = true, hour = 20, -- Twenty hours teleport = { active = false, goToPosition = { x = 100, y = 100, z = 7 }, }, } function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if isPlayer(cid) then local osTime = os.time() if getPlayerStorageValue(cid, config.storage) > osTime then doTeleportThing(cid, fromPosition, config.walk) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, config.text) else if config.teleport.active then doTeleportThing(cid, config.teleport.goToPosition, config.walk) end doPlayerSetStorageValue(cid, config.storage, osTime + (config.hour * 60 * 60)) end end return true end
-
Portal em determinado horário
Surgimento de portal com horário pré definido Revscript para surgimento de portal em determinado horário, com configurações ajustáveis O que o script faz? Cria um portal as 10:00 no local que recebeu a variável portalPosition, e o mesmo teletransporta jogadores para o destino que recebeu a variável goToPosition. Na variável time você pode alterar o horário em que o portal será criado. local config = { time = "10:00:00", portalPosition = { x = 100, y = 100, z = 7 }, goToPosition = { x = 200, y = 200, z = 7 }, broadcast = true, text = "A portal appeared inside the dark mage's house.", } local portal = GlobalEvent("Portal") function portal.onTime(interval) local item = Game.createItem(1387, 1, config.portalPosition) if item:isTeleport() then item:setDestination(config.goToPosition) if config.broadcast then Game.broadcastMessage(config.text, MESSAGE_EVENT_ADVANCE) end end end portal:time(config.time) portal:register()
-
Como faço o LookType do Cake Golem?
No arquivo do monstro, ao invés de usar: <look type=" usa o: <look typeex=" Lembrando de fechar o aspas. Quando tu usa o typeex, tu pode colocar o id do item, por exemplo um cake.
-
Compro script para pesca em otpokemon
Qual tua ideia? Publica ai que eu faço sem custos, mas ficará visível para todos
-
[PEDIDO] Monstro sangrando Gold.
Da maneira a cima não funcionará, pois é um creaturescript com algoritmo de onAttack, ou seja, se a pessoa atacar o monstro, mesmo não dando hit, o monstro sangrará o gold. A maneira correta é um script dentro do monstro. Eu fiz na função onThink, então ele vai verificar de tempo em tempo o algoritmo. Eu alterei o script do teu monstro, desta maneira: local mType = Game.createMonsterType("Treasure Bandit") local monster = {} monster.description = "a treasure bandit" monster.experience = 600 monster.outfit = { lookType = 129, lookHead = 58, lookBody = 40, lookLegs = 24, lookFeet = 95, lookAddons = 0, lookMount = 0 } monster.raceId = 223 monster.Bestiary = { class = "Human", race = BESTY_RACE_HUMAN, toKill = 500, FirstUnlock = 25, SecondUnlock = 250, CharmsPoints = 5, Stars = 2, Occurrence = 0, Locations = "Pode ser encontrado nas redondezas de Mortland." } monster.health = 1200 monster.maxHealth = 1200 monster.race = "blood" monster.corpse = 18050 monster.speed = 180 monster.manaCost = 450 monster.changeTarget = { interval = 5000, chance = 0 } monster.strategiesTarget = { nearest = 30, health = 10, damage = 10, random = 50, } monster.flags = { summonable = false, attackable = true, hostile = true, convinceable = false, pushable = false, rewardBoss = false, illusionable = true, canPushItems = true, canPushCreatures = true, staticAttackChance = 90, targetDistance = 4, runHealth = 240, healthHidden = false, isBlockable = false, canWalkOnEnergy = true, canWalkOnFire = true, canWalkOnPoison = true } monster.light = { level = 0, color = 0 } monster.voices = { interval = 6000, chance = 10, { text = "Não fui eu!", yell = false }, { text = "Tente me pegar!", yell = false } } monster.loot = { { name = "gold coin", chance = 83940, maxCount = 40 }, -- { name = "platinum coin", chance = 29900, maxCount = 2 }, -- { name = "meat", chance = 12350 }, -- { name = "rope belt", chance = 4110 } } monster.attacks = { { name = "melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -68 }, { name = "combat", interval = 3000, chance = 30, type = COMBAT_PHYSICALDAMAGE, minDamage = 0, maxDamage = -80, range = 7, shootEffect = CONST_ANI_SPEAR, target = false } } monster.defenses = { defense = 25, armor = 20 } monster.elements = { { type = COMBAT_PHYSICALDAMAGE, percent = 5 }, { type = COMBAT_ENERGYDAMAGE, percent = 10 }, { type = COMBAT_EARTHDAMAGE, percent = 10 }, { type = COMBAT_FIREDAMAGE, percent = 0 }, { type = COMBAT_LIFEDRAIN, percent = 0 }, { type = COMBAT_MANADRAIN, percent = 0 }, { type = COMBAT_DROWNDAMAGE, percent = 0 }, { type = COMBAT_ICEDAMAGE, percent = -10 }, { type = COMBAT_HOLYDAMAGE, percent = 0 }, { type = COMBAT_DEATHDAMAGE, percent = -5 } } monster.immunities = { { type = "paralyze", condition = false }, { type = "outfit", condition = false }, { type = "invisible", condition = false }, { type = "bleed", condition = false } } local maxHealth = monster.maxHealth local aux = maxHealth mType.onThink = function(monster, interval) local health = monster:getHealth() if aux > health then Game.createItem(2448, (maxHealth - health), monster:getPosition()) aux = health end end mType:register(monster) Não testei, mas provavelmente funcionará
-
crafting script
Dentro da pasta data do teu servidor, tem alguma outra pasta chamada lib, ou libs?
-
Ajuda, novato na área! Servidor "ZERADO" é possível?
Baixe o The Forgotten Server, diretamente do Github. Ele é "crú". No Github estará assim: otland/forgottenserver
-
[Pedido - Script] TFS 1.x Movements checar quantos PLAYERS há em uma determinada área
local config = { fromPosition = { x = 100, y = 100, z = 6 }, toPosition = { x = 1000, y = 1000, z = 8 }, } local players = {} for _, cid in ipairs(getPlayersOnline()) do if isInRange(getThingPos(cid), config.fromPosition, config.toPosition) then table.insert(players, cid) end end print(#players) Explicando: Imprimirá no console do teu otserv, a quantidade de pessoas presentes em determinada área, fromPosition, toPosition.
-
storage que dura 48h
Ao invés de usar function onDeath, eu usaria o function onKill, e desta maneira: local monster = { [1] = { name = "Energy Soul", storage = 6640 }, [2] = { name = "Mazoran", storage = 6641 }, [3] = { name = "Brother Freeze", storage = 6642 }, [4] = { name = "Fleshcrawler", storage = 6643 }, } function onKill(cid, target, lastHit) local time = os.time() if not isPlayer(target) then for i = 1, #monster, 1 do local name, storage = monster[i].name, monster[i].storage if getCreatureName(target) == name then if getPlayerStorageValue(cid, storage) <= time then setPlayerStorageValue(cid, storage, time + (48 * 60 * 60)) doCreatureSay(cid, "I killed the " .. name .. "!", TALKTYPE_ORANGE_1) end end end end return true end