local sex = {
[0] = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324},
[1] = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325}
}
local psex = sex[getPlayerSex(cid)]
psex recebe uma tabela com valores inteiros apenas.
for _, n in pairs(psex) do
otf = {lookType = math.random(n[1], n[21]), lookHead = math.random(1, 133), lookBody = math.random(1, 133), lookLegs = math.random(1, 133), lookFeet = math.random(1, 133)}
doSetCreatureOutfit(cid, otf, -1)
doAddCondition(cid, condition_infight)
doCreatureSetNoMove(cid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text[1])
doPlayerSendCancel(cid, text[2])
setPlayerStorageValue(cid, storage, value)
end
math.random(n[1], n[21])
Aqui você tenta acessar uma tabela sendo que o valor n é inteiro.
O que você quer fazer na verdade é:
*Atenção: Eu retirei o for, ele não é necessário.
otf = {lookType = n[math.random(1, 21)], lookHead = math.random(1, 133), lookBody = math.random(1, 133), lookLegs = math.random(1, 133), lookFeet = math.random(1, 133)}
doSetCreatureOutfit(cid, otf, -1)
doAddCondition(cid, condition_infight)
doCreatureSetNoMove(cid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, text[1])
doPlayerSendCancel(cid, text[2])
setPlayerStorageValue(cid, storage, value)
Eu não tenho TFS 0.3.1 então não posso testar mas creio que "doPlayerSendCancel(cid, text[2])" vai cancelar a ação de equipar.
Tem outro erro também, em onEquip:
setPlayerStorageValue(cid, storage, value)
value é -1, mas em onDeEquip você faz:
if getPlayerStorageValue(cid, storage) >= 1 then
Mas hora nenhuma em onEquip você seta storage como 1, logo ele vai continuar com a outfit.
Outro detalhe. Esse script não vai mudar outfit continuamente ao equipar o ring.