• 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!

Lua Simple Lua Bug (Help Rep++)

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
55
Location
Switzerland
Hello, I have a problem with the Pokemon catch system, please help me..


Code:
[23/07/2011 18:57:55] data/actions/scripts/catch.lua:onUse
[23/07/2011 18:57:55] Description: 
[23/07/2011 18:57:55] data/lib/050-function.lua:234: attempt to index a boolean value
[23/07/2011 18:57:55] stack traceback:
[23/07/2011 18:57:55]     data/lib/050-function.lua:234: in function 'getItemName'
[23/07/2011 18:57:55]     data/actions/scripts/catch.lua:422: in function <data/actions/scripts/catch.lua:419>

Pokemon Catch System..


LUA:
local chance = {
['abra'] = 60,      
['kadabra'] = 30, 
['alakazam'] = 5, 
['gastly'] = 60,      
['haunter'] = 30, 
['gengar'] = 5, 
['aipom'] = 50,      
['ambipom'] = 5,      
['machop'] = 70,   
['machoke'] = 35, 
['machamp'] = 6,
['bellsprout'] = 100,  
['weepinbell'] = 60,  
['victreebel'] = 10,  
['tentacool'] = 70,   
['tentacruel'] = 5,  
['geodude'] = 80,   
['graveler'] = 36,  
['golem'] = 7,   
['ponyta'] = 60,    
['rapidash'] = 10,  
['slowpoke'] = 80,
['slowbro'] = 20,   
['magnemite'] = 70,  
['magneton'] = 15,  
['magnezone'] = 5,  
['farfetchd'] = 40,
['doduo']  = 90,   
['dodrio'] = 20,  
['seel'] = 65,     
['dewgong'] = 5, 
['grimer'] = 90, 
['muk'] = 10,     
['shellder'] = 65,  
['cloyster'] = 5,  
['elekid'] = 50,   
['magby'] = 50,   
['tyrogue'] = 50,   
['pichu'] = 50,   
['onix'] = 15, 
['drowzee'] = 65,
['hypno'] = 5,   
['krabby'] = 100,
['kingler'] = 20,
['corphish'] = 90,
['crawdaunt'] = 15,
['voltorb'] = 80,
['electrode'] = 15,
['exeggcute'] = 60,
['exeggutor'] = 6,
['cubone'] = 80,
['marowak'] = 5,
['hitmonlee'] = 2, 
['hitmonchan'] = 2,
['lickitung'] = 30,  
['koffing'] = 90,
['weezing'] = 15,
['rhyhorn'] = 50,
['rhydon'] = 5,
['chansey'] = 3,
['tangela'] = 50,
['kangaskhan'] = 25,  
['horsea'] = 99,
['seadra'] = 15,
['kingdra'] = 2,
['togepi'] = 60,
['togetic'] = 10,
['shuppet'] = 40,
['banette'] = 3,
['duskull'] = 40,
['dusclops'] = 3,
['goldeen'] = 99,
['seaking'] = 18,
['buizel'] = 18,
['staryu'] = 50, 
['starmie'] = 5,
['mime jr'] = 45,
['mr.mime'] = 4,
['scyther'] = 2, 
['smoochum'] = 45,
['jynx'] = 3, 
['electabuzz'] = 3, 
['magmar'] = 2, 
['pinsir'] = 40,
['tauros'] = 35,
['magikarp'] = 999,
['gyarados'] = 4,
['lapras'] = 10,
['ditto'] = 1,
['eevee'] = 18,
['vaporeon'] = 2,
['flareon'] = 2,
['jolteon'] = 2,
['porygon'] = 2,
['omanyte'] = 20,
['omastar'] = 2,
['kabuto'] = 20,
['kabutops'] = 2,
['aerodactyl'] = 2,
['snorlax'] = 5,
['articuno'] = 1,
['zapdos'] = 1,
['moltres'] = 1, 
['dratini'] = 25,
['dragonair'] = 5,
['dragonite'] = 1,
['celebi'] = 1,      
['lugia'] = 1,     
['mew'] = 1,       
['mewtwo'] = 1,
['beedrill'] = 20,
['bulbasaur'] = 40,
['ivysaur'] = 6,
['venusaur'] = 2,
['charmander'] = 40,
['charmeleon'] = 6,
['charizard'] = 2,
['squirtle'] = 40,
['wartortle'] = 6,
['blastoise'] = 2, 
['caterpie'] = 999, 
['metapod'] = 75,
['butterfree'] = 20,
['weedle'] = 999, 
['kakuna'] = 75, 
['pidgey'] = 90,  
['pidgeotto'] = 30,
['pidgeot'] = 7,  
['rattata'] = 300, 
['raticate'] = 60,
['spearow'] = 80,
['fearow'] = 10,
['ekans'] = 60,
['arbok'] = 10,
['pikachu'] = 70,
['raichu'] = 5, 
['sandshrew'] = 80,
['sandslash'] = 7,
['nidoran F'] = 80,
['nidorina'] = 10,
['nidoqueen'] = 2,
['nidoran M'] = 80,
['nidorino'] = 10,
['nidoking'] = 2,
['clefairy'] = 38,
['clefable'] = 4,
['vulpix'] = 60,
['ninetales'] = 5,   
['jigglypuff'] = 39,
['wigglytuff'] = 5,
['zubat'] = 99,
['golbat'] = 30,
['crobat'] = 3,
['oddish'] = 120, 
['gloom'] = 40,
['vileplume'] = 5,
['paras'] = 90,   
['parasect'] = 15,
['venonat'] = 70,
['venomoth'] = 9,
['diglett'] = 80,
['dugtrio'] = 15,
['meowth'] = 80,
['persian'] = 35,
['psyduck'] = 60,
['golduck'] = 3,  
['mankey'] = 65,
['primeape'] = 9,
['growlithe'] = 50,
['arcanine'] = 2,  
['poliwag'] = 85, 
['poliwhirl'] = 10,
['politoed'] = 3,
['poliwrath'] = 3,
['riolu'] = 30,
['lucario'] = 2,
['elder charizard'] = 1,
['crystal onix'] = 1,
['red gyarados'] = 1,
['shiny horsea'] = 1,
['shiny abra'] = 1, 
['shiny seadra'] = 1,
['shiny krabby'] = 1,
['shiny kingler'] = 1,
['shiny tentacruel'] = 1,
['shiny paras'] = 1,
['shiny parasect'] = 1,
['shiny raticate'] = 1,
['shiny muk'] = 1,
['shiny growlithe'] = 1,
['shiny arcanine'] = 1,
['shiny butterfree'] = 1,
['shiny electrode'] = 1,
['shiny raichu'] = 1,
['shiny venomoth'] = 1,
['ivysaur2'] = 1,
['charmeleon2'] = 1,
['wartortle2'] = 1,
['pidgeotto2'] = 1,
['spearow2'] = 1,
['nidorina2'] = 1,
['nidorino2'] = 1,
['vulpix2'] = 1,
['paras2'] = 1,
['psyduck2'] = 1,
['growlithe2'] = 1,
['poliwhirl2'] = 1,
['kadabra2'] = 1,
['machoke2'] = 1,
['weepinbell2'] = 1,
['tentacool2'] = 1,
['riolu2'] = 1,
['scyther2'] = 1,
['graveler2'] = 1,
['shellder2'] = 1,
['haunter2'] = 1,
['drowzee2'] = 1,
['exeggcute2'] = 1,
['seadra2'] = 1,
['togepi2'] = 1,
['rhyhorn2'] = 1,
['magikarp2'] = 1,
['omanyte2'] = 1,
['kabuto2'] = 1,
['smoochum2'] = 1,
['mime jr2'] = 1,
['dragonair2'] = 1,
['shiny krabby2'] = 1,
['shiny tentacool2'] = 1,
['shiny horsea2'] = 1,
}

