Ir para conteúdo

Featured Replies

Postado

Olá galerinha da Tk. Faz um bom tempo que venho tentanto fazer um script que mude consecutivamente o addon e a cor do addon de um player que usar o um talkaction qualquer. Eu encontrei um script em um site gringo que tem essas funções, mas tem um erro nele, que quando o player desloga o script continua rodando e como ele não consegue encontrar o player vários erros começam a aparecer no distro.

Basicamente meu pedido seria um TalkAction que muda consecutivamente o addon e sua cor.

 

Script Gringo(TalkAction):

local conf = {}


-- // config // ---
conf.outfitSpeed = 250 -- outfit changer speed
conf.outfitMale = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325} -- all male outfits
conf.outfitFemale = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324} -- all female outfits
-- // end // --

local condition_infight = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition_infight, CONDITION_PARAM_TICKS, -1)

function outfitChanger(tab)
if isPlayer(tab[1]) then
if getPlayerSex(tab[1]) == PLAYERSEX_FEMALE then
outs = conf.outfitFemale
else
outs = conf.outfitMale
end

local outfit = {
lookType = outs[math.random(1, #outs)],
lookHead = math.random(1,133),
lookBody = math.random(1,133),
lookLegs = math.random(1,133),
lookFeet = math.random(1,133),
lookTypeEx = math.random(1,133),
lookAddons = math.random(0,3)}
doCreatureChangeOutfit(tab[1], outfit)
tab[2].outfitChanger = addEvent(outfitChanger,conf.outfitSpeed, tab)
end
end
backOutfit = {}
local backOutfit = {}
local storage = 38417


function onSay(cid, words, param, channel)
local pidCheck = getPlayerStorageValue(cid, storage)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end

local pid = getPlayerGUID(cid)

if type(events[pid]) ~= "table" then
events[pid] = {}
end

if (param == "start") then
if (pidCheck == -1) then
if (isPlayer(cid)) then
end
outBack = getCreatureOutfit(cid)
backOutfit[pid] = outBack
backOutfit[pid].lookType = outBack.lookType
backOutfit[pid].lookAddons = outBack.lookAddons
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
outfitChanger({cid, events[pid]})
doAddCondition(cid, condition_infight)
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você está com o DANCE ligado, digite !dance stop.")
end
elseif (param == "stop") then
stopEvent(events[pid].outfitChanger)
stopEvent(events[pid].messager)
events[pid] = {}
doCreatureChangeOutfit(cid, backOutfit[pid])
doRemoveCondition(cid, CONDITION_INFIGHT)
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
end
return TRUE
end

Obs: Ele está com Infight para evitar que o player deslogue, mas também se desloga quando morre e se você ficar parado por X minutos o player é automaticamente Kick. 

 

Erro no Distro:

[10/10/2014 22:14:06] Lua Script Error: [TalkAction Interface]


[10/10/2014 22:14:06] in a timer event called from:
[10/10/2014 22:14:06] data/talkactions/scripts/dancing test.lua:onSay

[10/10/2014 22:14:06] luaDoCreatureChangeOutfit(). Creature not found

[10/10/2014 22:14:06] Lua Script Error: [TalkAction Interface]
[10/10/2014 22:14:06] in a timer event called from:
[10/10/2014 22:14:06] data/talkactions/scripts/dancing test.lua:onSay

[10/10/2014 22:14:06] luaDoCreatureChangeOutfit(). Creature not found

 

Versão do Tfs: (TFS 0.3.1)

 

Editado por eviltox (veja o histórico de edições)

                                                                                                230x230.jpg

 

  • Respostas 8
  • Visualizações 933
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • D i M i T r E s C u
    D i M i T r E s C u

    amigo teste esse mudei uma coisa se não funcionar vou dar uma olhada melhor   local conf = {} -- // config // --- conf.outfitSpeed = 250 -- outfit changer speed conf.outfitMale = {128, 129, 130, 1

Postado
  • Autor

@Up

                                                                                                230x230.jpg

 

Postado
  • Autor

@Up

                                                                                                230x230.jpg

 

Postado

amigo teste esse mudei uma coisa se não funcionar vou dar uma olhada melhor

 

local conf = {}
-- // config // ---
conf.outfitSpeed = 250 -- outfit changer speed
conf.outfitMale = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325} -- all male outfits
conf.outfitFemale = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324} -- all female outfits
-- // end // --


local condition_infight = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition_infight, CONDITION_PARAM_TICKS, -1)


function outfitChanger(tab)
if isPlayer(tab[1]) then
if getPlayerSex(tab[1]) == PLAYERSEX_FEMALE then
outs = conf.outfitFemale
else
outs = conf.outfitMale
end


