Ir para conteúdo

caotic

Infante
  • Total de itens

    1599
  • Registro em

  • Última visita

  • Dias Ganhos

    7

Tudo que caotic postou

  1. O xtibia não apoia o uso de bot. Por isso e proibido este tipo de pedido. Tópico Fechado
  2. caotic

    Script da Semana Voltou!

    Eai xtibianos? O SDS e um concurso que acontece semanalmente ele e uma votação dos scripts postados na semana. Mais por causa de motivos pessoais da equipe como os feriados(natal e virada do ano) ele teve quer dar uma parada. O LuckOake já adiantou o resultado Estaremos voltando o SDS e as semanas perdidas tentaremos colocar alguns scripts. Não se esqueça de conferir a volta do SDS. Então prepare seu script e venha participar do SDS. Para ver as regras: http://www.xtibia.co...-atuais-do-sds/ Pontos do SDS: http://www.xtibia.co...910-pontos-sds/ Confira também o resultado do SDS #27: http://www.xtibia.co...sultado-sds-27/
  3. Ue porque se lanço uma varivel x. E depois seto o valor 0. function onLogin(cid) if getPlayerStorageValue(cid, 12345) == 1 then local x = exhaustion.get(cid, 12346) if x then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The exhaustion is in "..x.." seconds.") end end return false end
  4. caotic

    Dúvidas com funções

    local x = {"oneshot"} table.insert(x, "string da table") for i = 1, #x do print(x[i]) Retornaria. "OneShot" "String da table" print(string.len("esta")) printava 4. Se preferir também pode ser usado desta maneira. print(#"esta") printava 4 setPlayerStorageValue(cid, 23232, os.time() + 100) Seta o valor de tempo na storage 23232.
  5. caotic

    Dúvidas com funções

    os.clock -- Não a conheço direito mais ela retorna o valor do tempo da cpu. os.time --- Esta função e usada para manipular tempo muito usada para exhaustion numa storage table.insert --- Coloca um novo valor a uma tabela string.len - Retorna o tamanho da string e mesma coisa de #string
  6. 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) local pos = {x=753, y=1159, z=7} -- Local da hunt local posreturn = {x=796, y=1155, z=2} -- Posiçao onde o player sera teleportado quando acabar o tempo local money = 10000 --- Quanto de dinheiro sera removido config = { time = 6, ---Tempo que ele vai ficar na hunt sabendo que cada numeral equivale a um minuto----- msg = "Você não é um ninja rank C" --- Mensagem que irá aparecer se ele não tiver a storage } local str = { {st = 2124, value = 1}, --- St e o numero da storage e value e o valor da storage {st = 2124, value = 2}, {st = 2124, value = 3} } function doReturnPos() doTeleportThing(cid, posreturn) setGlobalStorageValue(24688, 0) setGlobalStorageValue(24686, none) setPlayerStorageValue(cid, 28680, 0) end if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'chuunin') then for i = 1, #str do if getPlayerStorageValue(cid, str[i].st) ~= str[i].value then doPlayerSendTextMessage(cid,22, config.msg) return true end end if getGlobalStorageValue(24688) == 1 then doPlayerSendTextMessage(cid,22,"O player "..getGlobalStorageValue(24686).." esta fazendo o teste") return true end if not doPlayerRemoveMoney(cid, money) then doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." precisa de "..money.." para fazer o chuunin teste") return true end doPlayerRemoveMoney(cid, money) doPlayerSendTextMessage(cid,22,"Obrigado "..getPlayerName(cid).." foi teleportado.") doTeleportThing(cid, pos) setGlobalStorageValue(24688, 1) setGlobalStorageValue(24686, getPlayerName(cid)) setPlayerStorageValue(cid, 28680, 1) addEvent(doReturnPos, config.time*60*1000) else selfSay('Diga chuunin', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  7. Legal legal legal. Tópico Closed
  8. Eehauhaueheuehae Me da o numero 2.
  9. Ola galerinha xtibiana. Vou disponibilizar um sistema de mensagens offline de modo simples e pratica. Não e necessário a utilização de database basta um arquivo de texto. Para mandar uma mensagem e so dizer /msg(nome do player, mensagem). E quando o player logar ele vai ter que abrir uma channel de mensagens off e ele receberá as mensagens. Vamos a instalação. Crie um arquivo de TEXTO chamado de mensagens na pasta data do seu otserv Agora vá em lib e crie um arquivo lua chamado de mensagens: function doSendMsg(cid, receptor, msg) local file = io.open("./mensagens.txt", "a") file:write("\n Player "..tostring(receptor).." Mensagem: "..tostring(msg).." por "..getCreatureName(cid).."End") file:close() end function getPlayerMgs(name) local x = {} local msg = io.open("./mensagens.txt", "r") for i in msg:read("*a"):gmatch("Player "..name.." Mensagem: (.-)End") do table.insert(x, tostring(i)) io.close() end return x or 0 end Vá em data/xml e abra o arquivo channel.xml. E coloque isto: Vá em talkactions e crie um arquivo lua chamado de mens e coloque isto: function onSay(cid, words, param, channel) local t = string.explode(param, ",") if not t[1] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você deve dizer o nome do player /msg(nome do player, mensagem)") and false end if not t[2] then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você deve escrever a mensagem /msg(nome do player, mensagem)") and false end if #t[2] <= 4 then return doPlayerSendCancel(cid, "Você deve dizer a msg com mais de 4 caracteres /msg(nome do player, mensagem)") and false end if not playerExists(t[1]) then return doPlayerSendCancel(cid, "Este player não existe") and false end local pid = getPlayerByNameWildcard(receptor) if pid then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua mensagem não foi enviado porque este player esta online") and false end doSendMsg(cid, t[1], t[2]) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua mensagem foi enviado com sucesso para "..t[1].."") return true end Vá em talkactions.xml e coloque esta tag: Vá em creaturescripts e crie um arquivo lua chamado de mens e coloque este código: function onLogin(cid) local mens = getPlayerMgs(getCreatureName(cid)) local str = "Você tem "..#mens.." mensagens olhe na channel de Mensagens Off" if #mens >= 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, str) return true end return true end Vá em creaturescripts e crie um arquivo lua chamado de mensagens e coloque isto: function onJoinChannel(cid, channelId) if channelId == 68 then local mens = getPlayerMgs(getCreatureName(cid)) for i = 1, #mens do doShowTextDialog(cid, 1397, mens[i]) end return true end return true end Registre o evento em login.lua colocando isto antes do ultimo return true: Vá em creaturescripts e coloque esta tag em creaturescripts.xml: E isto ae pessoal. Agora quando o player logar ele recebe a mensagem e basta ele abrir a channel e ir clikando "Ok" nas paginas do dialogo
  10. Biblioteca interessante. Usar orientação a objetos deixa o codigo bem mais clen Vou dar uma olhada
  11. local points = 60 --- Modifique aki a quantidade de points function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end if getAccountPoints(cid) < points then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para desbanir necessita ter "..points.."") return true end local account, tmp = getAccountIdByName(param), true if(account == 0) then account = getAccountIdByAccount(param) if(account == 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player or account '" .. param .. "' does not exists.") return true end tmp = false end local ban = getBanData(account, BAN_ACCOUNT) if(ban and doRemoveAccountBanishment(account)) then local name = param if(tmp) then name = account end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, name .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".") end if(not tmp) then return true end tmp = getIpByName(param) if(isIpBanished(tmp) and doRemoveIpBanishment(tmp)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "IP Banishment on " .. doConvertIntegerToIp(ip) .. " has been lifted.") end local guid = getPlayerGUIDByName(param, true) if(guid == nil) then return true end ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_LOCK) if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_LOCK)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Namelock from " .. param .. " has been removed.") end ban = getBanData(guid, BAN_PLAYER, PLAYERBAN_BANISHMENT) if(ban and doRemovePlayerBanishment(guid, PLAYERBAN_BANISHMENT)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has been " .. (ban.expires == -1 and "undeleted" or "unbanned") .. ".") end doAccountRemovePoints(cid, points) return true end
  12. caotic

    FELIZ ANO NOVO!

    Feliz ano novo. 2013 promete grandes mudanças.
  13. Links Quebrados. Tópico Fechado
  14. Problema resolvido function getDirMonsterByNameMonster(name) t = {} local monster = io.open("data/monster/monsters.xml", "r") for i in monster:read("*a"):gmatch('<monster name="'..tostring(name)..'" file="(.-)"/>') do table.insert(t, tostring(i)) end return t[1] or 0 end
  15. Área Incorreta. Tópico Fechado
  16. Local Incorreto. Tópico Movido
  17. Enfim. Parabéns aos dois
  18. Não esperava menos de você iunix. Não preciso usar nenhum outro evento. Só npc. Parabéns
  19. Sim sim. Estou dando uma revisada no sistema. Pensando bem cara poderia ser usado "onSpawn". Estava conversando com o iunux e a melhor maneira para registrar um monstro especifico. Mais sera melhorado
  20. Outro detalhe importante. Não e necessário colocar só 0(como ativo) pode ser qualquer outro numero diferente de 1.
  21. caotic

    Posso

    comece* Rep+ O corretor tinha as duas palavras como correta. Eehuaheuahe'
  22. caotic

    Posso

    Pode. Comesse comigo
  23. Te amu :3
    1. DinoAdmin

      DinoAdmin

      eu sei que voce me ama eu tmb te amu

    2. DinoAdmin

      DinoAdmin

      caotic feliz ano novo Brow ^^

  24. Gmatch da para fazer muita coisa. Isto e só um pouco dela. E não precisa ser necessariamente usada para arquivos remotos.
  25. Todo mundo já sabe que quando queremos "colocar" algum script em creaturescripts alguns precisam ser registrado. O registro e para que o evento inicie quando o player logar. Mais muitas vezes o cadastramento consome linhas e tempo. Pensando nisso desenvolvi um código para que o próprio usuário registre o evento na tag Vamos a instalação. Crie um arquivo lua chamado de register em lib e coloque este código: function getEventRegisterName() local x = {} local events = io.open("data/creaturescripts/creaturescripts.xml", "r") for i in events:read("*a"):gmatch('name="(.-)"') do table.insert(x, i) end return x or nil end function getEventRegisterTrueByName(name) local x = {} local events = io.open("data/creaturescripts/creaturescripts.xml", "r") for i in events:read("*a"):gmatch('name="'..tostring(name)..'" register = "(.-)"') do table.insert(x, tonumber(i)) end return x[1] or nil end function registerEvents(cid) for y = 1, #getEventRegisterName() do local x = getEventRegisterName()[y] if getEventRegisterTrueByName(x) == 1 then registerCreatureEvent(cid, x) end end end Agora vá em creaturescripts em login.lua antes do ultimo return true Exclua todos os registro de evento: Eles são estarão assim: registerCreatureEvent(cid, "event") Depois no mesmo lugar coloque isto: registerEvents(cid) Agora em TODAS AS SUAS TAGS isto entre name e event. register = "1" (Sendo que 1 e ativado e 0 Desativado) Ela ficara assim: <event type="joinchannel" name="mens" register = "1" event="script" value="mensagens.lua"/> Pronto sistema instalado Para usar e simples. E so colocar na tag E colocar a 1(verdadeiro ativado) ou o(false desativado)
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...