Ir para conteúdo

Featured Replies

Postado

Olá galera, tenho um problema com um script gringo.  (y)  

Então a Função do Script é Ficar Mudando o Addon e sua cor Continuamente. :LOL:

O único problema do script até agora é a hora que o player desloga.  :WTF:  :facepalm:

 

Então esse é o meu pedido, Gostaria de adicionar um OnLogout ou um meio de encerrar o script quando o player desloga(não entendo muito de script, mas acho que é isso que falta, se não for agradeço em adicionarem oque falta. *(Versão do TFS 0.3.1)*    :hum: 

 

O Script é esse:

 

 

local conf = {}
-- // config // ---
conf.textSpeed = 1500 -- how fast animated texts is sending?
conf.danceSpeed = 50 -- dance speed
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 // --

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) == TRUE) 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]})
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])
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, storage, -1)
doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
return TRUE
end

O Erro é esse:

 

 

[02/08/2014 19:16:23] Lua Script Error: [TalkAction Interface]
[02/08/2014 19:16:23] in a timer event called from:
[02/08/2014 19:16:23] data/talkactions/scripts/dancing test.lua:onSay

[02/08/2014 19:16:24] luaDoCreatureChangeOutfit(). Creature not found

[02/08/2014 19:16:24] Lua Script Error: [TalkAction Interface]
[02/08/2014 19:16:24] in a timer event called from:
[02/08/2014 19:16:24] data/talkactions/scripts/dancing test.lua:onSay

[02/08/2014 19:16:24] luaDoCreatureChangeOutfit(). Creature not found

Dês de já, Agradeço. Darei Rep+ Para quem ajudar, mesmo que não funcione. Grato  :rock:  :trollface:

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

                                                                                                230x230.jpg

 

Resolvido por Adriano SwaTT

Ir para solução
  • Respostas 8
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Adriano SwaTT
    Adriano SwaTT

    Boa noite, percebi que o Script é executado através de uma Talkaction, dizendo Start e Stop caso queira parar. Então o jeito mais simples de fazer isso parar de acusar este erro no Launcher, por não

  • Adriano SwaTT
    Adriano SwaTT

    Engraçado que nem mexi em Funções, então o erro do END não deveria aparecer agora. Enfim, veja se isso resolve:     Boa sorte.

  • Adriano SwaTT
    Adriano SwaTT

    É porque a função onLogout que conheço, precisaria ser registrada em CreatureScripts. E no caso neste script que você tentou fazer, creio que poderia ser "cid" no lugar de "tab".   Pelo menos o scr

Postado

Boa noite, percebi que o Script é executado através de uma Talkaction, dizendo Start e Stop caso queira parar.

Então o jeito mais simples de fazer isso parar de acusar este erro no Launcher, por não encontrar o player, é impedindo que o player dê "logout" enquanto estiver com o script sendo executado, e para isso fiz esta pequena alteração no script.

 

Segue abaixo:

local conf = {}
-- // config // ---
conf.textSpeed = 1500 -- how fast animated texts is sending?
conf.danceSpeed = 50 -- dance speed
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 infight = createConditionObject(CONDITION_INFIGHT,-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) == TRUE) 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, 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")
return TRUE
end

Peço que crie um backup do seu atual, teste este com players normais (sem GM, GOD, etc) e retorne para dizer o resultado.

 

Boa sorte.

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

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Postado
  • Autor

Bom, a princípio dava este erro:

[02/08/2014 21:51:27] Warning: [Event::loadScript] Can not load script. data/talkactions/scripts/dancing agr vai.lua
[02/08/2014 21:51:27] data/talkactions/scripts/dancing agr vai.lua:73: 'end' expected (to close 'function' at line 34) near '<eof>'
[02/08/2014 21:51:27] Reloaded talk actions.

 

 

Aí eu adicionei um end e nas ultimas linhas e ficou assim:

doPlayerSendCancel(cid, "Ai Que Loucuuura :D")
    end
    return TRUE
end

 

 

Até ai tudo bem, até ai nada mau, porem apareceu este erro:

[02/08/2014 21:56:34] Lua Script Error: [TalkAction Interface] 
[02/08/2014 21:56:34] data/talkactions/scripts/dancing agr vai.lua
 
[02/08/2014 21:56:34] luaCreateConditionObject(). Condition not found
[02/08/2014 21:56:34] Reloaded talk actions.

 

 

Nem sei como resolver hehe' não entendo muito de script. Obrigado  :rock:  (y)

Lembrando(não sei se ajuda você, mas meu TFS é 0.3.1

:thinking:

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

                                                                                                230x230.jpg

 

Postado
  • Solução

Engraçado que nem mexi em Funções, então o erro do END não deveria aparecer agora.

Enfim, veja se isso resolve:

 

local conf = {}
-- // config // ---
conf.textSpeed = 1500 -- how fast animated texts is sending?
conf.danceSpeed = 50 -- dance speed
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

 

Boa sorte.

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Postado
  • Autor

Pensei mesmo que agora ia.. Porem não foi  :cry:

 

[02/08/2014 22:08:56] Lua Script Error: [TalkAction Interface] 
[02/08/2014 22:08:56] in a timer event called from: 
[02/08/2014 22:08:56] data/talkactions/scripts/dancing agr vai.lua:onSay
 
[02/08/2014 22:08:56] luaDoCreatureChangeOutfit(). Creature not found

 

 

Eu loguei em um char(sem god, cm, gm, tutor, nem nada) falei !dance start, fucionou normal, dai eu desloguei(normal) pra testar o anti logout que você colocou, porem ele deslogou normal e o erro persistiu.  :wacko:

 

Desculpa o trabalho cara  :unsure:

Mas obrigado por tentar me ajudar.  :palmas:  :wow:

 

Olha oque eu ja tentei (vai parecer meio amador mas eu tentei kkk)

function onLogout(tab)
        stopEvent(events[pid].outfitChanger)
        stopEvent(events[pid].messager)
        events[pid] = {}
        setPlayerStorageValue(cid, storage, -1)
    end
    return TRUE
end

 

 

eu fiquei a tarde toda tentando arrumar o script, porem sem sucesso... '-' 

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

                                                                                                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 519.6k

Informação Importante

Confirmação de Termo