Ir para conteúdo

Bugg No Look(Creaturescript) Server Pokemon Pda


HolyMaN

Posts Recomendados

[Error - CreatureScript Interface]

[20/02/2012 17:31:58] data/creaturescripts/scripts/look.lua:onLook

[20/02/2012 17:31:58] Description:

[20/02/2012 17:31:58] data/lib/050-function.lua:107: attempt to index local 'str' (a nil value)

[20/02/2012 17:31:58] stack traceback:

[20/02/2012 17:31:58] data/lib/050-function.lua:107: in function 'getArticle'

[20/02/2012 17:31:58] data/creaturescripts/scripts/look.lua:16: in function <data creaturescripts="" scripts="" look.lua:1="">

Esse erro acontece quando o pokemon ganha muita experiencia e da save no server (mysql)

gostaria de de saber algumas soluções para esse tipo de problema.. alterar alguma coisa no banco de dados, ou alterar na function

quando da esse erro, se de trade com o item da crash no server..

vou postar os arquivos que usa o programa..

 

LOOK (creaturescrip)

 

function onLook(cid, thing, position, lookDistance)

 

local str = ""

 

if not isCreature(thing.uid) then

 

local iname = getItemInfo(thing.itemid)

 

if isPokeball(thing.itemid) then

if getItemAttribute(thing.uid, "") then

doPlayerSendCancel(cid, "You cannot use this item.")

end

local owner = getItemAttribute(thing.uid, "firstpoke")

 

local pokename = getItemAttribute(thing.uid, "poke")

local item = getItemInfo(thing.itemid)

str = "You see "..item.article.." "..item.name..".\n"

str = str.."It contains "..getArticle(pokename).." "..pokename.." [level "..getItemAttribute(thing.uid, "level").."].\n"

 

if owner and owner ~= getCreatureName(cid) then

str = str.."It belongs to "..owner..".\nIt is a unique item."

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

end

 

local boost = getItemAttribute(thing.uid, "boost") or 0

local boostshow = ""

 

if boost > 0 then

str = str.."Boost: +"..boost..".\n"

end

 

if getItemAttribute(thing.uid, "nick") then

str = str.."Nickname: "..getItemAttribute(thing.uid, "nick")..".\n"

end

 

 

 

if getItemAttribute(thing.uid, "gender") == SEX_MALE then

str = str.."It is male."

elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

 

--str = str.."\n--- Status ---"

--str = str.."\nOffense: "..math.floor(getItemAttribute(thing.uid, "offense")).." Defense: "..math.floor(getItemAttribute(thing.uid, "defense")).."\n"

--str = str.."Agility: "..math.floor(getItemAttribute(thing.uid, "speed")).." Sp. Attack: "..math.floor(getItemAttribute(thing.uid, "specialattack")).."\n"

--str = str.."Vitality: "..math.floor(getItemAttribute(thing.uid, "vitality"))..""

 

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

 

return false

 

elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then

 

str = "You see a "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."].\n"

 

if getItemAttribute(thing.uid, "gender") == SEX_MALE then

str = str.."It is male."

elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

 

return false

 

else

 

return true

 

end

end

 

local npcname = getCreatureName(thing.uid)

local l = string.len(npcname)

if not isPlayer(thing.uid) and not isMonster(thing.uid) then

--string.sub(npcname, l - 1, l) == " " then

local article = getPlayerStorageValue(thing.uid, 9891) == 1 and "He is" or "She is"

local nname = string.sub(npcname, 1, l - 2)

if nname == getCreatureName(cid) then

nname = "yourself"

article = "You are"

end

str = "You see "..nname..". "..article.." a pokemon trainer."

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

end

 

if not isMonster(thing.uid) then

return true

end

 

if getCreatureName(thing.uid) == "Evolution" then return false end

 

if not isSummon(thing.uid) then

local str = "You see a wild "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"

if isShiny(thing.uid) then

str = "You see a "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"

end

if getPokemonGender(thing.uid) == SEX_MALE then

str = str.."It is male."

elseif getPokemonGender(thing.uid) == SEX_FEMALE then

str = str.."It is female."

else

str = str.."It is genderless."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false

elseif isSummon(thing.uid) and not isPlayer(thing.uid) then

 

