• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Help with this script: Please i'm very impacient

Nubaza

LUA Scripter
Joined
Jun 5, 2011
Messages
337
Solutions
1
Reaction score
23
Location
Chile
Hello! i have error with this script:

original script:
LUA:
local pokes = {
["Magikarp"] = {chance = 2, corpse = 146, health = 120, maxhealth = 120, sto = 1},
["Eevee"] = {chance = 300, corpse = 6364, health = 1500, maxhealth = 1500},
["Abra"] = {chance = 59, corpse = 135, health = 620, maxhealth = 620},
["Flareon"] = {chance = 350, corpse = 141, health = 6400, maxhealth = 6400},
["Jolteon"] = {chance = 350, corpse = 6044, health = 6500, maxhealth = 6500},
["Vaporeon"] = {chance = 350, corpse = 5960, health = 6700, maxhealth = 6700},
["Ditto"] = {chance = 2, corpse = 147, health = 4000, maxhealth = 4000},
["Zubat"] = {chance = 15, corpse = 5989, health = 450, maxhealth = 450},
["Golbat"] = {chance = 60, corpse = 6053, health = 1900, maxhealth = 1900},
["Bellsprout"] = {chance = 13, corpse = 134, health = 420, maxhealth = 420},
["Grimer"] = {chance = 14, corpse = 6055, health = 600, maxhealth = 600},
["Weedle"] = {chance = 3, corpse = 5964, health = 325, maxhealth = 325},
["Kakuna"] = {chance = 18, corpse = 136, health = 900, maxhealth = 900},
["Beedrill"] = {chance = 60, corpse = 5990, health = 1900, maxhealth = 1900},
["Muk"] = {chance = 100, corpse = 2845, health = 2400, maxhealth = 2400},
["Doduo"] = {chance = 16, corpse = 142, health = 600, maxhealth = 600},
["Dodrio"] = {chance = 80, corpse = 6047, health = 2650, maxhealth = 2650},
["Magnemite"] = {chance = 19, corpse = 6056, health = 450, maxhealth = 450},
["Magneton"] = {chance = 140, corpse = 6076, health = 1750, maxhealth = 1750},
["Voltorb"] = {chance = 13, corpse = 6049, health = 620, maxhealth = 620},
["Electrode"] = {chance = 90, corpse = 6051, health = 2000, maxhealth = 2000},
["Geodude"] = {chance = 17, corpse = 6071, health = 700, maxhealth = 700},
["Graveler"] = {chance = 60, corpse = 6516, health = 3000, maxhealth = 3000},
["Golem"] = {chance = 200, corpse = 6043, health = 6500, maxhealth = 6500},
["Sandshrew"] = {chance = 16, corpse = 5988, health = 700, maxhealth = 700},
["Sandslash"] = {chance = 160, corpse = 6041, health = 3400, maxhealth = 3400},
["Charmander"] = {chance = 25, corpse = 132, health = 800, maxhealth = 800},
["Charmeleon"] = {chance = 75, corpse = 5981, health = 2600, maxhealth = 2600},
["Charizard"] = {chance = 210, corpse = 6005, health = 7700, maxhealth = 7700},
["Vulpix"] = {chance = 16, corpse = 6003, health = 680, maxhealth = 680},
["Ninetales"] = {chance = 150, corpse = 6040, health = 2650, maxhealth = 2650},
["Bulbasaur"] = {chance = 23, corpse = 5969, health = 1200, maxhealth = 900},
["Raichu"] = {chance = 140, corpse = 5996, health = 3500, maxhealth = 3500},
["Ekans"] = {chance = 10, corpse = 5979, health = 600, maxhealth = 600},
["Arbok"] = {chance = 100, corpse = 5984, health = 2900, maxhealth = 2900},
["Cubone"] = {chance = 30, corpse = 6050, health = 1200, maxhealth = 1200},
["Marowak"] = {chance = 95, corpse = 6072, health = 3900, maxhealth = 3900},
["Caterpie"] = {chance = 2, corpse = 5971, health = 300, maxhealth = 300},
["Metapod"] = {chance = 10, corpse = 5970, health = 1100, maxhealth = 1100},
["Butterfree"] = {chance = 65, corpse = 5985, health = 2000, maxhealth = 2000},
["Goldeen"] = {chance = 3, corpse = 2970, health = 950, maxhealth = 950},
["Seaking"] = {chance = 40, corpse = 3038, health = 2000, maxhealth = 2000},
["Spearow"] = {chance = 5, corpse = 5968, health = 200, maxhealth = 200},
["Fearow"] = {chance = 60, corpse = 5992, health = 3300, maxhealth = 3300},
["Drowzee"] = {chance = 20, corpse = 6026, health = 1150, maxhealth = 1150},
["Hypno"] = {chance = 170, corpse = 6046, health = 4600, maxhealth = 4600},
["Diglett"] = {chance = 12, corpse = 6023, health = 900, maxhealth = 900},
["Dugtrio"] = {chance = 85, corpse = 6024, health = 3450, maxhealth = 3450},
["Krabby"] = {chance = 12, corpse = 6039, health = 850, maxhealth = 850},
["Kingler"] = {chance = 70, corpse = 6340, health = 3250, maxhealth = 3250},
["Paras"] = {chance = 2, corpse = 137, health = 850, maxhealth = 850},
["Parasect"] = {chance = 65, corpse = 6027, health = 3800, maxhealth = 3800},
["Dratini"] = {chance = 120, corpse = 149, health = 520, maxhealth = 520},
["Dragonair"] = {chance = 200, corpse = 6002, health = 3000, maxhealth = 3000},
["Dragonite"] = {chance = 500, corpse = 4295, health = 17000, maxhealth = 17000},
["Ponyta"] = {chance = 25, corpse = 5975, health = 1400, maxhealth = 1400},
["Rapidash"] = {chance = 145, corpse = 4323, health = 5500, maxhealth = 5500},
["Pinsir"] = {chance = 80, corpse = 7282, health = 4000, maxhealth = 4000},
["Seel"] = {chance = 18, corpse = 6030, health = 1000, maxhealth = 1000},
["Dewgong"] = {chance = 190, corpse = 143, health = 5200, maxhealth = 5200},
["Exeggcute"] = {chance = 25, corpse = 206, health = 800, maxhealth = 800},
["Exeggutor"] = {chance = 150, corpse = 3005, health = 450, maxhealth = 4000},
["Koffing"] = {chance = 34, corpse = 2936, health = 900, maxhealth = 900},
["Weezing"] = {chance = 100, corpse = 6306, health = 2800, maxhealth = 2800},
["Staryu"] = {chance = 20, corpse = 5987, health = 1050, maxhealth = 1050},
["Starmie"] = {chance = 110, corpse = 7320, health = 3800, maxhealth = 3800},
["Rhyhorn"] = {chance = 70, corpse = 3035, health = 3800, maxhealth = 3800},
["Rhydon"] = {chance = 200, corpse = 2858, health = 7000, maxhealth = 7000},
["Shellder"] = {chance = 40, corpse = 2837, health = 800, maxhealth = 800},
["Snorlax"] = {chance = 400, corpse = 6016, health = 9500, maxhealth = 9500},
["Giant Snorlax"] = {chance = 1500, corpse = 2948, health = 25000, maxhealth = 25000},
["Gyarados"] = {chance = 300, corpse = 6331, health = 7800, maxhealth = 7800},
["Machop"] = {chance = 40, corpse = 6045, health = 1100, maxhealth = 1100},
["Machoke"] = {chance = 70, corpse = 4251, health = 2850, maxhealth = 3500},
["Machamp"] = {chance = 200, corpse = 6048, health = 7500, maxhealth = 7500},
["Clefairy"] = {chance = 30, corpse = 2968, health = 600, maxhealth = 600},
["Clefable"] = {chance = 145, corpse = 6006, health = 2400, maxhealth = 2400},
["Jigglypuff"] = {chance = 18, corpse = 6011, health = 550, maxhealth = 550},
["Wigglytuff"] = {chance = 110, corpse = 6012, health = 2900, maxhealth = 2900},
["Venonat"] = {chance = 40, corpse = 5997, health = 1350, maxhealth = 1350},
["Venomoth"] = {chance = 95, corpse = 2925, health = 3850, maxhealth = 3850},
["Meowth"] = {chance = 40, corpse = 6034, health = 950, maxhealth = 950},
["Persian"] = {chance = 80, corpse = 6009, health = 2250, maxhealth = 2250},
["Mankey"] = {chance = 30, corpse = 6035, health = 1050, maxhealth = 1050},
["Primeape"] = {chance = 110, corpse = 6032, health = 4500, maxhealth = 4500},
["Tentacool"] = {chance = 20, corpse = 2961, health = 1050, maxhealth = 1050},
["Tentacruel"] = {chance = 200, corpse = 6037, health = 7050, maxhealth = 7050},
["Slowpoke"] = {chance = 30, corpse = 139, health = 1200, maxhealth = 1200},
["Slowbro"] = {chance = 110, corpse = 140, health = 4600, maxhealth = 4600},
["Cloyster"] = {chance = 170, corpse = 144, health = 120, maxhealth = 5000},
["Gastly"] = {chance = 40, corpse = 5993, health = 1000, maxhealth = 1000},
["Haunter"] = {chance = 70, corpse = 6004, health = 3000, maxhealth = 3000},
["Gengar"] = {chance = 200, corpse = 6336, health = 7000, maxhealth = 7000},
["Onix"] = {chance = 150, corpse = 2990, health = 5300, maxhealth = 5300},
["Hitmonlee"] = {chance = 900, corpse = 6067, health = 5500, maxhealth = 5500},
["Hitmonchan"] = {chance = 900, corpse = 5977, health = 5500, maxhealth = 5500},
["Lickitung"] = {chance = 145, corpse = 2953, health = 4800, maxhealth = 4800},
["Chansey"] = {chance = 350, corpse = 6010, health = 7500, maxhealth = 7500},
["Tangela"] = {chance = 140, corpse = 5976, health = 3500, maxhealth = 3500},
["Kangaskhan"] = {chance = 170, corpse = 6073, health = 7000, maxhealth = 7000},
["Scyther"] = {chance = 800, corpse = 3002, health = 6500, maxhealth = 6500},
["Electabuzz"] = {chance = 259, corpse = 6065, health = 6800, maxhealth = 6800},
["Magmar"] = {chance = 240, corpse = 7283, health = 7200, maxhealth = 7200},
["Jynx"] = {chance = 195, corpse = 5765, health = 7000, maxhealth = 7000},
["Nidoranma"] = {chance = 30, corpse = 6015, health = 650, maxhealth = 650},
["Nidoranfe"] = {chance = 30, corpse = 6013, health = 600, maxhealth = 600},
["Nidoking"] = {chance = 180, corpse = 5995, health = 4800, maxhealth = 4800},
["Nidoqueen"] = {chance = 180, corpse = 3004, health = 4200, maxhealth = 4200},
["Nidorina"] = {chance = 50, corpse = 6014, health = 2000, maxhealth = 2000},
["Nidorino"] = {chance = 50, corpse = 6019, health = 2500, maxhealth = 2500},
["Farfetchd"] = {chance = 150, corpse = 2836, health = 2500, maxhealth = 2500},
["Mr Mime"] = {chance = 240, corpse = 145, health = 5500, maxhealth = 5500},
["Porygon"] = {chance = 350, corpse = 5963, health = 5000, maxhealth = 5000},
["Tauros"] = {chance = 75, corpse = 6302, health = 4200, maxhealth = 4200},
["Lapras"] = {chance = 165, corpse = 6018, health = 7000, maxhealth = 7000},
["Omanyte"] = {chance = 700, corpse = 5998, health = 1300, maxhealth = 1300},
["Omastar"] = {chance = 1100, corpse = 5994, health = 6000, maxhealth = 6000},
["Kabuto"] = {chance = 700, corpse = 5972, health = 1300, maxhealth = 1300},
["Kabutops"] = {chance = 1100, corpse = 148, health = 6500, maxhealth = 6500},
["Aerodactyl"] = {chance = 1500, corpse = 6338, health = 15000, maxhealth = 15000},
["Articuno"] = {chance = 5000, corpse = 7256, health = 11000, maxhealth = 11000},
["Zapdos"] = {chance = 5000, corpse = 6074, health = 11000, maxhealth = 11000},
["Moltres"] = {chance = 5000, corpse = 7330, health = 11000, maxhealth = 11000},
["Mewtwo"] = {chance = 10000, corpse = 151, health = 8500, maxhealth = 8500},
["Mew"] = {chance = 10000, corpse = 150, health = 7200, maxhealth = 7200},
["Elder Charizard"] = {chance = 1500, corpse = 2954, health = 15000, maxhealth = 15000},
["Shiny Arcanine"] = {chance = 1300, corpse = 8746, health = 14000, maxhealth = 14000},
["Shiny Tentacool"] = {chance = 800, corpse = 8748, health = 5000, maxhealth = 5000},
["Shiny Paras"] = {chance = 700, corpse = 8743, health = 5500, maxhealth = 5500},
["Shiny Tangela"] = {chance = 1300, corpse = 2944, health = 11000, maxhealth = 11000},
["Shiny Pinsir"] = {chance = 1000, corpse = 2945, health = 13500, maxhealth = 13500},
["Shiny Tentacruel"] = {chance = 1400, corpse = 8757, health = 14000, maxhealth = 15000},
["Crystal Onix"] = {chance = 1800, corpse = 6320, health = 24000, maxhealth = 24000},
["Shiny Blastoise"] = {chance = 1500, corpse = 8763, health = 16500, maxhealth = 16500},
["Shiny Gengar"] = {chance = 1400, corpse = 2947, health = 22000, maxhealth = 22000},
["Red Gyarados"] = {chance = 1400, corpse = 8774, health = 25000, maxhealth = 25000},
["Shiny Parasect"] = {chance = 1000, corpse = 8756, health = 16000, maxhealth = 16000},
["Shiny Scyther"] = {chance = 1400, corpse = 8772, health = 27000, maxhealth = 27000},
["Shiny Pidgeot"] = {chance = 1400, corpse = 2949, health = 24000, maxhealth = 24000},
["Shiny Magikarp"] = {chance = 700, corpse = 8766, health = 3500, maxhealth = 3500},
["Shiny Abra"] = {chance = 800, corpse = 8771, health = 5000, maxhealth = 5000},
["Shiny Growlithe"] = {chance = 800, corpse = 8742, health = 4800, maxhealth = 4800},
["Shiny Alakazam"] = {chance = 1200, corpse = 2941, health = 15000, maxhealth = 15000},
["Shiny Jynx"] = {chance = 1000, corpse = 8758, health = 11000, maxhealth = 11000},
["Shiny Venusaur"] = {chance = 1500, corpse = 8764, health = 16000, maxhealth = 16000},
["Shiny Farfetchd"] = {chance = 1100, corpse = 8745, health = 18000, maxhealth = 18000},
["Shiny Venomoth"] = {chance = 1300, corpse = 8761, health = 24000, maxhealth = 24000},
["Shiny Venonat"] = {chance = 900, corpse = 2996, health = 6800, maxhealth = 6800},
["Shiny Cubone"] = {chance = 800, corpse = 2942, health = 7200, maxhealth = 7200},
["Shiny Marowak"] = {chance = 1300, corpse = 2943, health = 24000, maxhealth = 24000},
["Shiny Electabuzz"] = {chance = 1300, corpse = 8773, health = 27000, maxhealth = 27000},
["Shiny Raichu"] = {chance = 1000, corpse = 8770, health = 19000, maxhealth = 19000},
["Shiny Beedrill"] = {chance = 1000, corpse = 8767, health = 15000, maxhealth = 15000},
["Shiny Butterfree"] = {chance = 1000, corpse = 8762, health = 15000, maxhealth = 15000},
["Shiny Rattata"] = {chance = 700, corpse = 8751, health = 4200, maxhealth = 4200},
["Shiny Raticate"] = {chance = 1100, corpse = 8765, health = 8000, maxhealth = 8000},
["Shiny Oddish"] = {chance = 900, corpse = 8749, health = 3900, maxhealth = 3900},
["Shiny Zubat"] = {chance = 1000, corpse = 8750, health = 5200, maxhealth = 5200},
["Shiny Golbat"] = {chance = 1200, corpse = 2940, health = 10500, maxhealth = 10500},
["Shiny Voltorb"] = {chance = 1000, corpse = 8754, health = 7300, maxhealth = 7300},
["Shiny Electrode"] = {chance = 1300, corpse = 8753, health = 12000, maxhealth = 12000},
["Shiny Horsea"] = {chance = 1000, corpse = 8768, health = 4200, maxhealth = 4200},
["Shiny Seadra"] = {chance = 1300, corpse = 8760, health = 10000, maxhealth = 10000},
["Shiny Krabby"] = {chance = 1050, corpse = 8755, health = 4650, maxhealth = 4650},
["Shiny Kingler"] = {chance = 1300, corpse = 8769, health = 9500, maxhealth = 9500},
["Shiny Dratini"] = {chance = 900, corpse = 8744, health = 6000, maxhealth = 6000},
["Shiny Dragonair"] = {chance = 1300, corpse = 2946, health = 12500, maxhealth = 12500},
["Shiny Grimer"] = {chance = 800, corpse = 8752, health = 5700, maxhealth = 5700},
["Shiny Muk"] = {chance = 1220, corpse = 8747, health = 9600, maxhealth = 9600},
}

