Postado Fevereiro 24, 2019 6 anos snao sei se estou postando na area correta mas, vamos la recentemente encontrei um script de um NPC que troca o nick do seu char por coins, eu procurei aqui no tibiaking mas todos estao quebrados, bugados etc... irei compartilhar aqui de outro forum o script pros senhores caso se interessem Créditos: RazorBlade em data/npc crie um arquivo chamado changenick.lua Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="changenick" script="data/npc/scripts/changenick.lua" walkinterval="0" speed="0" floorchange="0"> <health now="100" max="100"/> <look type="300"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, eu posso mudar seu nome por 10 VIP Coins, apenas fale {change nick}!" /> </parameters> </npc> em data/NPC/scripts crie um arquivo chamado changenick.lua Spoiler local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talk = {} local name = {} 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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end function creatureGreetCallback(cid) talk[cid] = 0 name[cid] = '' return true end local chars = {' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'} local forbiddenWords = {'gm', 'tutor', 'god', 'cm', 'admin', 'owner'} local maxWords = 3 local maxLength = 20 local minChars = 4 RET_VALID = 1 RET_EXISTS = 2 RET_INVALID = 3 local function wordCount(str) local count = 0 for word in string.gmatch(str, "%a+") do count = count + 1 end return count end local function validLen(s) for i in string.gmatch(s, "%a+") do if i:len() < minChars then return false end end return true end local function validName(name) if getPlayerGUIDByName(name) ~= nil then return RET_EXISTS end for i = 1, name:len() do if not(isInArray(chars, name:sub(i,i))) or isInArray(forbiddenWords, name:sub(i, i)) or wordCount(name) > maxWords or name:len() > maxLength or string.find(name, " ") or not validLen(name) then return RET_INVALID end end return RET_VALID end local function getValid(name, opt) local function tchelper(first, rest) return first:upper()..rest:lower() end return opt and name:gsub("(%a)([%w_']*)", tchelper) or name:gsub("^%l", string.upper) end local config = { type = 'item', -- or 'item' money = 0, -- = 1cc item = {11192, 10}, --item id, count everyFirstLetterCapital = true } function messageDefaultCallback(cid, type, msg) if not(npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "change nick") and talk[cid] == 0 then selfSay("Whats your new name?", cid) talk[cid] = 1 elseif talk[cid] == 1 then local v = getValid(msg:lower(), config.everyFirstLetterCapital) local ret = validName(v) if ret == RET_VALID then selfSay("New name:'" .. v .. "' for " .. (config.type == "money" and (config.money .. " gold") or (config.item[2] .. ' ' .. (config.item[2] > 1 and getItemPluralNameById(config.item[1]) or getItemNameById(config.item[1])))) .. "?", cid) talk[cid], name[cid] = 2, v else if ret == RET_INVALID then selfSay(msg .. " Its a invalid name. Whats your new name?", cid) elseif ret == RET_EXISTS then selfSay(msg .. " this name already exists. Whats your new name?", cid) end end elseif talk[cid] == 2 then if msgcontains(msg, "yes") then if (config.type == 'money' and doPlayerRemoveMoney(cid, config.money)) or (config.type ~= 'money' and doPlayerRemoveItem(cid, config.item[1], config.item[2])) then local curName = getPlayerName(cid) doRemoveCreature(cid) db.query("UPDATE players SET name = '"..name[cid].."' WHERE name = '"..curName.."';") else selfSay("You dont have " .. (config.type == "money" and (config.money .. " gold") or (config.item[2] .. ' ' .. (config.item[2] > 1 and getItemPluralNameById(config.item[1]) or getItemNameById(config.item[1])))) .. "!", cid) talk[cid] = 0 end else selfSay("Im not available right now, maybe later.", cid) talk[cid] = 0 end end return true end npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!") npcHandler:setMessage(MESSAGE_WALKAWAY, "Go away!") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, messageDefaultCallback) npcHandler:setCallback(CALLBACK_FAREWELL, creatureFarewell) npcHandler:setCallback(CALLBACK_CREATURE_DISAPPEAR, creatureFarewell) npcHandler:setCallback(CALLBACK_GREET, creatureGreetCallback) npcHandler:addModule(FocusModule:new()) Editado Fevereiro 24, 2019 6 anos por poko360 (veja o histórico de edições)
Postado Fevereiro 24, 2019 6 anos 10 horas atrás, poko360 disse: snao sei se estou postando na area correta mas, vamos la recentemente encontrei um script de um NPC que troca o nick do seu char por coins, eu procurei aqui no tibiaking mas todos estao quebrados, bugados etc... irei compartilhar aqui de outro forum o script pros senhores caso se interessem Créditos: RazorBlade em data/npc crie um arquivo chamado changenick.lua Mostrar conteúdo oculto <?xml version="1.0" encoding="UTF-8"?> <npc name="changenick" script="data/npc/scripts/changenick.lua" walkinterval="0" speed="0" floorchange="0"> <health now="100" max="100"/> <look type="300"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|, eu posso mudar seu nome por 10 VIP Coins, apenas fale {change nick}!" /> </parameters> </npc> em data/NPC/scripts crie um arquivo chamado changenick.lua Mostrar conteúdo oculto local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talk = {} local name = {} 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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end function creatureGreetCallback(cid) talk[cid] = 0 name[cid] = '' return true end local chars = {' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'} local forbiddenWords = {'gm', 'tutor', 'god', 'cm', 'admin', 'owner'} local maxWords = 3 local maxLength = 20 local minChars = 4 RET_VALID = 1 RET_EXISTS = 2 RET_INVALID = 3 local function wordCount(str) local count = 0 for word in string.gmatch(str, "%a+") do count = count + 1 end return count end local function validLen(s) for i in string.gmatch(s, "%a+") do if i:len() < minChars then return false end end return true end local function validName(name) if getPlayerGUIDByName(name) ~= nil then return RET_EXISTS end for i = 1, name:len() do if not(isInArray(chars, name:sub(i,i))) or isInArray(forbiddenWords, name:sub(i, i)) or wordCount(name) > maxWords or name:len() > maxLength or string.find(name, " ") or not validLen(name) then return RET_INVALID end end return RET_VALID end local function getValid(name, opt) local function tchelper(first, rest) return first:upper()..rest:lower() end return opt and name:gsub("(%a)([%w_']*)", tchelper) or name:gsub("^%l", string.upper) end local config = { type = 'item', -- or 'item' money = 0, -- = 1cc item = {11192, 10}, --item id, count everyFirstLetterCapital = true } function messageDefaultCallback(cid, type, msg) if not(npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "change nick") and talk[cid] == 0 then selfSay("Whats your new name?", cid) talk[cid] = 1 elseif talk[cid] == 1 then local v = getValid(msg:lower(), config.everyFirstLetterCapital) local ret = validName(v) if ret == RET_VALID then selfSay("New name:'" .. v .. "' for " .. (config.type == "money" and (config.money .. " gold") or (config.item[2] .. ' ' .. (config.item[2] > 1 and getItemPluralNameById(config.item[1]) or getItemNameById(config.item[1])))) .. "?", cid) talk[cid], name[cid] = 2, v else if ret == RET_INVALID then selfSay(msg .. " Its a invalid name. Whats your new name?", cid) elseif ret == RET_EXISTS then selfSay(msg .. " this name already exists. Whats your new name?", cid) end end elseif talk[cid] == 2 then if msgcontains(msg, "yes") then if (config.type == 'money' and doPlayerRemoveMoney(cid, config.money)) or (config.type ~= 'money' and doPlayerRemoveItem(cid, config.item[1], config.item[2])) then local curName = getPlayerName(cid) doRemoveCreature(cid) db.query("UPDATE players SET name = '"..name[cid].."' WHERE name = '"..curName.."';") else selfSay("You dont have " .. (config.type == "money" and (config.money .. " gold") or (config.item[2] .. ' ' .. (config.item[2] > 1 and getItemPluralNameById(config.item[1]) or getItemNameById(config.item[1])))) .. "!", cid) talk[cid] = 0 end else selfSay("Im not available right now, maybe later.", cid) talk[cid] = 0 end end return true end npcHandler:setMessage(MESSAGE_FAREWELL, "Bye!") npcHandler:setMessage(MESSAGE_WALKAWAY, "Go away!") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, messageDefaultCallback) npcHandler:setCallback(CALLBACK_FAREWELL, creatureFarewell) npcHandler:setCallback(CALLBACK_CREATURE_DISAPPEAR, creatureFarewell) npcHandler:setCallback(CALLBACK_GREET, creatureGreetCallback) npcHandler:addModule(FocusModule:new()) vou testar depois, se estiver funfando rep+
Postado Fevereiro 24, 2019 6 anos Autor Se não funcionar, é só trocar essa linha daqui:db.query("UPDATE players SET name = '"..name[cid].."' WHERE name = '"..curName.."';") para: db.ExecuteQuery("UPDATE players SET name = '"..name[cid].."' WHERE name = '"..curName.."';") alguns servers são diferentes
Postado Março 20, 2020 5 anos Ola, os pontos que ele usa são os pontos donates do site? TE AJUDEI ? DA REP+
Postado Março 20, 2020 5 anos Autor não, ele pega as coins dentro do jogo nessa linha: item = {11192, 10}, --item id, count
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.