local boostlevel = getItemAttribute(getPlayerSlotItem(getCreatureMaster(thing.uid), 8).uid, "boost") or 0

local boostshow = " + "..boostlevel.."]"

 

if showBoostSeparated then

boostshow = "] [+"..boostlevel.."]"

end

 

local levelinfo = "["..getPokemonLevel(thing.uid)..""..boostshow..""

 

if getCreatureMaster(thing.uid) == cid then

local myball = getPlayerSlotItem(cid, 8).uid

local nexp = getItemAttribute(myball, "nextlevelexp")

 

local string = "You see your "..string.lower(getCreatureName(thing.uid)).." "..levelinfo.."."

string = string.."\nHit points: "..getCreatureHealth(thing.uid).."/"..getCreatureMaxHealth(thing.uid).."."

string = string.."\n"..getPokemonHappinessDescription(thing.uid)

if getItemAttribute(myball, "level") <= 99 then

string = string.."\nExperience needed to level up: "..nexp.."."

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)

else

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a "..string.lower(getCreatureName(thing.uid)).." "..levelinfo..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")

end

 

 

return false

end

 

return true

end

 

POKEEXP(creaturescript)

 

 

local balls = {11826, 11828, 11829, 11831, 11832, 11834, 11835, 11837,

11737, 11739, 11740, 11742, 11743, 11745, 11746, 11748}

 

local function playerAddExp(cid, exp)

doPlayerAddExp(cid, exp)

doSendAnimatedText(getThingPos(cid), exp, 215)

end

 

 

function onDeath(cid, corpse, deathList)

 

if not isCreature(cid) then return true end

if isSummon(cid) or not deathList or corpse.itemid == 0 or getCreatureName(cid) == "Evolution" then return true end

 

local givenexp = getWildPokemonExp(cid)

local expstring = ""..cid.."expEx"

local killer = getItemAttribute(corpse.uid, "corpseowner")

 

if givenexp > 0 then

for a = 1, #deathList do

local pk = deathList[a]

if isCreature(pk) then

playerAddExp(pk, math.floor(playerExperienceRate * givenexp * getDamageMapPercent(pk, cid)))

local firstball = getPlayerSlotItem(pk, 8)

 

if firstball and getItemAttribute(firstball.uid, expstring) and getItemAttribute(firstball.uid, expstring) > 0 then

local percent = getItemAttribute(firstball.uid, expstring) <= 1 and getItemAttribute(firstball.uid, expstring) or 1

local gainexp = math.ceil(percent * givenexp)

doItemSetAttribute(firstball.uid, expstring, 0)

givePokemonExp(pk, firstball, gainexp)

end

 

for b = 1, #balls do

local pokes = getItemsInContainerById(getPlayerSlotItem(pk, 3).uid, balls)

if #pokes >= 1 then

for _, uid in pairs (pokes) do

if getItemAttribute(uid, expstring) and getItemAttribute(uid, expstring) > 0 then

local percent = getItemAttribute(uid, expstring) <= 1 and getItemAttribute(uid, expstring) or 1

local gainexp = math.ceil(percent * givenexp)

doItemSetAttribute(uid, expstring, 0)

givePokemonExpInBp(pk, uid, gainexp, balls)

end

end

end

end

end

end

end

 

if isNpcSummon(cid) then

local master = getCreatureMaster(cid)

doSendMagicEffect(getThingPos(cid), getPlayerStorageValue(cid, 10000))

doCreatureSay(master, getPlayerStorageValue(cid, 10001), 1)

doRemoveCreature(cid)

return false

end

 

doItemSetAttribute(corpse.uid, "offense", getPlayerStorageValue(cid, 1011))

doItemSetAttribute(corpse.uid, "defense", getPlayerStorageValue(cid, 1012))

doItemSetAttribute(corpse.uid, "speed", getPlayerStorageValue(cid, 1013))

doItemSetAttribute(corpse.uid, "vitality", getPlayerStorageValue(cid, 1014))

doItemSetAttribute(corpse.uid, "spattack", getPlayerStorageValue(cid, 1015))

doItemSetAttribute(corpse.uid, "level", getLevel(cid))

doItemSetAttribute(corpse.uid, "gender", getPokemonGender(cid))

return true

end

Se precisar de mais arquivos só pedir que mando após ler..</data>

Editado por GOD Gniu
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...