Os pokes que eu mato não estão deixando corpse, e aparece esse erro no console cada vez que eu mato um pokemon
[04/09/2011 13:55:30] [Error - CreatureScript Interface]
[04/09/2011 13:55:30] data/creaturescripts/scripts/pokeexp.lua:onDeath
[04/09/2011 13:55:30] Description:
[04/09/2011 13:55:30] data/lib/011-string.lua:27: attempt to index local 'str' (a number value)
[04/09/2011 13:55:30] stack traceback:
[04/09/2011 13:55:30] data/lib/011-string.lua:27: in function 'explode'
[04/09/2011 13:55:30] data/creaturescripts/scripts/pokeexp.lua:9: in function <data/creaturescripts/scripts/pokeexp.lua:4>
pokeexp.lua algo de errado?
pokeexp.lua abaixo
---------------------------------------------------------------------------------------------------
local balls = {2220, 2221, 2227, 2222, 2223, 2224, 11365, 11366, 11367, 11362, 11363, 11364}
function onDeath(cid, corpse)
if isSummon(cid) then return true end
local givenexp = getWildPokemonExp(cid)
local expstring = cid.."expEx"
local killer = getItemAttribute(corpse.uid, "corpseowner")
local killers = string.explode(getPlayerStorageValue(cid, 2000), ", ")
for a = 1, #killers do
local pk = getPlayerByName(killers[a])
if isCreature(pk) then
local firstball = getPlayerSlotItem(pk, 8)
if getItemAttribute(firstball.uid, expstring) ~= null and getItemAttribute(firstball.uid, expstring) ~= 0 then
local gainexp = math.ceil(getItemAttribute(firstball.uid, expstring) * givenexp)
doItemSetAttribute(firstball.uid, expstring, 0)
givePokemonExp(pk, firstball, gainexp)
end
for b = 1, #balls do
local pokes = getItemsInContainerById(getPlayerSlotItem(pk, 3).uid, balls)
for _, uid in pairs (pokes) do
if getItemAttribute(uid, expstring) ~= null and getItemAttribute(uid, expstring) ~= 0 then
local gainexp = math.ceil(getItemAttribute(uid, expstring) * givenexp)
doItemSetAttribute(uid, expstring, 0)
givePokemonExpInBp(pk, uid, gainexp, balls)
end
end
end
end
end
doItemSetAttribute(corpse.uid, "offense", getOffense(cid))
doItemSetAttribute(corpse.uid, "defense", getDefense(cid))
doItemSetAttribute(corpse.uid, "speed", getSpeed(cid))
doItemSetAttribute(corpse.uid, "vitality", getVitality(cid))
doItemSetAttribute(corpse.uid, "spattack", getSpecialAttack(cid))
doItemSetAttribute(corpse.uid, "level", getLevel(cid))
return true
end
------------------------------------------------------------------------------------------------
lib/011-string.lua algo de errado?
lib/011-string.lua abaixo
------------------------------------------------------------------------------------------------
string.split = function (str)local t = {}
return not str:gsub("%w+", function(s) table.insert(t, s) return "" end):find("%S") and t or {}
end
string.trim = function (str)
return str:gsub("^%s*(.-)%s*$", "%1")
end
string.explode = function (str, sep, limit)
if(type(sep) ~= 'string' or isInArray({tostring(str):len(), sep:len()}, 0)) then
return {}
end
local i, pos, tmp, t = 0, 1, "", {}
for s, e in function() return string.find(str, sep, pos) end do
tmp = str:sub(pos, s - 1):trim()
table.insert(t, tmp)
pos = e + 1
i = i + 1
if(limit ~= nil and i == limit) then
break
end
end
tmp = str:sub(pos):trim()
table.insert(t, tmp)
return t
end
string.expand = function (str)
return string.gsub(str, "$(%w+)", function(n) return _G[n] end)
end
string.timediff = function (diff)
local format = {
{"week", diff / 60 / 60 / 24 / 7},
{"day", diff / 60 / 60 / 24 % 7},
{"hour", diff / 60 / 60 % 24},
{"minute", diff / 60 % 60},
{"second", diff % 60}
}
local t = {}
for k, v in ipairs(format) do
local d, tmp = math.floor(v[2]), ""
if(d > 0) then
tmp = (k < table.maxn(format) and (table.maxn(t) > 0 and ", " or "") or " and ") .. d .. " " .. v[1] .. (d ~= 1 and "s" or "")
table.insert(t, tmp)
end
end
return t
end
-----------------------------------------------------------------------------------------------------------------------
AJUDAAAAAAAAA?