masquente 15 Postado Setembro 3, 2011 Share Postado Setembro 3, 2011 Olá galera do XTibia, Não sei se postei no lugar errado, mas nesses dias me vi com a necessidade de criar uma talkaction que quando seria ativada, falasse numeros aleatórios de 1 a 250. Porém, eu não tenho ideia de como fazer isso. Obrigado desde já! Link para o comentário Compartilhar em outros sites More sharing options...
0 bloder 14 Postado Setembro 3, 2011 Share Postado Setembro 3, 2011 (editado) voce queria que manda-se toda hora? ou uma vez só? se for uma vez só Tenta assim: cria um arquivo lua em talkactions e cole isto dentro: function onSay(cid, words, param, channel) local rand = math.random(1,250) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"The random number is " .. rand .. "." ) return true end dps em talkactions.xml coloke isto <talkaction words="!number" hide="yes" event="script" value="number.lua"/> e a seção está errada.o correto seria em pedidos de script. Editado Setembro 3, 2011 por LucasHere Link para o comentário Compartilhar em outros sites More sharing options...
0 masquente 15 Postado Setembro 3, 2011 Autor Share Postado Setembro 3, 2011 eu queria que mandasse toda hora... tem como? Link para o comentário Compartilhar em outros sites More sharing options...
0 bepokemon 101 Postado Setembro 3, 2011 Share Postado Setembro 3, 2011 (editado) Primeiro, crie um script chamado start.lua ou como preferir e coloque isso dentro: function onSay(cid, words, param, channel) function randSay(cid, words) if isPlayer(cid) then if getPlayerStorageValue(cid, "send") ~= -1 then local rand = math.random(1,250) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"The random number is " .. rand .. "." ) addEvent(randSay,1000) end end end doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You are now saying random numbers.") setPlayerStorageValue(cid, "send", 1) addEvent(randSay,1000) return true end Depois cria um chamado stop.lua, ou outro que preferir e coloque isso dentro: function onSay(cid, words) if getPlayerStorageValue(cid, "send") ~= -1 then doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You stopped saying random numbers.") setPlayerStorageValue(cid, "send", -1) else doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You are not saying random numbers." ) doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end return TRUE end Depois so colocar as tags no talkactions.xml <talkaction words="!number" hide="yes" event="script" value="start.lua"/> <talkaction words="!stop" hide="yes" event="script" value="stop.lua"/> Creditos: @LucasHere pela parte que eu fiquei com priguiça de fazer .. =D' Editado Setembro 3, 2011 por Byerne Link para o comentário Compartilhar em outros sites More sharing options...
0 bloder 14 Postado Setembro 4, 2011 Share Postado Setembro 4, 2011 Voce tbm pode usar esta modificação do script !AFK: --[[ Talking Tp/signs/tiles for TFS 0.2+ 70%shawak,30%Damadgerz Idea by Damadgerz ]]-- local time = 5 -- 1 = 1 sec, 2 = 2 sec, ... local say_events = {} local function SayText(cid) if isPlayer(cid) == TRUE then if say_events[getPlayerGUID(cid)] ~= nil then if isPlayer(cid) == TRUE then local rand = math.random(1,250) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"The random number is " .. rand .. "." ) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid) end end return TRUE end function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end if param == "on" then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Started!", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You are now saying random numbers.") elseif param == "off" then stopEvent(say_events[getPlayerGUID(cid)]) say_events[getPlayerGUID(cid)] = nil doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You stopped saying random numbers.") end return TRUE end <talkaction words="!number" hide="yes" event="script" value="script.lua"/> para ativar é só vc falar !number on e para desativar !number off Link para o comentário Compartilhar em outros sites More sharing options...
0 masquente 15 Postado Setembro 5, 2011 Autor Share Postado Setembro 5, 2011 Voce tbm pode usar esta modificação do script !AFK: --[[ Talking Tp/signs/tiles for TFS 0.2+ 70%shawak,30%Damadgerz Idea by Damadgerz ]]-- local time = 5 -- 1 = 1 sec, 2 = 2 sec, ... local say_events = {} local function SayText(cid) if isPlayer(cid) == TRUE then if say_events[getPlayerGUID(cid)] ~= nil then if isPlayer(cid) == TRUE then local rand = math.random(1,250) doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"The random number is " .. rand .. "." ) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000 / 2, cid) end end return TRUE end function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return true end if param == "on" then if isPlayer(cid) == TRUE then doSendAnimatedText(getPlayerPosition(cid),"Started!", math.random(01,255)) end say_events[getPlayerGUID(cid)] = addEvent(SayText, time * 1000, cid) doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You are now saying random numbers.") elseif param == "off" then stopEvent(say_events[getPlayerGUID(cid)]) say_events[getPlayerGUID(cid)] = nil doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You stopped saying random numbers.") end return TRUE end <talkaction words="!number" hide="yes" event="script" value="script.lua"/> para ativar é só vc falar !number on e para desativar !number off OBRIGADO! Amanhã darei rep+ pro Byerne também, que ajudou. Valeu! Link para o comentário Compartilhar em outros sites More sharing options...
0 Demonbholder 420 Postado Setembro 6, 2011 Share Postado Setembro 6, 2011 Galera, quando o tópico estiver em seção incorreta reportem! Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
masquente 15
Olá galera do XTibia,
Não sei se postei no lugar errado, mas nesses dias me vi com a necessidade de criar uma talkaction que quando seria ativada, falasse numeros aleatórios de 1 a 250.
Porém, eu não tenho ideia de como fazer isso.
Obrigado desde já!
Link para o comentário
Compartilhar em outros sites
6 respostass a esta questão
Posts Recomendados