local ID_GREATBALL = 2146
local ID_SUPERBALL = 2147
local ID_ULTRABALL = 2150
local ID_MASTERBALL = 2554
local ID_CAPTUROU = 24
local ID_NAO_CAPTUROU = 23

local pokebolas = {
[2149] = {2531,"Pokeball"},
[2147] = {2653,"Superball"},
[2146] = {2652,"Greatball"},
[2150] = {2654,"Ultraball"},
[2521] = {2195,"Masterball"},
}

local level = {
['abra'] = 5,      
['kadabra'] = 40, 
['alakazam'] = 80, 
['machop'] = 15,   
['machoke'] = 40, 
['machamp'] = 70,
['bellsprout'] = 5,  
['weepinbell'] = 20,  
['victreebel'] = 50,  
['tentacool'] = 15,   
['tentacruel'] = 70,  
['geodude'] = 5,   
['graveler'] = 35,  
['golem'] = 65,   
['ponyta'] = 10,    
['rapidash'] = 50,  
['slowpoke'] = 5,
['slowbro'] = 50,   
['magnemite'] = 10,  
['magneton'] = 40,  
['farfetchd'] = 25,
['duduo']  = 15,   
['dodrio'] = 45,  
['seel'] = 15,     
['dewgong'] = 65, 
['grimer'] = 10, 
['muk'] = 40,     
['shellder'] = 5,  
['cloyster'] = 60,  
['gastly'] = 90,   
['haunter'] = 50,  
['gengar'] = 10,  
['onix'] = 50, 
['drowzee'] = 18,  
['hypno'] = 55,    
['krabby'] = 5,   
['klinger'] = 35,  
['voltorb'] = 5,    
['electrode'] = 40, 
['exeggcute'] = 8,  
['exeggutor'] = 45,   
['cubone'] = 15,    
['marowak'] = 52,  
['hitmonlee'] = 70,   
['hitmonchan'] = 65,  
['lickitung'] = 40,  
['koffing'] = 10,  
['weezing'] = 38,  
['rhyhorn'] = 20, 
['rhydon'] = 68,   
['chansey'] = 50,
['tangela'] = 30,   
['kangaskhan'] = 70,  
['horsea'] = 5, 
['seadra'] = 36, 
['goldeen'] = 5,  
['seaking'] = 32,
['staryu'] = 15,   
['starmie'] = 40,  
['mr.Mime'] = 60, 
['scyther'] = 80, 
['jynx'] = 70, 
['electabuzz'] = 72,  
['magmar'] = 72,  
['pinsir'] = 10,  
['tauros'] = 25,  
['magikarp'] = 1,   
['gyarados'] = 70,
['lapras'] = 40,
['ditto'] = 100,  
['eevee'] = 15,     
['vaporeon'] = 50,  
['flareon'] = 50,   
['jolteon'] = 50,   
['porygon'] = 40,  
['omanyte'] = 20,  
['omastar'] = 10,  
['kabuto'] = 20,    
['kabutops'] = 10,  
['snorlax'] = 35,  
['articuno'] = 150, 
['zapdos'] = 150, 
['moltres'] = 150,  
['dratini'] = 10,    
['dragonair'] = 50,
['dragonite'] = 80,  
['mew'] = 350,       
['mewtwo'] = 200,
['beedrill'] = 25,
['bulbasaur'] = 5, 
['ivysaur'] = 35,   
['venusaur'] = 75,
['charmander'] = 5, 
['charmeleon'] = 35, 
['charizard'] = 75,  
['squirtle'] = 5,   
['wartortle'] = 35,  
['blastoise'] = 75, 
['caterpie'] = 1,    
['metapod'] = 5,    
['butterfree'] = 25,  
['weedle'] = 1,    
['kakuna'] = 5,     
['pidgey'] = 5,     
['pidgeotto'] = 20,  
['pidgeot'] = 65,    
['rattata'] = 1,    
['raticate'] = 20,  
['spearow'] = 5,  
['fearow'] = 45, 
['ekans'] = 10,  
['arbok'] = 32,  
['pikachu'] = 18,  
['raichu'] = 42,   
['sandshrew'] = 13,  
['sandslash'] = 58,  
['nidoranFE'] = 10,  
['nidorina'] = 30,   
['nidoqueen'] = 60,  
['nidoranMA'] = 10,  
['nidorino'] = 30,   
['nidoking'] = 60,   
['clefairy'] = 40,  
['clefable'] = 10,
['vulpix'] = 10,      
['ninetales'] = 60,   
['jigglypuff'] = 5,
['wigglytuff'] = 40,  
['zubat'] = 6,   
['golbat'] = 28,  
['oddish'] = 5,    
['gloom'] = 25,     
['vileplume'] = 50,  
['paras'] = 5,      
['parasect'] = 50,  
['venonat'] = 13,   
['venomoth'] = 40,  
['diglett'] = 5,  
['dugtrio'] = 40,  
['meowth'] = 5,   
['persian'] = 30,  
['psyduck'] = 18, 
['golduck'] = 55,  
['mankey'] = 10,   
['primeape'] = 50, 
['growlithe'] = 18,  
['arcanine'] = 80,  
['poliwag'] = 5,    
['poliwhirl'] = 25,
['poliwrath'] = 60,   
}

