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

problem with cript

tim26

Member
Joined
Aug 12, 2008
Messages
618
Reaction score
11
Location
Poland
it is a script with cath pokemon

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


if item.itemid == ID_GREATBALL then
chances = (chance[monster]) * 2
elseif item.itemid == ID_SUPERBALL then
chances = (chance[monster]) * 3
elseif item.itemid == ID_ULTRABALL then
chances = (chance[monster]) * 4
elseif item.itemid == 2521 then
chances = (chance[monster]) * 25
else
chances = chance[monster]
end

how may it working?
 
can't help much without the full script... you've just copied and pasted this bit from catch.lua:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)


local monster = getItemName(itemEx.uid):match("dead (.*)")
 if item.itemid == ID_GREATBALL then
 chances = (chance[monster]) * 2
elseif item.itemid == ID_SUPERBALL then
 chances = (chance[monster]) * 3
elseif item.itemid == ID_ULTRABALL then
 chances = (chance[monster]) * 4
 elseif item.itemid == 2521 then
 chances = (chance[monster]) * 500
 else
 chances = chance[monster]
 end
(minus the local monster = getItemName(itemEx.uid):match("dead (.*)") part)
 
yes i know i delete it but when i get it in script i get this error [23/12/2010 13:51:19] data/lib/050-function.lua:234: attempt to index a boolean value
[23/12/2010 13:51:19] stack traceback:
[23/12/2010 13:51:19] data/lib/050-function.lua:234: in function 'getItemName'
[23/12/2010 13:51:19] data/actions/scripts/catch.lua:409: in function <data/actions/scripts/catch.lua:407>


and my functio in 050-function libs

function getItemName(uid)
return getItemDescriptions(uid).name
end
 
