Ir para conteúdo

(Resolvido)[Pedido]Algum scripter para min ajuda nesse script

Featured Replies

Postado
Galera to com problema eu to fazendo uns sistema de do zero de pega move do pokemon igual do PDA mais quando vou testa da esse erro 
[18/02/2015 14:38:07] [Error - Action Interface] 
[18/02/2015 14:38:07] data/actions/scripts/pokemon/pokedex.lua:onUse
[18/02/2015 14:38:07] Description: 
[18/02/2015 14:38:07] data/lib/PokedexLib.lua:2: attempt to index field '?' (a nil value)
[18/02/2015 14:38:07] stack traceback:
[18/02/2015 14:38:07]  data/lib/PokedexLib.lua:2: in function 'getMoveDexDescr'
[18/02/2015 14:38:07]  data/actions/scripts/pokemon/pokedex.lua:310: in function <data/actions/scripts/pokemon/pokedex.lua:1>
esse  e meu codigo que to usando

 
function getMoveDexDescr(pokemon, number)
local move1 = movestable[pokemon].move1
local move2 = movestable[pokemon].move2
local move3 = movestable[pokemon].move3
local move4 = movestable[pokemon].move4
local move5 = movestable[pokemon].move5
local move6 = movestable[pokemon].move6
local move7 = movestable[pokemon].move7
local move8 = movestable[pokemon].move8
local move9 = movestable[pokemon].move9
local move10 = movestable[pokemon].move10




if number == 1 then
nome1 = move1.name
lvl1 = move1.level
tempo1 = move1.cd
alvo1 = move1.target
if alvo1 == 1 then
alvo1 = "Sim"
else
alvo1 = "Não"
return alvo1
end
msg = "\n Nome:"..nome1.."\n Level:"..lvl1.."\n Tempo:"..tempo1.."\n Alvo:"..alvo1.."."
return msg
end
return msg
end
 

si alguem tambem  poder da  uma otimizada nele agradeço 
obs: não uso do pda porque o serve que to usando não  e pda e já tentei usar 

Resolvido por zipter98

Ir para solução
  • Respostas 11
  • Visualizações 425
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Supondo que a tabela movestable estivesse assim: local movestable = {     ["Bulbasaur"] = {         move1 = {name = "Razor Leaf", level = 20, cd = 7, target = 1},     }, } refiz sua função da seguin

Postado
  • Solução

Supondo que a tabela movestable estivesse assim:

local movestable = {
    ["Bulbasaur"] = {
        move1 = {name = "Razor Leaf", level = 20, cd = 7, target = 1},
    },
}
refiz sua função da seguinte maneira:
function getMoveDexDescr(pokemon, number)
    if not pokemon then 
        return ""
    elseif not movestable[pokemon] then
        return print(pokemon.." doesn't exist on movestable.")
    end
    local moves = {
        [1] = movestable[pokemon].move1,
        [2] = movestable[pokemon].move2,
        [3] = movestable[pokemon].move3,
        [4] = movestable[pokemon].move4,
        [5] = movestable[pokemon].move5,
        [6] = movestable[pokemon].move6,
        [7] = movestable[pokemon].move7,
        [8] = movestable[pokemon].move8,
        [9] = movestable[pokemon].move9,
        [10] = movestable[pokemon].move10,
    }
    if not moves[number] then
        return print("move"..number.." isn't a valid move on "..pokemon..".")
    end
    local movement = moves[number]
    local name, level, cooldown, target = movement.name, movement.level, movement.cd, movement.target
    if target == 1 then
        target = "Sim"
    else
        target = "Não"
    end
    return "\n Nome:"..name.."\n Level:"..level.."\n Tempo:"..cooldown.."\n Alvo:"..target.."."
end

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

Postado

A função em si está funcionando perfeitamente. Caso queira confirmar você mesmo, basta testá-la em um depurador de lua.

Se possível, envie o código em que você está executando esta função. Provavelmente o erro está nele.

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

Postado
  • Autor

function onUse(cid, item, fromPos, itemEx, toPos)


function isSummon(sid)
    for i, pid in ipairs(getPlayersOnline()) do
        for c, cid in pairs(getCreatureSummons(pid)) do
            if (cid == sid) then
                return true
            end
        end 
    end
    return false
end  
 
