O script é meio complexo, é uma parte de um sistema de pets, vou postar apenas o script que está dando o erro :
PETS = {
VERSION = "1.72",
PREFIX = "PET_",
CHANNELID = 1,
IDENTIFICATION = {
[1] = {
name = "Cat",
price = 100,
health = 100,
evolve = {
to = 3,
at = 10,
},
check = true,
},
[2] = {
name = "Dog",
price = 100,
health = 100,
evolve = {
to = 4,
at = 10,
},
check = true,
},
[3] = {
name = "Tiger",
price = false,
health = 300,
check = false,
info = "Evolves from Cat."
},
[4] = {
name = "Lion",
price = false,
health = 300,
check = false,
info = "Evolves from Dog."
},
[5] = {
name = "Husky",
price = 150,
health = 150,
check = function(cid) return isPremium(cid) end,
info = "Requires a premium account."
},
[6] = {
name = "Wolf",
price = 300,
health = 200,
evolve = {
to = 7,
at = 28,
},
check = function(cid) return getPlayerLevel(cid) >= 10 end,
info = "Requires level 10."
},
[7] = {
name = "War Wolf",
price = false,
health = 500,
evolve = {
to = 8,
at = 55,
},
check = false,
info = "Evolves from Wolf."
},
[8] = {
name = "Werewolf",
price = false,
health = 1000,
check = false,
info = "Evolves from War Wolf."
},
[9] = {
name = "Bear",
price = 200,
health = 300,
check = function(cid) return isDruid(cid) and getPlayerLevel(cid) >= 10 end,
info = "Only available to druids above level 10."
},
[10] = {
name = "Panda",
price = 200,
health = 300,
check = function(cid) return isDruid(cid) and getPlayerLevel(cid) >= 10 end,
info = "Only available to druids above level 10."
},
[11] = {
name = "Chicken",
price = 50,
health = 50,
check = true,
},
[12] = {
name = "Sheep",
price = 50,
health = 50,
check = true,
},
[13] = {
name = "Seagull",
price = 100,
health = 100,
check = function(cid) return isPremium(cid) end,
info = "Requires a premium account."
},
[14] = {
name = "Parrot",
price = 100,
health = 100,
check = function(cid) return isPremium(cid) end,
info = "Requires a premium account."
},
[15] = {
name = "Penguin",
price = 100,
health = 100,
check = function(cid) return isPremium(cid) end,
info = "Requires a premium account."
},
[16] = {
name = "Elephant",
price = 300,
health = 300,
check = function(cid) return isPremium(cid) and getPlayerLevel(cid) >= 10 end,
info = "Only available to Premium accounts above level 10."
},
[17] = {
name = "Dragon Hatchling",
price = 1000,
health = 300,
evolve = {
to = 18,
at = 20,
},
check = function(cid) return isPremium(cid) and isSorcerer(cid) and getPlayerLevel(cid) >= 25 end,
info = "Only available to Premium Sorcerers above level 25."
},
[18] = {
name = "Dragon",
price = false,
health = 1000,
check = false,
info = "Evolves from Dragon Hatchling."
},
[19] = {
name = "Monster Killer",
price = 1000000,
health = 3000000,
check = function(cid) return isPremium(cid) and getPlayerLevel(cid) >= 15000 end,
info = "Only avaible to Premium accounts above level 15000"
},
}
}
STORAGE = {
PETTYPE = 10000,
PETUID = 10001,
LOSTHEALTH = 10002,
MAXHEALTH = 10003,
EXPERIENCE = 10004,
LEVEL = 10005,
}
function getExpNeeded(level)
return (50 * (level - 1)^3 - 150 * (level - 1)^2 + 400 * (level - 1)) / 3
end
petNames = {}
for i, v in ipairs(PETS.IDENTIFICATION) do
petNames[v.name:lower()] = i
end
function sendMessage(cid, message)
return doPlayerSendChannelMessage(cid, "", message, TALKTYPE_CHANNEL_O, PETS.CHANNELID)
end
function resetPlayerPet(cid)
setPlayerStorageValue(cid, STORAGE.PETTYPE, -1)
setPlayerStorageValue(cid, STORAGE.PETUID, -1)
setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, 0)
setPlayerStorageValue(cid, STORAGE.MAXHEALTH, 0)
setPlayerStorageValue(cid, STORAGE.EXPERIENCE, 0)
setPlayerStorageValue(cid, STORAGE.LEVEL, 1)
end
function getPlayerPet(cid)
return getPlayerStorageValue(cid, STORAGE.PETUID)
end
function setPlayerPet(cid, pet)
return setPlayerStorageValue(cid, STORAGE.PETUID, pet)
end
function getPlayerPetType(cid)
return getPlayerStorageValue(cid, STORAGE.TYPE)
end
function setPlayerPetType(cid, type)
return setPlayerStorageValue(cid, STORAGE.TYPE, type)
end
function evolvePet(cid)
local pet = PETS.IDENTIFICATION[getPlayerPetType(cid)]
if pet.evolve then
local petcid = getPlayerPet(cid)
local pos
if isCreature(petcid) then
pos = getCreaturePosition(petcid)
doRemoveCreature(petcid)
end
setPlayerPet(cid, 0)
setPlayerPetType(cid, pet.evolve.to)
setPlayerStorageValue(cid, STORAGE.MAXHEALTH, PETS.IDENTIFICATION[pet.evolve.to].health)
setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, 0)
if pos then
summonPet(cid, pos)
end
return true
end
return false
end
function addPetExp(cid, amount)
local totalExp = getPlayerStorageValue(cid, STORAGE.EXPERIENCE) + amount
setPlayerStorageValue(cid, STORAGE.EXPERIENCE, totalExp)
local level = getPlayerStorageValue(cid, STORAGE.LEVEL)
local leveled = false
while totalExp >= getExpNeeded(level + 1) do
level = level + 1
leveled = true
end
if leveled then
local petType = getPlayerPetType(cid)
setPlayerStorageValue(cid, STORAGE.LEVEL, level)
sendMessage(cid, "Your "..PETS.IDENTIFICATION[petType].name.." has leveled up to level "..level..".")
if PETS.IDENTIFICATION[petType].evolve then
if level >= PETS.IDENTIFICATION[petType].evolve.at then
local position = getCreaturePosition(cid)
evolvePet(cid)
sendMessage(cid, "Your "..PETS.IDENTIFICATION[petType].name.." has evolved into a "..PETS.IDENTIFICATION[PETS.IDENTIFICATION[petType].evolve.to].name..".")
end
end
end
end
function addPet(cid, type)
if isCreature(getPlayerPet(cid)) then
return false
end
resetPlayerPet(cid)
setPlayerPet(cid, 0)
setPlayerPetType(cid, type)
setPlayerStorageValue(cid, STORAGE.MAXHEALTH, PETS.IDENTIFICATION[type].health)
return true
end
function summonPet(cid, pos)
if isCreature(getPlayerPet(cid)) then
return false
end
if getTilePzInfo(getCreaturePosition(cid)) or getTilePzInfo(pos) or doTileQueryAdd(cid, pos) ~= 1 then
return false
end
local pet = doSummonCreature(PETS.PREFIX..PETS.IDENTIFICATION[getPlayerPetType(cid)].name, pos)
if isCreature(pet) then
doSendMagicEffect(pos, CONST_ME_TELEPORT)
doConvinceCreature(cid, pet)
local maxHealth = getPlayerStorageValue(cid, STORAGE.MAXHEALTH)
setCreatureMaxHealth(pet, maxHealth)
doCreatureAddHealth(pet, maxHealth - getCreatureHealth(pet) - getPlayerStorageValue(cid, STORAGE.LOSTHEALTH))
setPlayerPet(cid, pet)
doCreatureSetSkullType(pet, SKULL_YELLOW)
registerCreatureEvent(pet, "PetDeath")
registerCreatureEvent(pet, "PetKill")
registerCreatureEvent(pet, "PetAttack")
return pet
end
return false
end
function canBuyPet(cid, id)
if getPlayerAccess(cid) >= 3 then
return true
end
if not PETS.IDENTIFICATION[id].price then
return false
end
if type(PETS.IDENTIFICATION[id].check) == "function" then
return PETS.IDENTIFICATION[id].check(cid)
end
return PETS.IDENTIFICATION[id].check
end
Detalhe : Quando tiro a parte 'getCreatureHealth' o script funciona normalmente, porém, fica incompleto, e não executa parte do sistema. E isso é a parte base do sistema, existe outro script do sistema que também usa getCreatureHealth, mas essa é indispensável.