-- Vá adicionando mais acima, como está ali ""
local function capturou(params)
doSendMagicEffect(getCreaturePosition(params.cid), 173)
doPlayerSendTextMessage(params.cid, 25, 'Parabens você capturou um  ('..params.monster..').')
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "name", ""..params.monster.." "..params.ball2)
doItemSetAttribute(item, "level", params.level)
doItemSetAttribute(item, "aid", params.hp)
doPlayerAddItemEx(params.cid, item, true)
end

local function naocapturou(params)

end

function onUse(cid, item, fromPosition, itemEx, toPosition)


local monster = getItemName(itemEx.uid):match("dead (.*)")
 if item.itemid == ID_GREATBALL then
 chances = (chance[monster]) * 3
elseif item.itemid == ID_SUPERBALL then
 chances = (chance[monster]) * 4
elseif item.itemid == ID_ULTRABALL then
 chances = (chance[monster]) * 6
 elseif item.itemid == 2521 then
 chances = (chance[monster]) * 10000
 else
 chances = chance[monster]
 end


if not chance[monster] then
return doPlayerSendTextMessage(cid, 23, 'Você não pode capturar este pokemon!')
end

if math.random(1,1000) <= chances then
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 24)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 202)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 198)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 200)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 24)
end


local hpmax =  0
local ball = pokebolas[item.itemid]
addEvent(capturou, 4000, {cid = cid, monster = monster, ball = ball[1], ball2 = ball[2], level = level[monster], hp = hpmax})
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
   else
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 23)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 201)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 197)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 199)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 203)
end
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
   end