local description = "Contains a %pokename."

function onUse(cid, item, frompos, item2, topos)
local name = getItemNameById(item2.itemid)
if item.itemid == 2149 then 
catchrate = 2
oncatch = 24
onfail = 23
bolabola = 2222
elseif item.itemid == 2146 then       
catchrate = 4
oncatch = 198
onfail = 197
bolabola = 3250
elseif item.itemid == 2147 then       
catchrate = 7
oncatch = 202
onfail = 201
bolabola = 4430
elseif item.itemid == 2150 then 
catchrate = 9
oncatch = 200
onfail = 199
bolabola = 2220
elseif item.itemid == 129 then 
catchrate = 4
oncatch = 198
onfail = 197
bolabola = 214
elseif item.itemid == 3246 then 
catchrate = 10000
oncatch = 222
onfail = 222
bolabola = 203
elseif item.itemid == 2644 then    
catchrate = 4
oncatch = 204
onfail = 203
bolabola = 3273
end
local rate = (catchrate)
local catch = oncatch
local fail = onfail
local newid = bolabola
for i,x in pairs(pokes) do
if getItemNameById(item2.itemid):find(i:lower()) then
if getItemIdByName(name) == pokes[i].corpse then
if cid ~= getItemAttribute(item2.uid, "corpseowner") and isInArray({1,8}, getPlayerGroupId(cid)) then
doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
return true
end
doRemoveItem(item.uid, 1)
doRemoveItem(item2.uid, 1)
local pegar = math.random(1, x.chance)
if pegar <= 1*(rate) then
doSendMagicEffect(topos, catch)