Last edited:
post catch lua entire script, otherwise it'll be hard to support you
Lua:
local t = {
	[ID_GREATBALL] = 2,
	[ID_SUPERBALL] = 3,
	[ID_ULTRABALL] = 4,
	[2521] = 25,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local chances = 0
	chances = t[item.itemid] and ((chance[monster]) * t[item.itemid]) or chance[monster]
	return true
end
 
also error;/ i'm bad in tables:/ this is whole my script if you can please help maiking it working;/ only this thing i need all other working good;/

Code:
local chance = {
['abra'] = 99,      
['kadabra'] = 65, 
['alakazam'] = 20, 
['gastly'] = 99,      
['haunter'] = 65, 
['gengar'] = 20, 
['machop'] = 300,   
['machoke'] = 80, 
['machamp'] = 20,
['bellsprout'] = 400,  
['weepinbell'] = 100,  
['victreebel'] = 50,  
['tentacool'] = 200,   
['tentacruel'] = 35,  
['geodude'] = 200,   
['graveler'] = 100,  
['golem'] = 20,   
['ponyta'] = 150,    
['rapidash'] = 50,  
['slowpoke'] = 200,
['slowbro'] = 80,   
['magnemite'] = 200,  
['magneton'] = 70,  
['farfetchd'] = 150,
['doduo']  = 150,   
['dodrio'] = 70,  
['seel'] = 240,     
['dewgong'] = 20, 
['grimer'] = 100, 
['muk'] = 20,     
['shellder'] = 100,  
['cloyster'] = 20,  
['elekid'] = 80,   
['magby'] = 80,   
['tyrogue'] = 80,   
['pichu'] = 80,   
['onix'] = 40, 
['drowzee'] = 100,
['hypno'] = 35,   
['krabby'] = 300,
['kingler'] = 60,
['voltorb'] = 200,
['electrode'] = 60,
['exeggcute'] = 100,
['exeggutor'] = 45,
['cubone'] = 150,
['marowak'] = 20,
['hitmonlee'] = 29, 
['hitmonchan'] = 31,
['lickitung'] = 50,  
['koffing'] = 200,
['weezing'] = 50,
['rhyhorn'] = 95,
['rhydon'] = 20,
['chansey'] = 28,
['tangela'] = 300,
['kangaskhan'] = 70,  
['horsea'] = 800,
['seadra'] = 80,
['goldeen'] = 800,
['seaking'] = 60,
['staryu'] = 150, 
['starmie'] = 30,
['mr.mime'] = 30,
['scyther'] = 30, 
['jynx'] = 30, 
['electabuzz'] = 30, 
['magmar'] = 30, 
['pinsir'] = 85,
['tauros'] = 85,
['magikarp'] = 900,
['gyarados'] = 40,
['lapras'] = 40,
['ditto'] = 1,
['eevee'] = 35,
['vaporeon'] = 10,
['flareon'] = 10,
['jolteon'] = 10,
['porygon'] = 35,
['omanyte'] = 100,
['omastar'] = 35,
['kabuto'] = 100,
['kabutops'] = 35,
['aerodactyl'] = 35,
['snorlax'] = 40,
['articuno'] = 1,
['zapdos'] = 1,
['moltres'] = 1, 
['dratini'] = 90,
['dragonair'] = 40,
['dragonite'] = 1,
['mew'] = 1,       
['mewtwo'] = 1,
['beedrill'] = 100,
['bulbasaur'] = 100,
['ivysaur'] = 50,
['venusaur'] = 20,
['charmander'] = 100,
['charmeleon'] = 50,
['charizard'] = 20,
['squirtle'] = 100,
['wartortle'] = 50,
['blastoise'] = 20, 
['caterpie'] = 900, 
['metapod'] = 150,
['butterfree'] = 100,
['weedle'] = 900, 
['kakuna'] = 150, 
['pidgey'] = 500,  
['pidgeotto'] = 100,
['pidgeot'] = 40,  
['rattata'] = 600, 
['raticate'] = 100,
['spearow'] = 800,
['fearow'] = 78,
['ekans'] = 500,
['arbok'] = 50,
['pikachu'] = 120,
['raichu'] = 50, 
['sandshrew'] = 200,
['sandslash'] = 20,
['nidoran F'] = 150,
['nidorina'] = 50,
['nidoqueen'] = 20,
['nidoran M'] = 150,
['nidorino'] = 50,
['nidoking'] = 20,
['clefairy'] = 200,
['clefable'] = 40,
['vulpix'] = 200,
['ninetales'] = 40,   
['jigglypuff'] = 200,
['wigglytuff'] = 50,
['zubat'] = 800,
['golbat'] = 80,
['oddish'] = 800, 
['gloom'] = 100,
['vileplume'] = 50,
['paras'] = 250,   
['parasect'] = 20,
['venonat'] = 300,
['venomoth'] = 20,
['diglett'] = 500,
['dugtrio'] = 80,
['meowth'] = 500,
['persian'] = 50,
['psyduck'] = 100,
['golduck'] = 20,  
['mankey'] = 150,
['primeape'] = 20,
['growlithe'] = 200,
['arcanine'] = 20,  
['poliwag'] = 500, 
['poliwhirl'] = 80,
['poliwrath'] = 20,
['elder charizard'] = 5,
['crystal onix'] = 5,
['red gyarados'] = 5,
['shiny horsea'] = 10,
['shiny seadra'] = 10,
['shiny krabby'] = 10,
['shiny kingler'] = 10,
['shiny tentacool'] = 10,
['shiny tentacruel'] = 10,
['shiny paras'] = 10,
['shiny parasect'] = 10,
['shiny rattata'] = 10,
['shiny raticate'] = 10,
['shiny grimer'] = 10,
['shiny muk'] = 10,
['shiny growlithe'] = 10,
['shiny arcanine'] = 10,
['shiny beedrill'] = 10,
['shiny butterfree'] = 10,
['shiny electrode'] = 10,
['shiny farfetchd'] = 10,
['shiny raichu'] = 10,
['shiny venomoth'] = 10,
['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,
['graveler2'] = 1,
['shellder2'] = 1,
['haunter2'] = 1,
['drowzee2'] = 1,
['exeggcute2'] = 1,
['rhyhorn2'] = 1,
['magikarp2'] = 1,
['omanyte2'] = 1,
['kabuto2'] = 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] = {2532,"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]) * 2
elseif item.itemid == ID_SUPERBALL then
 chances = (chance[monster]) * 3
elseif item.itemid == ID_ULTRABALL then
 chances = (chance[monster]) * 4
 elseif item.itemid == 2521 then
 chances = (chance[monster]) * 500
 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
help please


fsdfdsfsdd
 
Last edited:
Why everyone is trying to open a poke server if they don't even have a clue how to create a normal server?

Try to replace: getItemName(itemEx.uid)
with: getItemNameById(itemEx.itemid)
 
Back
Top