return TRUE
end
 
LUA:
local chance = {
['abra'] = 60,      
['kadabra'] = 30, 
['alakazam'] = 5, 
['gastly'] = 60,      
['haunter'] = 30, 
['gengar'] = 5, 
['aipom'] = 50,      
['ambipom'] = 5,      
['machop'] = 70,   
['machoke'] = 35, 
['machamp'] = 6,
['bellsprout'] = 100,  
['weepinbell'] = 60,  
['victreebel'] = 10,  
['tentacool'] = 70,   
['tentacruel'] = 5,  
['geodude'] = 80,   
['graveler'] = 36,  
['golem'] = 7,   
['ponyta'] = 60,    
['rapidash'] = 10,  
['slowpoke'] = 80,
['slowbro'] = 20,   
['magnemite'] = 70,  
['magneton'] = 15,  
['magnezone'] = 5,  
['farfetchd'] = 40,
['doduo'] = 90,   
['dodrio'] = 20,  
['seel'] = 65,     
['dewgong'] = 5, 
['grimer'] = 90, 
['muk'] = 10,     
['shellder'] = 65,  
['cloyster'] = 5,  
['elekid'] = 50,   
['magby'] = 50,   
['tyrogue'] = 50,   
['pichu'] = 50,   
['onix'] = 15, 
['drowzee'] = 65,
['hypno'] = 5,   
['krabby'] = 100,
['kingler'] = 20,
['corphish'] = 90,
['crawdaunt'] = 15,
['voltorb'] = 80,
['electrode'] = 15,
['exeggcute'] = 60,
['exeggutor'] = 6,
['cubone'] = 80,
['marowak'] = 5,
['hitmonlee'] = 2, 
['hitmonchan'] = 2,
['lickitung'] = 30,  
['koffing'] = 90,
['weezing'] = 15,
['rhyhorn'] = 50,
['rhydon'] = 5,
['chansey'] = 3,
['tangela'] = 50,
['kangaskhan'] = 25,  
['horsea'] = 99,
['seadra'] = 15,
['kingdra'] = 2,
['togepi'] = 60,
['togetic'] = 10,
['shuppet'] = 40,
['banette'] = 3,
['duskull'] = 40,
['dusclops'] = 3,
['goldeen'] = 99,
['seaking'] = 18,
['buizel'] = 18,
['staryu'] = 50, 
['starmie'] = 5,
['mime jr'] = 45,
['mr.mime'] = 4,
['scyther'] = 2, 
['smoochum'] = 45,
['jynx'] = 3, 
['electabuzz'] = 3, 
['magmar'] = 2, 
['pinsir'] = 40,
['tauros'] = 35,
['magikarp'] = 999,
['gyarados'] = 4,
['lapras'] = 10,
['ditto'] = 1,
['eevee'] = 18,
['vaporeon'] = 2,
['flareon'] = 2,
['jolteon'] = 2,
['porygon'] = 2,
['omanyte'] = 20,
['omastar'] = 2,
['kabuto'] = 20,
['kabutops'] = 2,
['aerodactyl'] = 2,
['snorlax'] = 5,
['articuno'] = 1,
['zapdos'] = 1,
['moltres'] = 1, 
['dratini'] = 25,
['dragonair'] = 5,
['dragonite'] = 1,
['celebi'] = 1,      
['lugia'] = 1,     
['mew'] = 1,       
['mewtwo'] = 1,
['beedrill'] = 20,
['bulbasaur'] = 40,
['ivysaur'] = 6,
['venusaur'] = 2,
['charmander'] = 40,
['charmeleon'] = 6,
['charizard'] = 2,
['squirtle'] = 40,
['wartortle'] = 6,
['blastoise'] = 2, 
['caterpie'] = 999, 
['metapod'] = 75,
['butterfree'] = 20,
['weedle'] = 999, 
['kakuna'] = 75, 
['pidgey'] = 90,  
['pidgeotto'] = 30,
['pidgeot'] = 7,  
['rattata'] = 300, 
['raticate'] = 60,
['spearow'] = 80,
['fearow'] = 10,
['ekans'] = 60,
['arbok'] = 10,
['pikachu'] = 70,
['raichu'] = 5, 
['sandshrew'] = 80,
['sandslash'] = 7,
['nidoran F'] = 80,
['nidorina'] = 10,
['nidoqueen'] = 2,
['nidoran M'] = 80,
['nidorino'] = 10,
['nidoking'] = 2,
['clefairy'] = 38,
['clefable'] = 4,
['vulpix'] = 60,
['ninetales'] = 5,   
['jigglypuff'] = 39,
['wigglytuff'] = 5,
['zubat'] = 99,
['golbat'] = 30,
['crobat'] = 3,
['oddish'] = 120, 
['gloom'] = 40,
['vileplume'] = 5,
['paras'] = 90,   
['parasect'] = 15,
['venonat'] = 70,
['venomoth'] = 9,
['diglett'] = 80,
['dugtrio'] = 15,
['meowth'] = 80,
['persian'] = 35,
['psyduck'] = 60,
['golduck'] = 3,  
['mankey'] = 65,
['primeape'] = 9,
['growlithe'] = 50,
['arcanine'] = 2,  
['poliwag'] = 85, 
['poliwhirl'] = 10,
['politoed'] = 3,
['poliwrath'] = 3,
['riolu'] = 30,
['lucario'] = 2,
['elder charizard'] = 1,
['crystal onix'] = 1,
['red gyarados'] = 1,
['shiny horsea'] = 1,
['shiny abra'] = 1, 
['shiny seadra'] = 1,
['shiny krabby'] = 1,
['shiny kingler'] = 1,
['shiny tentacruel'] = 1,
['shiny paras'] = 1,
['shiny parasect'] = 1,
['shiny raticate'] = 1,
['shiny muk'] = 1,
['shiny growlithe'] = 1,
['shiny arcanine'] = 1,
['shiny butterfree'] = 1,
['shiny electrode'] = 1,
['shiny raichu'] = 1,
['shiny venomoth'] = 1,
['ivysaur2'] = 1,
['charmeleon2'] = 1,
['wartortle2'] = 1,
['pidgeotto2'] = 1,
['spearow2'] = 1,
['nidorina2'] = 1,
['nidorino2'] = 1,
['vulpix2'] = 1,
['paras2'] = 1,
['psyduck2'] = 1,
['growlithe2'] = 1,
['poliwhirl2'] = 1,
['kadabra2'] = 1,
['machoke2'] = 1,
['weepinbell2'] = 1,
['tentacool2'] = 1,
['riolu2'] = 1,
['scyther2'] = 1,
['graveler2'] = 1,
['shellder2'] = 1,
['haunter2'] = 1,
['drowzee2'] = 1,
['exeggcute2'] = 1,
['seadra2'] = 1,
['togepi2'] = 1,
['rhyhorn2'] = 1,
['magikarp2'] = 1,
['omanyte2'] = 1,
['kabuto2'] = 1,
['smoochum2'] = 1,
['mime jr2'] = 1,
['dragonair2'] = 1,
['shiny krabby2'] = 1,
['shiny tentacool2'] = 1,
['shiny horsea2'] = 1,
}
 
