Postado Novembro 14, 2015 10 anos Erro : [Error - CreatureScript Interface] [29/06/2015 11:05:00] data/creaturescripts/scripts/firstitems.lua:onLogin [29/06/2015 11:05:00] Description: [29/06/2015 11:05:00] data/creaturescripts/scripts/firstitems.lua:55: bad argument #1 to 'maxn' (table expected, got nil) [29/06/2015 11:05:00] stack traceback: [29/06/2015 11:05:00] [C]: in function 'maxn' [29/06/2015 11:05:00] data/creaturescripts/scripts/firstitems.lua:55: in function <data/creaturescripts/scripts/firstitems.lua:53> Script: local firstItems = {} firstItems[0] = { 2173, 2525, 2428, 2124, 2460, 2478, 2643 } firstItems[1] = { 2173, 2525, 2190, 2124, 2460, 2478, 2643 } firstItems[2] = { 2173, 2525, 2182, 2124, 2460, 2478, 2643 } firstItems[3] = { 2173, 2525, 2389, 2124, 2460, 2478, 2643 } firstItems[4] = { 2173, 2525, 2428, 2124, 2460, 2478, 2643 } function onLogin(cid) if getPlayerStorageValue(cid, 30001) == -1 then for i = 1, table.maxn(firstItems[getPlayerVocation(cid)]) do doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)], 1) end if getPlayerSex(cid) == 0 then doPlayerAddItem(cid, 2465, 1) else doPlayerAddItem(cid, 2465, 1) end local bag = doPlayerAddItem(cid, 10518, 1) doAddContainerItem(bag, 2160, 10) doAddContainerItem(bag, 2554, 1) doAddContainerItem(bag, 2120, 1) doAddContainerItem(bag, 7618, 1) doAddContainerItem(bag, 2383, 1) setPlayerStorageValue(cid, 30001, 1) end return TRUE end me ajudem !
Postado Novembro 14, 2015 10 anos Esta é uma mensagem automática, este tópico foi movido para a área correta. Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680Este tópico foi movido: De: Scripting OTServ > OTServ > CreatureScripts, GlobalEvents e MoveMents Para: Suporte OTServ > OTServ > Suporte de Scripts Menor code, e melhor. Tente.. Edite os items. local items = { [0] = { 8819, 8820, 2468, 2509, 2643, 2190 }, [1] = { 8819, 8820, 2468, 2509, 2643, 2190 }, [2] = { 8819, 8820, 2468, 2509, 2643, 2182 }, [3] = { 2509, 2643, 8923, 8892, 2481, 2389 }, [4] = { 2643, 2478, 2465, 2481, 2509 } } if getPlayerStorageValue(cid, 7878) == -1 then for voc, item in pairs(items) do if getPlayerVocation(cid) == voc then local bag = doPlayerAddItem(cid, 10518, 1) if getPlayerSex(cid) == 0 then doPlayerAddItem(cid, 2465, 1) else doPlayerAddItem(cid, 2465, 1) end for i = 1, table.maxn(item) do doAddContainerItem(bag, item, 1) doAddContainerItem(bag, 2160, 10) doAddContainerItem(bag, 2554, 1) doAddContainerItem(bag, 2120, 1) doAddContainerItem(bag, 7618, 1) doAddContainerItem(bag, 2383, 1) end setPlayerStorageValue(cid, 7878, 1) end end end return TRUE end Editado Novembro 14, 2015 10 anos por vankk (veja o histórico de edições) Discord: vankk #7765 Precisando de ajuda? Entre em contato comigo via Discord. Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.
Postado Novembro 15, 2015 10 anos 5 horas atrás, vankk disse: Menor code, e melhor. Tente.. Edite os items. Creio que você encurtou demais, não vai funcionar nem a pau, releia e veja o que você fez... Tente esse: local firstItems = { [0] = {2173, 2525, 2428, 2124, 2460, 2478, 2643}, [1] = {2173, 2525, 2190, 2124, 2460, 2478, 2643}, [2] = {2173, 2525, 2182, 2124, 2460, 2478, 2643}, [3] = {2173, 2525, 2389, 2124, 2460, 2478, 2643}, [4] = {2173, 2525, 2428, 2124, 2460, 2478, 2643}, } function onLogin(cid) if getPlayerStorageValue(cid, 30001) == -1 then for i = 1, #firstItems[getPlayerVocation(cid)] do doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)][i], 1) end if getPlayerSex(cid) == 0 then doPlayerAddItem(cid, 2465, 1) else doPlayerAddItem(cid, 2465, 1) end local bag = doPlayerAddItem(cid, 10518, 1) doAddContainerItem(bag, 2160, 10) doAddContainerItem(bag, 2554, 1) doAddContainerItem(bag, 2120, 1) doAddContainerItem(bag, 7618, 1) doAddContainerItem(bag, 2383, 1) setPlayerStorageValue(cid, 30001, 1) end return TRUE end Editado Novembro 15, 2015 10 anos por Caronte Novo acordo ortográfico. (veja o histórico de edições) Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado). Tópicos: [FAQ] BBCODE [LIB] Constant [RME] Administrando bordas. [TALK] Broadcast Editável. [TALK] Sugest. [TALK] Checkpoint. [MOVE] Pântano pegajoso. [ACTION] Piggy Bank. (Cassino). [GLOBAL] Uptime Ad. [C0DE] Consertando 'Invalid Password' [PROGRAM] Quest Maker
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.