local nas = {
["%%pokename"] = i
}
for i,x in pairs(nas) do
if description:find(i) then
description = description:gsub(i, x)
end
end

local function capturou(params)
if not isCreature(params.cid) then
return true
end
if not string.find(getPlayerStorageValue(cid, 54842), ""..i..",") then
       doPlayerAddSoul(cid, 1)
setPlayerStorageValue(cid, 54842, getPlayerStorageValue(cid, 54842)..""..i..", ")
end
if getPlayerFreeCap(cid) <= 0.99 then
item = doCreateItemEx(newid-1)
doItemSetAttribute(item, "poke", params.poke)
doItemSetAttribute(item, "nome", params.nome)
doItemSetAttribute(item, "description", params.description)
doPlayerSendMailByName(getCreatureName(params.cid), item, 1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")
else
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "poke", params.poke)
doItemSetAttribute(item, "nome", params.nome)
doItemSetAttribute(item, "description", params.description)
doPlayerAddItemEx(params.cid, item, true)
doTransformItem(item, newid)
doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
end
if #getCreatureSummons(cid) >= 1 then
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)
else
doSendMagicEffect(getThingPos(cid), 178)
end
end

local description = "Contains a "..i.."."
local poke1 = "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]"
addEvent(capturou, 4000, {cid = cid, poke = poke1, nome = i, description = description, ball = 2219, letter = 2597})
else
function ruim(params)
if not isCreature(params.cid) then
return true
end
doPlayerSendTextMessage(params.cid, 27, "Sorry, your poke ball broke.")
if #getCreatureSummons(params.cid) >= 1 then
doSendMagicEffect(getThingPos(getCreatureSummons(params.cid)[1]), 166)
else
doSendMagicEffect(getThingPos(params.cid), 166)
end
end
addEvent(ruim, 4000, {cid = cid})
doSendMagicEffect(topos, fail)
end
end
end
end
return TRUE
end