local pokemon = itemEx.uid
local pokemons = {
{"Bulbasaur", 20, 1001},
{"Ivysaur", 40, 1002},
{"Venusaur", 75, 1003},
{"Charmander", 20, 1004},
{"Charmeleon", 40, 1005},
{"Charizard", 75, 1006},
{"Squirtle", 20, 1007},
{"Wartortle", 40, 1008},
{"Blastoise", 75, 1009},
{"Caterpie", 5, 1010},
{"Metapod", 10, 1011},
{"Butterfree", 30, 1012},
{"Weedle", 5, 1013},
{"Kakuna", 10, 1014},
{"Beedrill", 30, 1015},
{"Pidgey", 5, 1016},
{"Pidgeotto", 20, 1017},
{"Pidgeot", 65, 1018},
{"Rattata", 5, 1019},
{"Raticate", 20, 1020},
{"Spearow", 5, 1021},
{"Fearow", 50, 1022},
{"Ekans", 12, 1023},
{"Arbok", 30, 1024},
{"Pikachu", 20, 1025},
{"Raichu", 45, 1026},
{"Sandshrew", 18, 1027},
{"Sandslash", 55, 1028},
{"nidoranfe", 10, 1029},
{"Nidorina", 25, 1030},
{"Nidoqueen", 65, 1031},
{"nidoranma", 10, 1032},
{"Nidorino", 25, 1033},
{"Nidoking", 65, 1034},
{"Clefairy", 10, 1035},
{"Clefable", 35, 1036},
{"Vulpix", 20, 1037},
{"Ninetales", 65, 1038},
{"Jigglypuff", 10, 1039},
{"Wigglytuff", 42, 1040},
{"Zubat", 10, 1041},
{"Golbat", 30, 1042},
{"Oddish", 5, 1043},
{"Gloom", 10, 1044},
{"Vileplume", 50, 1045},
{"Paras", 5, 1046},
{"Parasect", 50, 1047},
{"Venonat", 18, 1048},
{"Venomoth", 50, 1049},
{"Diglett", 5, 1050},
{"Dugtrio", 35, 1051},
{"Meowth", 12, 1052},
{"Persion", 25, 1053},
{"Psyduck", 12, 1054},
{"Golduck", 55, 1055},
{"Mankey", 10, 1056},
{"Primeape", 45, 1057},
{"Growlithe", 20, 1058},
{"Arcanine", 75, 1059},
{"Poliwag", 5, 1060},
{"Poliwhirl", 20, 1061},
{"Poliwrath", 65, 1062},
{"Abra", 15, 1063},
{"Kadabra", 45, 1064},
{"Alakazam", 75, 1065},
{"Machop", 18, 1066},
{"Machoke", 40, 1067},
{"Machamp", 65, 1068},
{"Bellsprout", 5, 1069},
{"Weepinbell", 27, 1070},
{"Victreebel", 50, 1071},
{"Tentacool", 12, 1072},
{"Tentacruel", 70, 1073},
{"Geodude", 12, 1074},
{"Graveler", 40, 1075},
{"Golem", 65, 1076},
{"Ponyta", 20, 1077},
{"Rapidash", 60, 1078},
{"Slowpoke", 12, 1079},
{"Slowbro", 45, 1080},
{"Magnemite", 15, 1081},
{"Magneton", 40, 1082},
{"Farfetchd", 40, 1083},
{"Doduo", 12, 1084},
{"Dodrio", 45, 1085},
{"Seel", 20, 1086},
{"Dewgong", 65, 1087},
{"Grimer", 12, 1088},
{"Muk", 30, 1089},
{"Shellder", 5, 1090},
{"Cloyster", 65, 1091},
{"Gastly", 18, 1092},
{"Haunter", 45, 1093},
{"Gengar", 80, 1094},
{"Onix", 50, 1095},
{"Drowzee", 22, 1096},
{"Hypno", 50, 1097},
{"Krabby", 5, 1098},
{"Kingler", 35, 1099},
{"Voltorb", 14, 1100},
{"Electrode", 38, 1101},
{"Exeggcute", 8, 1102},
{"Exeggutor", 48, 1103},
{"Cubone", 18, 1104},
{"Marowak", 45, 1105},
{"Hitmonlee", 55, 1106},
{"Hitmonchan", 55, 1107},
{"Lickitung", 45, 1108},
{"Koffing", 15, 1109},
{"Weezing", 30, 1110},
{"Rhyhorn", 35, 1111},
{"Rhydon", 55, 1112},
{"Chansey", 50, 1113},
{"Tangela", 20, 1114},
{"Kangaskhan", 60, 1115},
{"Horsea", 5, 1116},
{"Seadra", 45, 1117},
{"Goldeen", 10, 1118},
{"Seaking", 25, 1119},
{"Staryu", 15, 1120},
{"Starmie", 45, 1121},
{"MrMime", 60, 1122},
{"Scyther", 70, 1123},
{"Jynx", 65, 1124},
{"Electabuzz", 70, 1125},
{"Magmar", 70, 1126},
{"Pinsir", 42, 1127},
{"Tauros", 40, 1128},
{"Magikarp", 1, 1129},
{"Gyarados", 75, 1130}, 
{"Shiny Gyarados", 175, 167},
{"Lapras", 70, 1131},
{"Ditto", 40, 1132},
{"Eevee", 20, 1133},
{"Vaporeon", 55, 1134},
{"Jolteon", 55, 1135},
{"Flareon", 55, 1136},
{"Porygon", 45, 1137},
{"Omanyte", 20, 1138},
{"Omastar", 70, 1139},
{"Kabuto", 20, 1140},
{"Kabutops", 70, 1141},
{"Aerodactyl", 110, 1142},
{"Snorlax", 85, 1143},
{"Articuno", 150, 1144},
{"Zapdos", 150, 1145},
{"Moltres", 150, 1146},
{"Dratini", 10, 1147},
{"Dragonair", 70, 1148},
{"Dragonite", 110, 1149},
{"Mewtwo", 150, 1150},
{"Mew", 150, 1151},
{"Chikorita", 20, 10148},
{"Bayleef", 40, 10144},
{"Meganium", 75, 10189},
{"Cyndaquil", 20, 10154},
{"Quilava", 40, 10204},
{"Typhlosion", 75, 10231},
{"Totodile", 20, 10230},
{"Croconaw", 40, 10153},
{"Feraligatr", 75, 10162},
{"Sentret", 15, 10218},
{"Furret", 25, 10165},
{"Hoothoot", 20, 10172},
{"Noctowl", 40, 10194},
{"Ledyba", 15, 10182},
{"Ledian", 25, 10181},
{"Spinarak", 15, 10219},
{"Ariados", 25, 10142},
{"Crobat", 80, 10152},
{"Chinchou", 24, 10148},
{"Lanturn", 45, 10180},
{"Pichu", 10, 10197},
{"Cleffa", 15, 10150},
{"Igglypuff", 15, 10176},
{"Togepi", 30, 10228},
{"Togetic", 50, 10229},
{"Natu", 20, 10193},
{"Xatu", 45, 10239},
{"Mareep", 20, 10187},
{"Flaaffy", 50, 10163},
{"Ampharos", 75, 10141},
{"Belossom", 50, 10145},
{"Marill", 25, 10188},
{"Azumarill", 67, 10146},
{"Sudowoodo", 50, 10222},
{"Politoed", 60, 10200},
{"Hoppip", 15, 10173},
{"Skiploom", 35, 10212},
{"Jumpluff", 45, 10177},
{"Aipom", 30, 9995},
{"Sunkern", 15, 10225},
{"Sunflora", 40, 10224},
{"Yanma", 25, 10240},
{"Wooper", 30, 10238},
{"Quagsire", 50, 10203},
{"Espeon", 55, 10161},
{"Umbreon", 55, 10234},
{"Murkrow", 39, 10192},
{"Slowking", 20, 10222},
{"Misdreavus", 45, 10191},
{"Unown a", 40, 10235},
{"Unown b", 40, 10590},
{"Unown c", 40, 10591},
{"Unown d", 40, 10592},
{"Unown e", 40, 10593},
{"Unown f", 40, 10594},
{"Unown g", 40, 10595},
{"Unown h", 40, 10596},
{"Unown i", 40, 10597},
{"Unown j", 40, 10598},
{"Unown k", 40, 10599},
{"Unown l", 40, 10600},
{"Unown m", 40, 10601},
{"Unown n", 40, 10602},
{"Unown o", 40, 10603},
{"Unown p", 40, 10604},
{"Unown q", 40, 10605},
{"Unown r", 40, 10606},
{"Unown s", 40, 10607},
{"Unown t", 40, 10608},
{"Unown u", 40, 10609},
{"Unown v", 40, 10610},
{"Unown x", 40, 10614},
{"Unown w", 40, 10611},
{"Unown y", 40, 10612},
{"Unown z", 40, 10613},
{"Wobbuffet", 50, 10237},
{"Girafarig", 55, 10166},
{"Pineco", 20, 10199},
{"Forretress", 50, 10164},
{"Dunsparce", 36, 10158},
{"Gligar", 25, 10167},
{"Steelix", 80, 10221},
{"Snubull", 25, 10218},
{"Granbull", 45, 10168},
{"Qwilfish", 30, 10205},
{"Scizor", 90, 10208},
{"Shuckle", 38, 10210},
{"Heracross", 47, 10169},
{"Sneasel", 55, 10219},
{"Teddiursa", 35, 10227},
{"Ursaring", 75, 10236},
{"Slugma", 25, 10214},
{"Magcargo", 60, 10185},
{"Swinub", 30, 10226},
{"Piloswine", 70, 10198},
{"Corsola", 35, 10151},
{"Remoraid", 30, 10207},
{"Octillery", 56, 10195},
{"Delibird", 50, 10156},
{"Mantine", 55, 10186},
{"Skarmory", 60, 10211},
{"Houndour", 36, 10175},
{"Houndoom", 57, 10174},
{"Kingdra", 75, 10178},
{"Phanpy", 34, 10196},
{"Donphan", 65, 10157},
{"Porygon2", 120, 10201},
{"Stantler", 75, 10220},
{"Smeargle Virgem", 55, 10215},
{"Tyrogue", 55, 10233},
{"Himontop", 55, 10170},
{"Smoochum", 30, 10216},
{"Elekid", 40, 10159},
{"Magby", 30, 10184},
{"Miltank", 65, 10190},
{"Blissey", 75, 10146},
{"Raikou", 150, 10206},
{"Entei", 150, 10160},
{"Suicune", 150, 10223},
{"Larvitar", 25, 10180},
{"Pupitar", 55, 10202},
{"Tyranitar", 80, 10232},
{"Lugia", 150, 10183},
{"Ho-oh", 150, 10171},
{"Celebi", 150, 10147},
}

