Postado Março 22, 2015 10 anos Diretor certinho Editado Março 22, 2015 10 anos por alexxxxxxx (veja o histórico de edições) Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Março 22, 2015 10 anos Autor bom pessoal, teste aqui, nao deu erro no console nada. mas nao adicionou nada pra nenhuma vocação. pode verificar na imagem http://prntscr.com/6jyypr pode ser que eu tenha adicionado errado ou seila local firstItems = {} firstItems[0] = { 2173, 2525, 3965, 2124, 2457, 2647, 2643 } firstItems[1] = { 2173, 2499, 8871, 2507, 2195, 8918, 8922 } firstItems[2] = { 2173, 2499, 8871, 2507, 2195, 8918, 8922 } firstItems[3] = { 2173, 2499, 8888, 2507, 2195, 8851, 6529, 7366, 2537 } firstItems[4] = { 2173, 2499, 8889, 2507, 2195, 2537, 8926 } function onLogin(cid) if getPlayerStorageValue(cid, 30001) == -1 then for i = 1, table.maxn(firstItems[getPlayerVocation(cid)]) do doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)][i], 1) end if getPlayerSex(cid) == 0 then doPlayerAddItem(cid, 2167, 2) else doPlayerAddItem(cid, 2167, 2) end local bag = doPlayerAddItem(cid, 1988, 1) doAddContainerItem(bag, 2160, 100) doAddContainerItem(bag, 2672, 10) setPlayerStorageValue(cid, 30001, 1) if vocacao == 1 or vocacao == 2 then doPlayerAddMagLevel(cid, 200) elseif vocacao == 3 then doPlayerAddSkill(cid, SKILL_DISTANCE, 345) doPlayerAddMagLevel(cid, 30) elseif vocacao == 4 then doPlayerAddSkill (cid, SKILL_AXE, 345) doPlayerAddSkill (cid, SKILL_SHIELDING, 345) doPlayerAddMagLevel (cid, 12) end end return TRUE end
Postado Março 22, 2015 10 anos bom pessoal, teste aqui, nao deu erro no console nada. mas nao adicionou nada pra nenhuma vocação. pode verificar na imagem http://prntscr.com/6jyypr pode ser que eu tenha adicionado errado ou seila local firstItems = {} firstItems[0] = { 2173, 2525, 3965, 2124, 2457, 2647, 2643 } firstItems[1] = { 2173, 2499, 8871, 2507, 2195, 8918, 8922 } firstItems[2] = { 2173, 2499, 8871, 2507, 2195, 8918, 8922 } firstItems[3] = { 2173, 2499, 8888, 2507, 2195, 8851, 6529, 7366, 2537 } firstItems[4] = { 2173, 2499, 8889, 2507, 2195, 2537, 8926 } function onLogin(cid) if getPlayerStorageValue(cid, 30001) == -1 then for i = 1, table.maxn(firstItems[getPlayerVocation(cid)]) do doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)][i], 1) end if getPlayerSex(cid) == 0 then doPlayerAddItem(cid, 2167, 2) else doPlayerAddItem(cid, 2167, 2) end local bag = doPlayerAddItem(cid, 1988, 1) doAddContainerItem(bag, 2160, 100) doAddContainerItem(bag, 2672, 10) setPlayerStorageValue(cid, 30001, 1) if vocacao == 1 or vocacao == 2 then doPlayerAddMagLevel(cid, 200) elseif vocacao == 3 then doPlayerAddSkill(cid, SKILL_DISTANCE, 345) doPlayerAddMagLevel(cid, 30) elseif vocacao == 4 then doPlayerAddSkill (cid, SKILL_AXE, 345) doPlayerAddSkill (cid, SKILL_SHIELDING, 345) doPlayerAddMagLevel (cid, 12) end end return TRUE end Sim,você adicionou errado. Adicione "local vocacao = getPlayerVocation(cid)" no início do script. @EDIT Não se esqueça de criar outro char para testar. Editado Março 22, 2015 10 anos por ColpSolain (veja o histórico de edições)
Postado Março 22, 2015 10 anos Dependendo do TFS não vai funcionar, tem um certo limite na função. Tenta esse: local guid = getPlayerGUID(cid) function addSkill(skillid, amount) return db.executeQuery("UPDATE `player_skills` SET `value` = `value` + " .. amount .. " WHERE `player_id` = " .. guid .. " and `skillid` = " .. skillid) end function addMagLevel(amount) return db.executeQuery("UPDATE `players` SET `maglevel` = `maglevel` + " .. amount .. " WHERE `id` = " .. guid) end local firstItems = { [0] = {2173, 2525, 3965, 2124, 2457, 2647, 2643}, [1] = {2173, 2499, 8871, 2507, 2195, 8918, 8922}, [2] = {2173, 2499, 8871, 2507, 2195, 8918, 8922}, [3] = {2173, 2499, 8888, 2507, 2195, 8851, 6529, 7366, 2537}, [4] = {2173, 2499, 8889, 2507, 2195, 2537, 8926} } function onLogin(cid) if getPlayerStorageValue(cid, 30001) == -1 then local voc, bag = getPlayerVocation(cid), doPlayerAddItem(cid, 1988, 1) for i = 1, table.maxn(firstItems[voc]) do doPlayerAddItem(cid, firstItems[voc][i], 1) end doPlayerAddItem(cid, 2167, 2) doAddContainerItem(bag, 2160, 100) doAddContainerItem(bag, 2672, 10) setPlayerStorageValue(cid, 30001, 1) if isInArray({1, 2, 5, 6}, voc) then addMagLevel(200) elseif voc == 3 or voc == 7 then addSkill(SKILL_DISTANCE, 350) addMagLevel(30) elseif voc == 4 or voc == 8 then addSkill(SKILL_AXE, 350) addSkill(SKILL_SHIELDING, 350) addMagLevel(11) end doRemoveCreature(cid, true) -- Precisa deslogar o player para adicionar as skills end return true end Editado Março 22, 2015 10 anos por fireelement (veja o histórico de edições)
Postado Março 22, 2015 10 anos Autor @colpsolain mano, do adicionei la, mas não foi também. @fireelement testei o seu e deu um erro aqui, e quando entro no acc manager ele nem loga, no console diz que logo e deslogo http://prntscr.com/6k0zc9 estou testando na tfs 0.4 proto 8.6 Editado Março 22, 2015 10 anos por markmv (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.