I have added to the original script the getArticle function in the "Contains "..getArticle(i).." Lines:
LUA:
local pokes = {
["Magikarp"] = {chance = 2, corpse = 146, health = 120, maxhealth = 120, sto = 1},
["Eevee"] = {chance = 300, corpse = 6364, health = 1500, maxhealth = 1500},
["Abra"] = {chance = 59, corpse = 135, health = 620, maxhealth = 620},
["Kadabra"] = {chance = 142, corpse = 6060, health = 2500, maxhealth = 2500},
["Alakazam"] = {chance = 200, corpse = 6057, health = 5500, maxhealth = 5500},
["Rattata"] = {chance = 8, corpse = 131, health = 350, maxhealth = 350},
["Raticate"] = {chance = 40, corpse = 6007, health = 900, maxhealth = 900},
["Pidgey"] = {chance = 11, corpse = 5961, health = 600, maxhealth = 600},
["Pidgeotto"] = {chance = 40, corpse = 5966, health = 1400, maxhealth = 1400},
["Pidgeot"] = {chance = 200, corpse = 6020, health = 5000, maxhealth = 5000},
["Flareon"] = {chance = 350, corpse = 141, health = 6400, maxhealth = 6400},
["Jolteon"] = {chance = 350, corpse = 6044, health = 6500, maxhealth = 6500},
["Vaporeon"] = {chance = 350, corpse = 5960, health = 6700, maxhealth = 6700},
["Ditto"] = {chance = 2, corpse = 147, health = 4000, maxhealth = 4000},
["Zubat"] = {chance = 15, corpse = 5989, health = 450, maxhealth = 450},
["Golbat"] = {chance = 60, corpse = 6053, health = 1900, maxhealth = 1900},
["Bellsprout"] = {chance = 13, corpse = 134, health = 420, maxhealth = 420},
["Weepinbell"] = {chance = 40, corpse = 138, health = 1100, maxhealth = 1100},
["Victreebel"] = {chance = 200, corpse = 6332, health = 4000, maxhealth = 4000},
["Poliwag"] = {chance = 12, corpse = 6042, health = 400, maxhealth = 400},
["Poliwhirl"] = {chance = 40, corpse = 6054, health = 1200, maxhealth = 1200},
["Poliwrath"] = {chance = 200, corpse = 6033, health = 4400, maxhealth = 4400},
["Oddish"] = {chance = 7, corpse = 133, health = 650, maxhealth = 650},
["Gloom"] = {chance = 30, corpse = 6017, health = 1400, maxhealth = 1400},
["Vileplume"] = {chance = 200, corpse = 6025, health = 3300, maxhealth = 3300},
["Horsea"] = {chance = 10, corpse = 4423, health = 300, maxhealth = 300},
["Seadra"] = {chance = 100, corpse = 2872, health = 2500, maxhealth = 2500},
["Grimer"] = {chance = 14, corpse = 6055, health = 600, maxhealth = 600},
["Weedle"] = {chance = 3, corpse = 5964, health = 325, maxhealth = 325},
["Kakuna"] = {chance = 18, corpse = 136, health = 900, maxhealth = 900},
["Beedrill"] = {chance = 60, corpse = 5990, health = 1900, maxhealth = 1900},
["Muk"] = {chance = 100, corpse = 2845, health = 2400, maxhealth = 2400},
["Doduo"] = {chance = 16, corpse = 142, health = 600, maxhealth = 600},
["Dodrio"] = {chance = 80, corpse = 6047, health = 2650, maxhealth = 2650},
["Magnemite"] = {chance = 19, corpse = 6056, health = 450, maxhealth = 450},
["Magneton"] = {chance = 140, corpse = 6076, health = 1750, maxhealth = 1750},
["Voltorb"] = {chance = 13, corpse = 6049, health = 620, maxhealth = 620},
["Electrode"] = {chance = 90, corpse = 6051, health = 2000, maxhealth = 2000},
["Geodude"] = {chance = 17, corpse = 6071, health = 700, maxhealth = 700},
["Graveler"] = {chance = 60, corpse = 6516, health = 3000, maxhealth = 3000},
["Golem"] = {chance = 200, corpse = 6043, health = 6500, maxhealth = 6500},
["Sandshrew"] = {chance = 16, corpse = 5988, health = 700, maxhealth = 700},
["Sandslash"] = {chance = 160, corpse = 6041, health = 3400, maxhealth = 3400},
["Charmander"] = {chance = 25, corpse = 132, health = 800, maxhealth = 800},
["Charmeleon"] = {chance = 75, corpse = 5981, health = 2600, maxhealth = 2600},
["Charizard"] = {chance = 210, corpse = 6005, health = 7700, maxhealth = 7700},
["Vulpix"] = {chance = 16, corpse = 6003, health = 680, maxhealth = 680},
["Ninetales"] = {chance = 150, corpse = 6040, health = 2650, maxhealth = 2650},
["Bulbasaur"] = {chance = 23, corpse = 5969, health = 1200, maxhealth = 900},
["Ivysaur"] = {chance = 73, corpse = 5982, health = 2600, maxhealth = 2600},
["Venusaur"] = {chance = 210, corpse = 5962, health = 8000, maxhealth = 8000},
["Squirtle"] = {chance = 20, corpse = 6008, health = 800, maxhealth = 800},
["Wartortle"] = {chance = 70, corpse = 5978, health = 2600, maxhealth = 2600},
["Blastoise"] = {chance = 210, corpse = 5999, health = 7500, maxhealth = 7500},
["Growlithe"] = {chance = 16, corpse = 6036, health = 1000, maxhealth = 1000},
["Arcanine"] = {chance = 150, corpse = 6031, health = 6800, maxhealth = 6800},
["Psyduck"] = {chance = 18, corpse = 6029, health = 950, maxhealth = 950},
["Golduck"] = {chance = 80, corpse = 6028, health = 4000, maxhealth = 4000},
["Pikachu"] = {chance = 18, corpse = 6001, health = 900, maxhealth = 900},
["Raichu"] = {chance = 140, corpse = 5996, health = 3500, maxhealth = 3500},
["Ekans"] = {chance = 10, corpse = 5979, health = 600, maxhealth = 600},
["Arbok"] = {chance = 100, corpse = 5984, health = 2900, maxhealth = 2900},
["Cubone"] = {chance = 30, corpse = 6050, health = 1200, maxhealth = 1200},
["Marowak"] = {chance = 95, corpse = 6072, health = 3900, maxhealth = 3900},
["Caterpie"] = {chance = 2, corpse = 5971, health = 300, maxhealth = 300},
["Metapod"] = {chance = 10, corpse = 5970, health = 1100, maxhealth = 1100},
["Butterfree"] = {chance = 65, corpse = 5985, health = 2000, maxhealth = 2000},
["Goldeen"] = {chance = 3, corpse = 2970, health = 950, maxhealth = 950},
["Seaking"] = {chance = 40, corpse = 3038, health = 2000, maxhealth = 2000},
["Spearow"] = {chance = 5, corpse = 5968, health = 200, maxhealth = 200},
["Fearow"] = {chance = 60, corpse = 5992, health = 3300, maxhealth = 3300},
["Drowzee"] = {chance = 20, corpse = 6026, health = 1150, maxhealth = 1150},
["Hypno"] = {chance = 170, corpse = 6046, health = 4600, maxhealth = 4600},
["Diglett"] = {chance = 12, corpse = 6023, health = 900, maxhealth = 900},
["Dugtrio"] = {chance = 85, corpse = 6024, health = 3450, maxhealth = 3450},
["Krabby"] = {chance = 12, corpse = 6039, health = 850, maxhealth = 850},
["Kingler"] = {chance = 70, corpse = 6340, health = 3250, maxhealth = 3250},
["Paras"] = {chance = 2, corpse = 137, health = 850, maxhealth = 850},
["Parasect"] = {chance = 65, corpse = 6027, health = 3800, maxhealth = 3800},
["Dratini"] = {chance = 120, corpse = 149, health = 520, maxhealth = 520},
["Dragonair"] = {chance = 200, corpse = 6002, health = 3000, maxhealth = 3000},
["Dragonite"] = {chance = 500, corpse = 4295, health = 17000, maxhealth = 17000},
["Ponyta"] = {chance = 25, corpse = 5975, health = 1400, maxhealth = 1400},
["Rapidash"] = {chance = 145, corpse = 4323, health = 5500, maxhealth = 5500},
["Pinsir"] = {chance = 80, corpse = 7282, health = 4000, maxhealth = 4000},
["Seel"] = {chance = 18, corpse = 6030, health = 1000, maxhealth = 1000},
["Dewgong"] = {chance = 190, corpse = 143, health = 5200, maxhealth = 5200},
["Exeggcute"] = {chance = 25, corpse = 206, health = 800, maxhealth = 800},
["Exeggutor"] = {chance = 150, corpse = 3005, health = 450, maxhealth = 4000},
["Koffing"] = {chance = 34, corpse = 2936, health = 900, maxhealth = 900},
["Weezing"] = {chance = 100, corpse = 6306, health = 2800, maxhealth = 2800},
["Staryu"] = {chance = 20, corpse = 5987, health = 1050, maxhealth = 1050},
["Starmie"] = {chance = 110, corpse = 7320, health = 3800, maxhealth = 3800},
["Rhyhorn"] = {chance = 70, corpse = 3035, health = 3800, maxhealth = 3800},
["Rhydon"] = {chance = 200, corpse = 2858, health = 7000, maxhealth = 7000},
["Shellder"] = {chance = 40, corpse = 2837, health = 800, maxhealth = 800},
["Snorlax"] = {chance = 400, corpse = 6016, health = 9500, maxhealth = 9500},
["Giant Snorlax"] = {chance = 1500, corpse = 2948, health = 25000, maxhealth = 25000},
["Gyarados"] = {chance = 300, corpse = 6331, health = 7800, maxhealth = 7800},
["Machop"] = {chance = 40, corpse = 6045, health = 1100, maxhealth = 1100},
["Machoke"] = {chance = 70, corpse = 4251, health = 2850, maxhealth = 3500},
["Machamp"] = {chance = 200, corpse = 6048, health = 7500, maxhealth = 7500},
["Clefairy"] = {chance = 30, corpse = 2968, health = 600, maxhealth = 600},
["Clefable"] = {chance = 145, corpse = 6006, health = 2400, maxhealth = 2400},
["Jigglypuff"] = {chance = 18, corpse = 6011, health = 550, maxhealth = 550},
["Wigglytuff"] = {chance = 110, corpse = 6012, health = 2900, maxhealth = 2900},
["Venonat"] = {chance = 40, corpse = 5997, health = 1350, maxhealth = 1350},
["Venomoth"] = {chance = 95, corpse = 2925, health = 3850, maxhealth = 3850},
["Meowth"] = {chance = 40, corpse = 6034, health = 950, maxhealth = 950},
["Persian"] = {chance = 80, corpse = 6009, health = 2250, maxhealth = 2250},
["Mankey"] = {chance = 30, corpse = 6035, health = 1050, maxhealth = 1050},
["Primeape"] = {chance = 110, corpse = 6032, health = 4500, maxhealth = 4500},
["Tentacool"] = {chance = 20, corpse = 2961, health = 1050, maxhealth = 1050},
["Tentacruel"] = {chance = 200, corpse = 6037, health = 7050, maxhealth = 7050},
["Slowpoke"] = {chance = 30, corpse = 139, health = 1200, maxhealth = 1200},
["Slowbro"] = {chance = 110, corpse = 140, health = 4600, maxhealth = 4600},
["Cloyster"] = {chance = 170, corpse = 144, health = 120, maxhealth = 5000},
["Gastly"] = {chance = 40, corpse = 5993, health = 1000, maxhealth = 1000},
["Haunter"] = {chance = 70, corpse = 6004, health = 3000, maxhealth = 3000},
["Gengar"] = {chance = 200, corpse = 6336, health = 7000, maxhealth = 7000},
["Onix"] = {chance = 150, corpse = 2990, health = 5300, maxhealth = 5300},
["Hitmonlee"] = {chance = 900, corpse = 6067, health = 5500, maxhealth = 5500},
["Hitmonchan"] = {chance = 900, corpse = 5977, health = 5500, maxhealth = 5500},
["Lickitung"] = {chance = 145, corpse = 2953, health = 4800, maxhealth = 4800},
["Chansey"] = {chance = 350, corpse = 6010, health = 7500, maxhealth = 7500},
["Tangela"] = {chance = 140, corpse = 5976, health = 3500, maxhealth = 3500},
["Kangaskhan"] = {chance = 170, corpse = 6073, health = 7000, maxhealth = 7000},
["Scyther"] = {chance = 800, corpse = 3002, health = 6500, maxhealth = 6500},
["Electabuzz"] = {chance = 259, corpse = 6065, health = 6800, maxhealth = 6800},
["Magmar"] = {chance = 240, corpse = 7283, health = 7200, maxhealth = 7200},
["Shiny Magikarp"] = {chance = 700, corpse = 8766, health = 3500, maxhealth = 3500},
["Shiny Abra"] = {chance = 800, corpse = 8771, health = 5000, maxhealth = 5000},
["Shiny Growlithe"] = {chance = 800, corpse = 8742, health = 4800, maxhealth = 4800},
["Shiny Alakazam"] = {chance = 1200, corpse = 2941, health = 15000, maxhealth = 15000},
["Shiny Jynx"] = {chance = 1000, corpse = 8758, health = 11000, maxhealth = 11000},
["Shiny Venusaur"] = {chance = 1500, corpse = 8764, health = 16000, maxhealth = 16000},
["Shiny Farfetchd"] = {chance = 1100, corpse = 8745, health = 18000, maxhealth = 18000},
["Shiny Venomoth"] = {chance = 1300, corpse = 8761, health = 24000, maxhealth = 24000},
["Shiny Venonat"] = {chance = 900, corpse = 2996, health = 6800, maxhealth = 6800},
["Shiny Cubone"] = {chance = 800, corpse = 2942, health = 7200, maxhealth = 7200},
["Shiny Marowak"] = {chance = 1300, corpse = 2943, health = 24000, maxhealth = 24000},
["Shiny Electabuzz"] = {chance = 1300, corpse = 8773, health = 27000, maxhealth = 27000},
["Shiny Raichu"] = {chance = 1000, corpse = 8770, health = 19000, maxhealth = 19000},
["Shiny Beedrill"] = {chance = 1000, corpse = 8767, health = 15000, maxhealth = 15000},
["Shiny Butterfree"] = {chance = 1000, corpse = 8762, health = 15000, maxhealth = 15000},
["Shiny Rattata"] = {chance = 700, corpse = 8751, health = 4200, maxhealth = 4200},
["Shiny Raticate"] = {chance = 1100, corpse = 8765, health = 8000, maxhealth = 8000},
["Shiny Oddish"] = {chance = 900, corpse = 8749, health = 3900, maxhealth = 3900},
["Shiny Zubat"] = {chance = 1000, corpse = 8750, health = 5200, maxhealth = 5200},
["Shiny Golbat"] = {chance = 1200, corpse = 2940, health = 10500, maxhealth = 10500},
["Shiny Voltorb"] = {chance = 1000, corpse = 8754, health = 7300, maxhealth = 7300},
["Shiny Electrode"] = {chance = 1300, corpse = 8753, health = 12000, maxhealth = 12000},
["Shiny Horsea"] = {chance = 1000, corpse = 8768, health = 4200, maxhealth = 4200},
["Shiny Seadra"] = {chance = 1300, corpse = 8760, health = 10000, maxhealth = 10000},
["Shiny Krabby"] = {chance = 1050, corpse = 8755, health = 4650, maxhealth = 4650},
["Shiny Kingler"] = {chance = 1300, corpse = 8769, health = 9500, maxhealth = 9500},
["Shiny Dratini"] = {chance = 900, corpse = 8744, health = 6000, maxhealth = 6000},
["Shiny Dragonair"] = {chance = 1300, corpse = 2946, health = 12500, maxhealth = 12500},
["Shiny Grimer"] = {chance = 800, corpse = 8752, health = 5700, maxhealth = 5700},
["Shiny Muk"] = {chance = 1220, corpse = 8747, health = 9600, maxhealth = 9600},
}

local description = "Contains "..getArticle(i).." %pokename."

function onUse(cid, item, frompos, item2, topos)
local name = getItemNameById(item2.itemid)
if item.itemid == 2149 then 
catchrate = 2
oncatch = 24
onfail = 23
bolabola = 2222
elseif item.itemid == 2146 then       
catchrate = 4
oncatch = 198
onfail = 197
bolabola = 3250
elseif item.itemid == 2147 then       
catchrate = 7
oncatch = 202
onfail = 201
bolabola = 4430
elseif item.itemid == 2150 then 
catchrate = 9
oncatch = 200
onfail = 199
bolabola = 2220
elseif item.itemid == 129 then 
catchrate = 4
oncatch = 198
onfail = 197
bolabola = 214
elseif item.itemid == 3246 then 
catchrate = 10000
oncatch = 222
onfail = 222
bolabola = 203
elseif item.itemid == 2644 then    
catchrate = 4
oncatch = 204
onfail = 203
bolabola = 3273
end
local rate = (catchrate)
local catch = oncatch
local fail = onfail
local newid = bolabola
for i,x in pairs(pokes) do
if getItemNameById(item2.itemid):find(i:lower()) then
if getItemIdByName(name) == pokes[i].corpse then
if cid ~= getItemAttribute(item2.uid, "corpseowner") and isInArray({1,8}, getPlayerGroupId(cid)) then
doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
return true
end
doRemoveItem(item.uid, 1)
doRemoveItem(item2.uid, 1)
local pegar = math.random(1, x.chance)
if pegar <= 1*(rate) then
doSendMagicEffect(topos, catch)