local ID_GREATBALL = 2146
local ID_SUPERBALL = 2147
local ID_ULTRABALL = 2150
local ID_MASTERBALL = 2554
local ID_CAPTUROU = 24
local ID_NAO_CAPTUROU = 23
 
local pokebolas = {
[2149] = {2531,"Pokeball"},
[2147] = {2653,"Superball"},
[2146] = {2652,"Greatball"},
[2150] = {2654,"Ultraball"},
[2521] = {2195,"Masterball"},
}
 
local level = {
['abra'] = 5,      
['kadabra'] = 40, 
['alakazam'] = 80, 
['machop'] = 15,   
['machoke'] = 40, 
['machamp'] = 70,
['bellsprout'] = 5,  
['weepinbell'] = 20,  
['victreebel'] = 50,  
['tentacool'] = 15,   
['tentacruel'] = 70,  
['geodude'] = 5,   
['graveler'] = 35,  
['golem'] = 65,   
['ponyta'] = 10,    
['rapidash'] = 50,  
['slowpoke'] = 5,
['slowbro'] = 50,   
['magnemite'] = 10,  
['magneton'] = 40,  
['farfetchd'] = 25,
['duduo'] = 15,   
['dodrio'] = 45,  
['seel'] = 15,     
['dewgong'] = 65, 
['grimer'] = 10, 
['muk'] = 40,     
['shellder'] = 5,  
['cloyster'] = 60,  
['gastly'] = 90,   
['haunter'] = 50,  
['gengar'] = 10,  
['onix'] = 50, 
['drowzee'] = 18,  
['hypno'] = 55,    
['krabby'] = 5,   
['klinger'] = 35,  
['voltorb'] = 5,    
['electrode'] = 40, 
['exeggcute'] = 8,  
['exeggutor'] = 45,   
['cubone'] = 15,    
['marowak'] = 52,  
['hitmonlee'] = 70,   
['hitmonchan'] = 65,  
['lickitung'] = 40,  
['koffing'] = 10,  
['weezing'] = 38,  
['rhyhorn'] = 20, 
['rhydon'] = 68,   
['chansey'] = 50,
['tangela'] = 30,   
['kangaskhan'] = 70,  
['horsea'] = 5, 
['seadra'] = 36, 
['goldeen'] = 5,  
['seaking'] = 32,
['staryu'] = 15,   
['starmie'] = 40,  
['mr.Mime'] = 60, 
['scyther'] = 80, 
['jynx'] = 70, 
['electabuzz'] = 72,  
['magmar'] = 72,  
['pinsir'] = 10,  
['tauros'] = 25,  
['magikarp'] = 1,   
['gyarados'] = 70,
['lapras'] = 40,
['ditto'] = 100,  
['eevee'] = 15,     
['vaporeon'] = 50,  
['flareon'] = 50,   
['jolteon'] = 50,   
['porygon'] = 40,  
['omanyte'] = 20,  
['omastar'] = 10,  
['kabuto'] = 20,    
['kabutops'] = 10,  
['snorlax'] = 35,  
['articuno'] = 150, 
['zapdos'] = 150, 
['moltres'] = 150,  
['dratini'] = 10,    
['dragonair'] = 50,
['dragonite'] = 80,  
['mew'] = 350,       
['mewtwo'] = 200,
['beedrill'] = 25,
['bulbasaur'] = 5, 
['ivysaur'] = 35,   
['venusaur'] = 75,
['charmander'] = 5, 
['charmeleon'] = 35, 
['charizard'] = 75,  
['squirtle'] = 5,   
['wartortle'] = 35,  
['blastoise'] = 75, 
['caterpie'] = 1,    
['metapod'] = 5,    
['butterfree'] = 25,  
['weedle'] = 1,    
['kakuna'] = 5,     
['pidgey'] = 5,     
['pidgeotto'] = 20,  
['pidgeot'] = 65,    
['rattata'] = 1,    
['raticate'] = 20,  
['spearow'] = 5,  
['fearow'] = 45, 
['ekans'] = 10,  
['arbok'] = 32,  
['pikachu'] = 18,  
['raichu'] = 42,   
['sandshrew'] = 13,  
['sandslash'] = 58,  
['nidoranFE'] = 10,  
['nidorina'] = 30,   
['nidoqueen'] = 60,  
['nidoranMA'] = 10,  
['nidorino'] = 30,   
['nidoking'] = 60,   
['clefairy'] = 40,  
['clefable'] = 10,
['vulpix'] = 10,      
['ninetales'] = 60,   
['jigglypuff'] = 5,
['wigglytuff'] = 40,  
['zubat'] = 6,   
['golbat'] = 28,  
['oddish'] = 5,    
['gloom'] = 25,     
['vileplume'] = 50,  
['paras'] = 5,      
['parasect'] = 50,  
['venonat'] = 13,   
['venomoth'] = 40,  
['diglett'] = 5,  
['dugtrio'] = 40,  
['meowth'] = 5,   
['persian'] = 30,  
['psyduck'] = 18, 
['golduck'] = 55,  
['mankey'] = 10,   
['primeape'] = 50, 
['growlithe'] = 18,  
['arcanine'] = 80,  
['poliwag'] = 5,    
['poliwhirl'] = 25,
['poliwrath'] = 60,   
}
 