local outfit = {
lookType = outs[math.random(1, #outs)],
lookHead = math.random(1,133),
lookBody = math.random(1,133),
lookLegs = math.random(1,133),
lookFeet = math.random(1,133),
lookTypeEx = math.random(1,133),
lookAddons = math.random(0,3)}
doCreatureChangeOutfit(cid, tab[1], outfit)
tab[2].outfitChanger = addEvent(outfitChanger,conf.outfitSpeed, tab)
end
end
backOutfit = {}
local backOutfit = {}
local storage = 38417




function onSay(cid, words, param, channel)
local pidCheck = getPlayerStorageValue(cid, storage)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end


local pid = getPlayerGUID(cid)


if type(events[pid]) ~= "table" then
events[pid] = {}
end


if (param == "start") then
if (pidCheck == -1) then
if (isPlayer(cid)) then
end
outBack = getCreatureOutfit(cid)
backOutfit[pid] = outBack
backOutfit[pid].lookType = outBack.lookType
backOutfit[pid].lookAddons = outBack.lookAddons
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
outfitChanger({cid, events[pid]})
doAddCondition(cid, condition_infight)
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você está com o DANCE ligado, digite !dance stop.")
end
elseif (param == "stop") then
stopEvent(events[pid].outfitChanger)
stopEvent(events[pid].messager)
events[pid] = {}
doCreatureChangeOutfit(cid, backOutfit[pid])
doRemoveCondition(cid, CONDITION_INFIGHT)
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
end
return TRUE
end

Tem esse Também teste ai

 

aqui:

 

local conf = {}
-- // config // ---
conf.outfitSpeed = 250 -- outfit changer speed
conf.outfitMale = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325} -- all male outfits
conf.outfitFemale = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324} -- all female outfits
-- // end // --


local condition_infight = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition_infight, CONDITION_PARAM_TICKS, -1)


function outfitChanger(tab)
if isPlayer(tab[1]) then
if getPlayerSex(tab[1]) == PLAYERSEX_FEMALE then
outs = conf.outfitFemale
else
outs = conf.outfitMale
end


local outfit = {
lookType = outs[math.random(1, #outs)],
lookHead = math.random(1,133),
lookBody = math.random(1,133),
lookLegs = math.random(1,133),
lookFeet = math.random(1,133),
lookTypeEx = math.random(1,133),
lookAddons = math.random(0,3)}
doCreatureChangeOutfit(tab[1], outfit)
tab[2].outfitChanger = addEvent(outfitChanger, 250, conf.outfitSpeed, tab)
end
end
backOutfit = {}
local backOutfit = {}
local storage = 38417




function onSay(cid, words, param, channel)
local pidCheck = getPlayerStorageValue(cid, storage)
if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return TRUE
end


local pid = getPlayerGUID(cid)


if type(events[pid]) ~= "table" then
events[pid] = {}
end


if (param == "start") then
if (pidCheck == -1) then
if (isPlayer(cid)) then
end
outBack = getCreatureOutfit(cid)
backOutfit[pid] = outBack
backOutfit[pid].lookType = outBack.lookType
backOutfit[pid].lookAddons = outBack.lookAddons
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
outfitChanger({cid, events[pid]})
doAddCondition(cid, condition_infight)
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, storage, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você está com o DANCE ligado, digite !dance stop.")
end
elseif (param == "stop") then
stopEvent(events[pid].outfitChanger)
stopEvent(events[pid].messager)
events[pid] = {}
doCreatureChangeOutfit(cid, backOutfit[pid])
doRemoveCondition(cid, CONDITION_INFIGHT)
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
end
return TRUE
end

Conteúdos Tragos Por Mim ao Fórum:

Venda de Vocações [Modern Aac] •

• Comando !Saga 

• [Modern Aac] DragonBall 

• Esconder •

• Naruto 2018

• • •

• •

'NtoProject - Breve'

[Show OFF] Disponível

Postado
  • Autor

Então, com o primeiro script o erro persiste, ao deslogar o script ainda da a mesma coisa.

 

O segundo dá o seguinte erro:

 

[17/10/2014 16:26:34] Lua Script Error: [TalkAction Interface] 

[17/10/2014 16:26:34] in a timer event called from: 
[17/10/2014 16:26:34] data/talkactions/scripts/dancing.lua:onSay
 
[17/10/2014 16:26:34] data/talkactions/scripts/dancing.lua:14: attempt to index local 'tab' (a number value)
[17/10/2014 16:26:34] stack traceback:
[17/10/2014 16:26:34] data/talkactions/scripts/dancing.lua:14: in function <data/talkactions/scripts/dancing.lua:13>
 

                                                                                                230x230.jpg

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.1k

Informação Importante

Confirmação de Termo