local nas = {
["%%pokename"] = i
}
for i,x in pairs(nas) do
if description:find(i) then
description = description:gsub(i, x)
end
end

local function capturou(params)
if not isCreature(params.cid) then
return true
end
if not string.find(getPlayerStorageValue(cid, 54842), ""..i..",") then
       doPlayerAddSoul(cid, 1)
setPlayerStorageValue(cid, 54842, getPlayerStorageValue(cid, 54842)..""..i..", ")
end
if getPlayerFreeCap(cid) <= 0.99 then
item = doCreateItemEx(newid-1)
doItemSetAttribute(item, "poke", params.poke)
doItemSetAttribute(item, "nome", params.nome)
doItemSetAttribute(item, "description", params.description)
doPlayerSendMailByName(getCreatureName(params.cid), item, 1)
doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
doPlayerSendTextMessage(cid, 27, "Since you are already holding six pokemons, this pokeball has been sent to your depot.")
else
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "poke", params.poke)
doItemSetAttribute(item, "nome", params.nome)
doItemSetAttribute(item, "description", params.description)
doPlayerAddItemEx(params.cid, item, true)
doTransformItem(item, newid)
doPlayerSendTextMessage(cid, 27, "Congratulations, you caught a "..i.."!")
end
if #getCreatureSummons(cid) >= 1 then
doSendMagicEffect(getThingPos(getCreatureSummons(cid)[1]), 178)
else
doSendMagicEffect(getThingPos(cid), 178)
end
end