for _,n in pairs(pokemons) do
    if isSummon(pokemon) then
                     if getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) >= n[2] and getPlayerStorageValue(cid, n[3]) <= 0 then
                        j = (n[2]) *10
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex!")
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. j .. " experience points.")
                        doSendMagicEffect(getThingPos(cid), 210)
                        doPlayerAddExperience(cid, (n[2])*10)
                        setPlayerStorageValue(cid, n[3], 1)
                     elseif getCreatureName(pokemon) == n[1] and getPlayerLevel(cid) < n[2] and getPlayerStorageValue(cid, n[3]) <= 0 then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need to be at least level " .. n[2] .. " to unlock this pokemon.")
                     elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[3]) >= 1 then
                        local v = ((n[3]) + 1376)
                     local dexstring = ""..n[1]..".txt"
                     local Dex =""..getMoveDexDescr(pokemon,1)..""
                        doShowTextDialog(cid, (v), Dex) 
                     end   
    elseif isMonster(pokemon) then
                     if getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[3]) <= 0 then
                           j = (n[2]) *10
                           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked " .. n[1] .. " in your pokedex!")
                           doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained " .. j .. " experience points.")
                           doSendMagicEffect(getThingPos(cid), 210)
                           doPlayerAddExperience(cid, (n[2])*10)
                           setPlayerStorageValue(cid, n[3], 1)
                     elseif getCreatureName(pokemon) == n[1] and getPlayerStorageValue(cid, n[3]) >= 1 then
                        local v = ((n[3]) + 1376)
                     local dexstring = ""..n[1]..".txt"
                     local Dex = ""..getMoveDexDescr(pokemon,1)..""
                        doShowTextDialog(cid, v, Dex)
                     end
    end
end

local store = {1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151,1155}
local unlock = {}
                        if not isCreature(itemEx.uid) then
                        return true
                        end
                for i = 1, #store do
                        if getPlayerStorageValue(itemEx.uid, store[i]) > 0 then
                                table.insert(unlock, 1)
                        end
                end
                
        if isPlayer(itemEx.uid) then
                                setPlayerStorageValue(cid, 7274, 1)
        if getCreatureName(cid) == getCreatureName(itemEx.uid) then
                doPlayerSendTextMessage(cid, 27, "You have unlocked " .. #unlock .. " pokemons already.")
                doPlayerSendTextMessage(cid, 27, "You can open a pokedex entry by typing \"/dex <name>\". Example: \"/dex Pikachu\".")
        else
                doPlayerSendTextMessage(cid, 27, getPlayerName(itemEx.uid) .. " has unlocked " .. #unlock .. " pokemons already.")
        end
end
return true
end  

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo