Postado Outubro 9, 2021 3 anos Olá, tenho um problema com o script, gostaria que tivesse a seguinte aparência, mas não funciona quando digito! saga 1 /! saga 2 este erro ocorre: Spoiler [09/10/2021 20:52:48] data/talkactions/scripts/saga.lua:onSay [09/10/2021 20:52:48] Description: [09/10/2021 20:52:48] data/talkactions/scripts/saga.lua:64: attempt to perform arithmetic on upvalue 'level' (a string value) [09/10/2021 20:52:48] stack traceback: [09/10/2021 20:52:48] data/talkactions/scripts/saga.lua:64: in function <data/talkactions/scripts/saga.lua:28> Script: Citar local transform = { -- Naruto [1] = { [1] = 2, effect = 600, level = 25, [2] = 3, effect = 600, level = 50, [3] = 4, effect = 600, level = 75, [4] = 5, effect = 600, level = 100, [5] = 6, effect = 600, level = 125, [6] = 7, effect = 600, level = 150, [7] = 8, effect = 600, level = 175, [8] = 9, effect = 600, level = 200, [9] = 10, effect = 600, level = 225, [10] = 11, effect = 600, level = 250, [11] = 12, effect = 600, level = 275, [12] = 13, effect = 600, level = 300, [13] = 14, effect = 600, level = 325, [14] = 15, effect = 600, level = 350, [15] = 15, effect = 600, level = 400, [16] = 15, effect = 600, level = 450, [17] = 15, effect = 600, level = 500, [18] = 15, effect = 600, level = 600}, } local level = 25 -- Limite para liberar uma transform nova function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Saga] Informe o número da saga Ex : !saga 2") return true end if not transform[getPlayerVocation(cid)] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Vocę năo pode trocar de saga agora.") return true end local t = string.explode(param, ",") if(t[2]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Comando năo identificado.") return true end if not (tonumber(t[1])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Saga] Informe o número da saga Ex : !saga 2") return true end if tonumber(t[1]) > #transform[getPlayerVocation(cid)] or tonumber(t[1]) < 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Erro] Essa saga năo existe.") return true end if getPlayerLevel(cid) >= (tonumber(t[1])*level) then doSetCreatureOutfit(cid, {lookType = transform[getPlayerVocation(cid)][tonumber(t[1])]}, -1) doSendMagicEffect(getThingPos(cid), transform[getPlayerVocation(cid)].effect) doPlayerSendTextMessage(cid, 25, "Parabéns, Vocę alterou sua saga !") doPlayerSay(cid, "Aaahhh !", TALKTYPE_ORANGE_1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Aviso] Desculpe mas vocę precisa estar no level "..(tonumber(t[1]) * level).." para usar essa saga.") end return true end
Postado Outubro 9, 2021 3 anos Solução @Black Frost21 Apaga e coloca esse e testa local transform = { -- Naruto [1] = { [1] = 2, effect = 600, level = 25, [2] = 3, effect = 600, level = 50, [3] = 4, effect = 600, level = 75, [4] = 5, effect = 600, level = 100, [5] = 6, effect = 600, level = 125, [6] = 7, effect = 600, level = 150, [7] = 8, effect = 600, level = 175, [8] = 9, effect = 600, level = 200, [9] = 10, effect = 600, level = 225, [10] = 11, effect = 600, level = 250, [11] = 12, effect = 600, level = 275, [12] = 13, effect = 600, level = 300, [13] = 14, effect = 600, level = 325, [14] = 15, effect = 600, level = 350, [15] = 15, effect = 600, level = 400, [16] = 15, effect = 600, level = 450, [17] = 15, effect = 600, level = 500, [18] = 15, effect = 600, level = 600, } local level = 25 -- Limite para liberar uma transform nova function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Saga] Informe o número da saga Ex : !saga 2") return true end if not transform[getPlayerVocation(cid)] then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Vocę năo pode trocar de saga agora.") return true end local t = string.explode(param, ",") if(t[2]) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Comando năo identificado.") return true end if not (tonumber(t[1])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Saga] Informe o número da saga Ex : !saga 2") return true end if tonumber(t[1]) > #transform[getPlayerVocation(cid)] or tonumber(t[1]) < 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Erro] Essa saga năo existe.") return true end if getPlayerLevel(cid) >= (tonumber(t[1])*level) then doSetCreatureOutfit(cid, {lookType = transform[getPlayerVocation(cid)][tonumber(t[1])]}, -1) doSendMagicEffect(getThingPos(cid), transform[getPlayerVocation(cid)].effect) doPlayerSendTextMessage(cid, 25, "Parabéns, Vocę alterou sua saga !") doPlayerSay(cid, "Aaahhh !", TALKTYPE_ORANGE_1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[Aviso] Desculpe mas vocę precisa estar no level "..(tonumber(t[1]) * level).." para usar essa saga.") end return true end Editado Outubro 9, 2021 3 anos por LeoTK (veja o histórico de edições) Projeto ATS (Naruto)Informações AbaixoFacebookYoutubeDiscord Tutoriais / ConteúdosClique Aqui
Postado Outubro 9, 2021 3 anos Autor @LeoTK Tudo funciona, obrigado pela ajuda Editado Outubro 9, 2021 3 anos por Black Frost21 (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.