local description = "Contains "..getArticle(i).." "..i.."."
local poke1 = "This is "..i.."'s pokeball. HP = ["..x.health.."/"..x.maxhealth.."]"
addEvent(capturou, 4000, {cid = cid, poke = poke1, nome = i, description = description, ball = 2219, letter = 2597})
else
function ruim(params)
if not isCreature(params.cid) then
return true
end
doPlayerSendTextMessage(params.cid, 27, "Sorry, your poke ball broke.")
if #getCreatureSummons(params.cid) >= 1 then
doSendMagicEffect(getThingPos(getCreatureSummons(params.cid)[1]), 166)
else
doSendMagicEffect(getThingPos(params.cid), 166)
end
end
addEvent(ruim, 4000, {cid = cid})
doSendMagicEffect(topos, fail)
end
end
end
end
return TRUE
end

Now send me this error in the Console:
Code:
[31/07/2012 17:37:26] [Error - Action Interface] 
[31/07/2012 17:37:26] data/actions/scripts/original_script_catch.lua
[31/07/2012 17:37:26] Description: 
[31/07/2012 17:37:26] data/lib/050-function.lua:164: attempt to index local 'str' (a nil value)
[31/07/2012 17:37:26] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/original_script_catch.lua)
[31/07/2012 17:37:26] data/actions/scripts/catch.lua:200: unexpected symbol near '%'

Someone's can fix this? Very Thanks!
Nubaza.

SOLVED
 
Last edited:
Back
Top