-- Vá adicionando mais acima, como está ali ""
local function capturou(params)
doSendMagicEffect(getCreaturePosition(params.cid), 173)
doPlayerSendTextMessage(params.cid, 25, 'Parabens voce capturou um  ('..params.monster..').')
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "name", ""..params.monster.." "..params.ball2)
doItemSetAttribute(item, "level", params.level)
doItemSetAttribute(item, "aid", params.hp)
doPlayerAddItemEx(params.cid, item, true)
end
 
local function naocapturou(params)
 
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
 
local monster = getItemName(itemEx.uid):match("dead (.*)")
 if item.itemid == (ID_GREATBALL,1) then
 chances = (chance[monster]) * 3
elseif item.itemid == (ID_SUPERBALL,1) then
 chances = (chance[monster]) * 4
elseif item.itemid == (ID_ULTRABALL,1) then
 chances = (chance[monster]) * 6
 elseif item.itemid == 2521 then
 chances = (chance[monster]) * 10000
 else
 chances = chance[monster]
 end
 
 
if not chance[monster] then
return doPlayerSendTextMessage(cid, 23, 'Voce nao pode capturar este pokemon!')
end
 
if math.random(1,1000) <= chances then
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 24)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 202)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 198)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 200)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 24)
end
 
 
local hpmax = 0
local ball = pokebolas[item.itemid]
addEvent(capturou, 4000, {cid = cid, monster = monster, ball = ball[1], ball2 = ball[2], level = level[monster], hp = hpmax})
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
   else
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 23)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 201)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 197)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 199)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 203)
end
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
   end
return TRUE
end
 
@ Fresh

[23/07/2011 19:10:55] [Error - Action Interface]
[23/07/2011 19:10:55] data/actions/scripts/goback.lua:onUse
[23/07/2011 19:10:55] Description:
[23/07/2011 19:10:55] (luaDoCreatureAddHealth) Creature not found
[23/07/2011 19:11:47] [Error - LuaScriptInterface::loadFile] data/actions/scripts/catch.lua:421: ')' expected near ','
[23/07/2011 19:11:47] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/catch.lua)
[23/07/2011 19:11:47] data/actions/scripts/catch.lua:421: ')' expected near ','
 
Sorry :(

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
function getPokemonMaxLife(name)
        local file = io.open('data/monster/monsters.xml','r')
        local arquivo = file:read(-1):lower():match('<monster name="'..name:lower()..'" file="(.-)"/>')
        file:close()
        local data = io.open('data/monster/'..(arquivo or ''),'r')
        if not data then
            return 100
        end
        local maximo = data:read(-1):match('max%s*=%s*"(%d+)"')
        data:close()
        return maximo
end
----- Config -----
local MaximoSummon = 1
local nome = getItemName(item.uid)
local poke_name = nome:match('(.-) Pokeball')
local summons = getCreatureSummons(cid)
local action_id = getItemAttribute(item.uid, "aid")
----- Config -----
    if getItemAttribute(item.uid, "aid") == -1 then
    return doPlayerSendCancel(cid, "Seu pokemon está morto.")
    end    

    if getPlayerStorageValue(cid, 25000) == 5 then       
    return doPlayerSendCancel(cid, "Você está montando.")
    end
    if getPlayerStorageValue(cid, 23000) == 5 then
    return doPlayerSendCancel(cid, "Você está voando.")
    end
local summons = getCreatureSummons(cid)
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
doPlayerSendCancel(cid, "Para Soltar seus pokemons, coloque-os no slot da pokeball.")
return TRUE
end
if(table.maxn(summons) < MaximoSummon) then -- no summons
creature = doSummonCreature(poke_name, getCreaturePosition(cid))
doConvinceCreature(cid, creature)
registerCreatureEvent(creature, "DiePoke")
registerCreatureEvent(cid, "PlayerPokeDeath")
registerCreatureEvent(cid, "LogoutPoke")
doPlayerSay(cid, "Go,"..poke_name.."!!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(creature), 188)
doTransformItem(getPlayerSlotItem(cid,8).uid, 2531, 1)
doItemSetAttribute(getPlayerSlotItem(cid,8).uid,"name", poke_name .." Pokeball")
        if action_id ~= 0 then
doCreatureAddHealth(creature, -(tonumber(getPokemonMaxLife(poke_name) - action_id)))
        else
        doCreatureAddHealth(creature, getPokemonMaxLife(poke_name))
        end
else
for _, pid in ipairs(summons) do
if (table.maxn(summons) >= 1) then
doItemSetAttribute(item.uid, "aid", getCreatureHealth(summons[1]))
doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 188)
doPlayerSay(cid, "Back,"..poke_name..".", TALKTYPE_ORANGE_1)
doRemoveCreature(pid)
doTransformItem(getPlayerSlotItem(cid,8).uid, 2532, 1)
doItemSetAttribute(getPlayerSlotItem(cid,8).uid,"name", poke_name .." Pokeball")
end
end
end
return true
end
 
[23/07/2011 19:40:17] [Error - LuaScriptInterface::loadFile] data/actions/scripts/catch.lua:421: ')' expected near ','
[23/07/2011 19:40:17] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/catch.lua)
[23/07/2011 19:40:17] data/actions/scripts/catch.lua:421: ')' expected near ','
 
Back
Top