Postado Julho 26, 2012 13 anos Olá, galerinha do TK estou com uma dúvida sobre esse script function onUse(cid, item) local table = { [1] = {xxx,xxx,xxx,xxx,xxx}, [2] = {xxx,xxx,xxx,xxx,xxx}, [3] = {xxx,xxx,xxx,xxx,xxx}, [4] = {xxx,xxx,xxx,xxx,xxx} } if getPlayerVocation(cid) > 4 then return true end for i = 1,#table do doPlayerAddItem(cid, 2160, 50) doPlayerAddItem(cid,getPlayerVocation[table], 1) doPlayerSendTextMessage(cid, 28, "Você ganhou os items de iniciante para sua vocação("..getPlayerVocation(cid)..") parabéns.") end return true end sempre tive dificuldade com for i = 1,#table do queria saber se essa parte está certa doPlayerAddItem(cid,getPlayerVocation[table[i]], 1) valendo REP+ para quem ajudar. Retirado. Skype: joaoxtibia85.
Postado Julho 26, 2012 13 anos tenta assim for i = 1, table.maxn(table[getPlayerVocation(cid)]) do doPlayerAddItem(cid, table[getPlayerVocation(cid)], 1) Editado Julho 26, 2012 13 anos por mariatti (veja o histórico de edições)
Postado Julho 26, 2012 13 anos Vai fazer um for, entre os numeros 1, 2, 3, 4, ai se for vai adicionar os item, correspondente a voação.
Postado Julho 26, 2012 13 anos O script dele está certo, ele só tem duvidas do que isso fa table.maxn retorna o maior índice numérico positivo da tabela fornecida ou zero se a tabela não possui índices numéricos positivos, e você não informou a tabela.
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.