Por Noobao02, 13 de dez. de 2010 em Archived
info
Grupo: Campones
Registrado: 21/08/10
Posts: 24
Reputação: +1
olha , eu estou com um script de ride, pra pokemon, um script igual o script que tem nos ot de pokemon daki,
mais tipo quando eu clico pra ele dar ride ele daá, mais dai quando eu clico pra ele sair do ride aparece o seguinte erro :
[13/12/2010 13:07:40] [Error - Action Interface] [13/12/2010 13:07:40] data/actions/scripts/ride.lua:onUse [13/12/2010 13:07:40] Description: [13/12/2010 13:07:40] data/actions/scripts/ride.lua:48: attempt to index local 'balls' (a nil value) [13/12/2010 13:07:40] stack traceback: [13/12/2010 13:07:40] data/actions/scripts/ride.lua:48: in function <data/actions/scripts/ride.lua:14>
[13/12/2010 13:07:40] [Error - Action Interface]
[13/12/2010 13:07:40] data/actions/scripts/ride.lua:onUse
[13/12/2010 13:07:40] Description:
[13/12/2010 13:07:40] data/actions/scripts/ride.lua:48: attempt to index local 'balls' (a nil value)
[13/12/2010 13:07:40] stack traceback:
[13/12/2010 13:07:40] data/actions/scripts/ride.lua:48: in function <data/actions/scripts/ride.lua:14>
e ele não sai da montaria .
alguem aê poderia me ajudar e arrumar isso ? muito grato !
ride :
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 function onUse(cid, item, frompos, item2, topos) local pokes = { ['Tauros'] = {128, 200}, ['Ninetales'] = {129, 300}, ['Rapidash'] = {130, 350}, ['Ponyta'] = {131, 200}, ['Rhyhorn'] = {132, 150}, ['Arcanine'] = {12, 500}, ['Shiny Arcanine'] = {492, 800}, ['Shiny Venusaur'] = {494, 700}, ['Crystal Onix'] = {293, 400}, ['Onix'] = {126, 350}, ['Venusaur'] = {134, 350}, ['Dodrio'] = {133, 350}, ['Doduo'] = {135, 250}, } local idballs = { [2531] = {"Pokeball"}, [2557] = {"Superball"}, [2524] = {"Greatball"}, [2525] = {"Ultraball"}, [2523] = {"Masterball"}, } local old_speed = getCreatureBaseSpeed(cid) local summons = getCreatureSummons(cid) local storage = 9393 local exhaust = 0 local time = 0 if (getPlayerStorageValue(cid, storage) <= os.time()) then if getPlayerStorageValue(cid, 18000) == 10 then local nome = getItemName(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid) local balls = idballs[getPlayerSlotItem(cid,8).itemid] local poke_name = nome:match('(.-) '..balls[1]) local action_id = getItemAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "aid") doChangeSpeed(cid, -(getCreatureSpeed(cid) - getCreatureBaseSpeed(cid))) setPlayerStorageValue(cid, storage, os.time()+exhaust) doRemoveCondition(cid, CONDITION_OUTFIT) setPlayerStorageValue(cid, 18000, 7) setPlayerStorageValue(cid, 25000, 6) local monster = doCreateMonster(poke_name, getCreaturePosition(cid)) doConvinceCreature(cid, monster) doCreatureAddHealth(monster, -(tonumber(getPokemonMaxLife(poke_name) - action_id))) doPlayerSay(cid, poke_name .. ", I'm tired of riding!", TALKTYPE_SAY) return true end if isPremium(cid) == FALSE then return doPlayerSendCancel(cid, "Você não é premium account.") end if #getCreatureSummons(cid) < 1 then return doPlayerSendCancel(cid, "Para dar ride você precisa de um pokemon") end local pokemon = pokes[getCreatureName(getCreatureSummons(cid)[1])] local name = getCreatureName(getCreatureSummons(cid)[1]) if not pokes[name] then return doPlayerSendCancel(cid, "Este pokemon não pode dar ride.") end setPlayerStorageValue(cid, storage, os.time()+exhaust) doChangeSpeed(cid, pokemon[2]) setPlayerStorageValue(cid, 18000, 10) setPlayerStorageValue(cid, 25000, 5) doSetCreatureOutfit(cid, {lookType = pokemon[1], lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1) setPlayerStorageValue(cid,10000,pokemon[1]) setPlayerStorageValue(cid,8889,pokemon[2]) doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "aid", getCreatureHealth(getCreatureSummons(cid)[1])) function getPokemonId(summons) for _, pid in ipairs(summons) do return pid end end doRemoveCreature(getPokemonId(summons)) doPlayerSay(cid, name .. ", Let's go RIDE!", TALKTYPE_SAY) end end
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
function onUse(cid, item, frompos, item2, topos)
local pokes = {
['Tauros'] = {128, 200},
['Ninetales'] = {129, 300},
['Rapidash'] = {130, 350},
['Ponyta'] = {131, 200},
['Rhyhorn'] = {132, 150},
['Arcanine'] = {12, 500},
['Shiny Arcanine'] = {492, 800},
['Shiny Venusaur'] = {494, 700},
['Crystal Onix'] = {293, 400},
['Onix'] = {126, 350},
['Venusaur'] = {134, 350},
['Dodrio'] = {133, 350},
['Doduo'] = {135, 250},
}
local idballs = {
[2531] = {"Pokeball"},
[2557] = {"Superball"},
[2524] = {"Greatball"},
[2525] = {"Ultraball"},
[2523] = {"Masterball"},
local old_speed = getCreatureBaseSpeed(cid)
local summons = getCreatureSummons(cid)
local storage = 9393
local exhaust = 0
local time = 0
if (getPlayerStorageValue(cid, storage) <= os.time()) then
if getPlayerStorageValue(cid, 18000) == 10 then
local nome = getItemName(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid)
local balls = idballs[getPlayerSlotItem(cid,8).itemid]
local poke_name = nome:match('(.-) '..balls[1])
local action_id = getItemAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "aid")
doChangeSpeed(cid, -(getCreatureSpeed(cid) - getCreatureBaseSpeed(cid)))
setPlayerStorageValue(cid, storage, os.time()+exhaust)
doRemoveCondition(cid, CONDITION_OUTFIT)
setPlayerStorageValue(cid, 18000, 7)
setPlayerStorageValue(cid, 25000, 6)
local monster = doCreateMonster(poke_name, getCreaturePosition(cid))
doConvinceCreature(cid, monster)
doCreatureAddHealth(monster, -(tonumber(getPokemonMaxLife(poke_name) - action_id)))
doPlayerSay(cid, poke_name .. ", I'm tired of riding!", TALKTYPE_SAY)
return true
if isPremium(cid) == FALSE then
return doPlayerSendCancel(cid, "Você não é premium account.")
if #getCreatureSummons(cid) < 1 then
return doPlayerSendCancel(cid, "Para dar ride você precisa de um pokemon")
local pokemon = pokes[getCreatureName(getCreatureSummons(cid)[1])]
local name = getCreatureName(getCreatureSummons(cid)[1])
if not pokes[name] then
return doPlayerSendCancel(cid, "Este pokemon não pode dar ride.")
doChangeSpeed(cid, pokemon[2])
setPlayerStorageValue(cid, 18000, 10)
setPlayerStorageValue(cid, 25000, 5)
doSetCreatureOutfit(cid, {lookType = pokemon[1], lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
setPlayerStorageValue(cid,10000,pokemon[1])
setPlayerStorageValue(cid,8889,pokemon[2])
doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "aid", getCreatureHealth(getCreatureSummons(cid)[1]))
function getPokemonId(summons)
for _, pid in ipairs(summons) do
return pid
doRemoveCreature(getPokemonId(summons))
doPlayerSay(cid, name .. ", Let's go RIDE!", TALKTYPE_SAY)
goback:
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
function getPokemonMaxLife(name)
----- Config -----
local MaximoSummon = 1
local nome = getItemName(item.uid)
local poke_name = nome:match('(.-) Pokeball')
local action_id = getItemAttribute(item.uid, "aid")
if getItemAttribute(item.uid, "aid") == -1 then
return doPlayerSendCancel(cid, "Seu pokemon está morto.")
if getPlayerStorageValue(cid, 25000) == 5 then
return doPlayerSendCancel(cid, "Você está montando.")
if getPlayerStorageValue(cid, 23000) == 5 then
return doPlayerSendCancel(cid, "Você está voando.")
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
doPlayerSendCancel(cid, "Para Soltar seus pokemons, coloque-os no slot da pokeball.")
return TRUE
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))
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)
Editado Dezembro 14 por Noobao02
Registrado: 03/10/10
Posts: 45
Reputação: +10
fica meio dificil de ajuda sem te o script
poste o script de ride e o script de go/back
@mago
tá aê
info
Grupo: Campones
Registrado: 21/08/10
Posts: 24
Reputação: +1
olha , eu estou com um script de ride, pra pokemon, um script igual o script que tem nos ot de pokemon daki,
mais tipo quando eu clico pra ele dar ride ele daá, mais dai quando eu clico pra ele sair do ride aparece o seguinte erro :
e ele não sai da montaria .
alguem aê poderia me ajudar e arrumar isso ? muito grato !
ride :
goback:
Editado Dezembro 14 por Noobao02