Ir para conteúdo

Featured Replies

Postado

Estou com problema no talkaction /attr.

 

Uso TFS 0.4 que veio sem o talk.

 

Adicionei com a tag <talkaction log="yes" words="/attr" access="5" script="attr.lua"/> mas sempre dava "unknown comand". Quando mudei pra <talkaction log="yes" words="/attr" access="5" event="function" value="thingProporties"/>, parou de dar erro e aparece o efeito do script, mas nada acontece com o item/teleporte etc...

O script adicionado é esse:

Mostrar conteúdo oculto

local itemFuncs =
{
["attackspeed"] = setItemAttackSpeed,
["name"] = setItemName,
["plural"] = setItemPluralName,
["attack"] = setItemAttack,
["extraattack"] = setItemExtraAttack,
["defense"] = setItemDefense,
["armor"] = setItemArmor,
["extradefense"] = setItemExtraDefense,
["hitchance"] = setItemHitChance,
["range"] = setItemShootRange,
["actionid"] = doSetItemActionId,
["action"] = doSetItemActionId,
["aid"] = doSetItemActionId,
["description"] = doSetItemSpecialDescription,
["desc"] = doSetItemSpecialDescription,
["protection"] = doSetItemProtection,
["charges"] = doChangeTypeItem,
["count"] = doChangeTypeItem
}

local creatureFuncs =
{
["health"] = doCreatureAddHealth,
["maxhealth"]= setCreatureMaxHealth,
["mana"] = doCreatureAddMana,
["maxmana"] = setCreatureMaxMana,
["speed"] = doChangeSpeed,
["droploot"] = doCreatureSetDropLoot,
["cannotmove"] = doCreatureSetNoMove,
["skull"] = doCreatureSetSkullType,
["redskull"] = doPlayerSetRedSkullTicks
}

local playerFuncs =
{
["fyi"] = doPlayerPopupFYI,
["tutorial"] = doPlayerSendTutorial,
["guildrank"] = doPlayerSetGuildRank,
["guildnick"] = doPlayerSetGuildNick,
["group"] = doPlayerSetGroupId,
["vocation"] = doPlayerSetVocation,
["promotion"] = setPlayerPromotionLevel,
["stamina"] = doPlayerAddStamina,
["town"] = doPlayerSetTown,
["balance"] = doPlayerDepositMoney
}


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

local pos = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z, stackpos=1}
if getCreatureLookDirection(cid) == SOUTH then
pos = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y+1, z=getCreaturePosition(cid).z, stackpos=255}
elseif getCreatureLookDirection(cid) == NORTH then
pos = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y-1, z=getCreaturePosition(cid).z, stackpos=255}
elseif getCreatureLookDirection(cid) == EAST then
pos = {x=getCreaturePosition(cid).x+1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z, stackpos=255}
elseif getCreatureLookDirection(cid) == WEST then
pos = {x=getCreaturePosition(cid).x-1, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z, stackpos=255}
end

local t = string.explode(param, ",")


local getThing = getThingFromPos(pos)

if itemFuncs[t[1]] then
if getThing.itemid > 0 then
if itemFuncs[t[1]](getThing.uid, t[2]) then
doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can not add attribute to this item.")
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item not found.")
return TRUE
end
elseif creatureFuncs[t[1]] then
if isCreature(getThing.uid) then
if creatureFuncs[t[1]](getThing.uid, t[2]) then
doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can not add attribute to this creature.")
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
return TRUE
end
elseif playerFuncs[t[1]] then
if isPlayer(getThing.uid) then
if playerFuncs[t[1]](getThing.uid, t[2]) then
doSendMagicEffect(pos, CONST_ME_MAGIC_GREEN)
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you can not add attribute to this player.")
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.")
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Unknow attribute.")
return TRUE
end
return TRUE
end

 

Na segunda tag, o comando usado sem erro é por ex. /attr set attack 20.

 

Algm sabe o que pode estar errado?

Resolvido por joadson

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

Top Posters In This Topic

Most Popular Posts

  • Você não tem o attr ? 

  • Exato ,  eu acho,  isso é alterado em alguns ots..., não lembro se é a distro ou algo assim, mas antigamente funcionava de boas /attr set attack...    Vê essa parte de outro tópico: http://www.ti

  • as sourcers foram modificadas. antes era /attr set attack, 20, hoje é /attr set number attack 20 foi acrescentado int, number, text etc antes da função.

Postado
  • Autor
  Em 21/02/2015 em 15:16, Patrick Jean disse:

a tag não tem referencia ao Script..

Patrick, vc quis dizer o campo value?

Tentei inserir o script ali (<talkaction log="yes" words="/attr" access="5" event="function" value="attr.lua"/>) mas tbm n funciona. O god fala como se n fosse comando.

Como vc sugere a tag?

Postado
  • Autor
  Em 21/02/2015 em 15:22, Caronte disse:

Você não tem o attr ? 

Nao acredito! ahuahuahuahu

Qual e a do "number"? (Qd nao for numero, ponho tipo "name"? :P ) Pq pra position ja nao funciona, ele retorna que o Z(do nivel) ñ é valido..

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

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