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

Pet sistem

zfrank17

New Member
Joined
Jul 6, 2010
Messages
27
Reaction score
1
i need help with this pet sistem... only 3 monsters
1-diablito evolve to demonio
2-demonio evolve to diablo
3-Diablo

i want more evolves who help me? here are my pet sistem (complete)..
data/mods/create a new xml (name pets)
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Pets" version="1.72" author="zfrank" contact="-" enabled="yes">
	<description>
		v1.72
			fixed another bug in buying pets
		v1.71
			fixed bug in onPrepareDeath
		v1.7
			added support for custom requirements
			added ability to add more information to 'info' command
		v1.6
			added more pets
			added 'revive' command
		v1.5
			fixed bug where the pet only levels when it is greater than the level to evolve
			added 'release' command
		v1.41
			fixed bug where you can buy 2 pets
		v1.4
			added leveling up
		v1.31
			fixed 'list' command
		v1.3
			added evolution
			added buyable/unbuyable pets
		v1.2
			added 'speak' command
			added 'version' command
		v1.11
			fixed one line
		v1.1
			rewrote most of it again, fixed some bugs
		v1.0
			started from scratch
	</description>
	<event type="login" name="PetLogin" event="script" value="pets/creatureevents.lua"/>
	<event type="logout" name="PetLogout" event="script" value="pets/creatureevents.lua"/>
	<event type="preparedeath" name="PetDeath" event="script" value="pets/creatureevents.lua"/>
	<event type="kill" name="PetKill" event="script" value="pets/creatureevents.lua"/>
	<event type="joinchannel" name="PetChannelJoin" event="script" value="pets/creatureevents.lua"/>
	<event type="leavechannel" name="PetChannelLeave" event="script" value="pets/creatureevents.lua"/>
	<talkaction words="help;commands;buy;info;list;summon;status;speak;release;revive" channel="15" hide="yes" event="script" value="pets/talkactions.lua"/>
	<channel id="15" name="Pet"/>
	<!-- Pet Monsters -->
	<monster name="PET_Diablito" file="pets/diablito.xml"/>
	<monster name="PET_Demonio" file="pets/demonio.xml"/>
	<monster name="PET_Diablo" file="pets/diablo.xml"/>
</mod>
2-in mods folder create a new folder called monster in that folder create a new folder whit the name pets in that folder create 3 new xml
1-called Diablo
PHP:
<?xml version="1.0" encoding="UTF-8"?>
  <monster name="diablo" nameDescription="a diablo" tp="1" race="fire" species="fire" experience="0" speed="2500" manacost="0">
    <health now="9999999999" max="9999999999"/>
    <look type="12" head="19" body="104" legs="96" feet="96" corpse="6068"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
      <flag summonable="1"/>
      <flag attackable="1"/>
      <flag hostile="1"/>
      <flag illusionable="1"/>
      <flag convinceable="1"/>
      <flag pushable="0"/>
      <flag canpushitems="1"/>
      <flag staticattack="40"/>
      <flag lightlevel="0"/>
      <flag lightcolor="0"/>
      <flag targetdistance="1"/>
      <flag runonhealth="0"/>
    </flags>
    <attacks>
      <attack name="melee" interval="2000" min="-7000" max="-12000"/>
      <attack name="Great Fireball" interval="2000" chance="0" min="-15000" max="-20000"/>
      <attack name="Fire Field" interval="2000" chance="65" min="-15000" max="-20000"/>
      <attack name="Great Energy Beam" interval="2000" chance="20" min="-15000" max="-20000"/>
    </attacks>
    <defenses armor="40" defense="45">
      <defense name="Ultimate Healing" interval="2000" chance="25" min="30000" max="60000"/>
    </defenses>
    <immunities>
      <immunity physical="0"/>
      <immunity energy="1"/>
      <immunity fire="1"/>
      <immunity poison="1"/>
      <immunity lifedrain="0"/>
      <immunity paralyze="1"/>
      <immunity outfit="1"/>
      <immunity drunk="1"/>
      <immunity invisible="1"/>
    </immunities>
  <summons maxSummons="2">
      <summon name="fire elemental" interval="2000" chance="50"/>
    </summons>
    <voices interval="1000" chance="10">
      <voice sentence="Your soul will be mine!"/>
      <voice sentence="MWA HA HA HA HA!"/>
    </voices>
    <loot>
      <item id="2148" countmax="100" chance1="100000" chancemax="0"/>
      <item id="2148" countmax="25" chance1="100000" chancemax="0"/>
      <item id="2393" chance="1000"/>
      <item id="7591" chance="5000"/>
      <item id="7590" chance="5000"/>
      <item id="2447" chance="1333"/>
      <item id="7382" chance="1333"/>
      <item id="2157" countmax="1" chance1="8000" chancemax="0"/>
      <item id="5880" chance="100000"/>
      <item id="2514" chance="500"/>
      <item id="2432" chance="1538"/>
      <item id="2472" chance="1000"/>
      <item id="2004" chance="100000">
        <inside>
          <item id="2678" countmax="3" chance1="10000" chancemax="0"/>
          <item id="2148" countmax="100" chance1="100000" chancemax="0"/>
          <item id="2151" countmax="4" chance1="4000" chancemax="0"/>
          <item id="2462" chance="555"/>
      <item id="2539" chance="3000"/>
      <item id="2542" chance="3000"/>
          <item id="2149" countmax="3" chance1="1428" chancemax="0"/>
          <item id="2171" chance="1333"/>
          <item id="2387" chance="6666"/>
          <item id="2470" chance="1200"/>
          <item id="2520" chance="666"/>
          <item id="2418" chance="833"/>
          <item id="2377" chance="3333"/>
        </inside>
      </item>
    </loot>
  </monster>
2-called: diablito
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="diablito" nameDescription="a diablito" race="blood" experience="1950" speed="500" manacost="0">
  <health now="99999999" max="99999999"/>
  <look type="237" corpse="6364"/>
  <targetchange interval="5000" chance="8"/>
  <strategy attack="100" defense="0"/>
  <flags>
      <flag summonable="1"/>
      <flag attackable="1"/>
      <flag hostile="1"/>
      <flag illusionable="1"/>
      <flag convinceable="1"/>
      <flag pushable="0"/>
      <flag canpushitems="1"/>
      <flag staticattack="40"/>
      <flag lightlevel="0"/>
      <flag lightcolor="0"/>
      <flag targetdistance="1"/>
      <flag runonhealth="0"/>
  </flags>
  <attacks>
    <attack name="melee" interval="1000" skill="70" attack="80"/>
    <attack name="fire" interval="1000" chance="10" range="7" radius="4" target="1" min="-500" max="-3500">
      <attribute key="shootEffect" value="fire"/>
      <attribute key="areaEffect" value="firearea"/>
    </attack>
    <attack name="fire" interval="1000" chance="34" range="7" radius="2" target="1" min="-900" max="-5000">
      <attribute key="shootEffect" value="fire"/>
      <attribute key="areaEffect" value="firearea"/>
    </attack>
  </attacks>
  <defenses armor="15" defense="15">
    <defense name="healing" interval="1000" chance="25" min="7500" max="12500">
      <attribute key="areaEffect" value="blueshimmer"/>
    </defense>
    <defense name="speed" interval="1000" chance="40" speedchange="600" duration="40000">
      <attribute key="areaEffect" value="redshimmer"/>
    </defense>
  </defenses>
  <elements>
	<element firePercent="100"/>
	<element earthPercent="30"/>
	<element deathPercent="25"/>
	<element icePercent="-25"/>
	<element holyPercent="-12"/>
  </elements>
  <immunities>
    <immunity paralyze="1"/>
    <immunity invisible="1"/>
  </immunities>

  <loot>
   <item id="2148" countmax="79" chance1="100000" chancemax="0"/>
   <item id="2050" chance="15000"/>
   <item id="6558" chance="2222"/>
   <item id="2260" chance="18000"/>
   <item id="6300" chance="999"/>
   <item id="2465" chance="6577"/>
   <item id="2004" chance="100000">
		<inside>
			<item id="2548" chance="20000"/>
			<item id="2465" chance="6577"/>
			<item id="2185" chance="833"/>
			<item id="2464" chance="7887"/>
			<item id="5944" chance="5666"/>
			<item id="6500" countmax="1" chance1="7777" chancemax="0"/>
			<item id="2150" countmax="1" chance1="8888" chancemax="0"/>
			<item id="2165" chance="4555"/>
		</inside>
	</item>
  </loot>
</monster>
3- called: demonio
PHP:
<?xml version="1.0" encoding="UTF-8"?>
  <monster name="Demonio" nameDescription="a demonio" race="fire" species="fire" experience="6000" speed="1000" manacost="0">
    <health now="999999999" max="999999999"/>
    <look type="35" head="20" body="30" legs="40" feet="50" corpse="2916"/>
    <targetchange interval="5000" chance="8"/>
    <strategy attack="100" defense="0"/>
    <flags>
      <flag summonable="1"/>
      <flag attackable="1"/>
      <flag hostile="1"/>
      <flag illusionable="1"/>
      <flag convinceable="1"/>
      <flag pushable="0"/>
      <flag canpushitems="1"/>
      <flag staticattack="40"/>
      <flag lightlevel="0"/>
      <flag lightcolor="0"/>
      <flag targetdistance="1"/>
      <flag runonhealth="0"/>
    </flags>
    <attacks>
      <attack name="melee" interval="2000" min="-3000" max="-4500"/>
      <attack name="Great Fireball" interval="2000" chance="0" min="-6000" max="-10000"/>
      <attack name="Fire Field" interval="2000" chance="65" min="-10" max="-20"/>
      <attack name="Great Energy Beam" interval="2000" chance="20" min="-6000" max="-10000"/>
    </attacks>
    <defenses armor="40" defense="45">
      <defense name="Ultimate Healing" interval="2000" chance="25" min="10000" max="20000"/>
    </defenses>
    <immunities>
      <immunity physical="0"/>
      <immunity energy="1"/>
      <immunity fire="1"/>
      <immunity poison="1"/>
      <immunity lifedrain="0"/>
      <immunity paralyze="1"/>
      <immunity outfit="1"/>
      <immunity drunk="1"/>
      <immunity invisible="1"/>
    </immunities>
  <summons maxSummons="2">
      <summon name="fire elemental" interval="2000" chance="50"/>
    </summons>
    <voices interval="1000" chance="10">
      <voice sentence="Your soul will be mine!"/>
      <voice sentence="MWA HA HA HA HA!"/>
    </voices>
    <loot>
      <item id="2148" countmax="100" chance1="100000" chancemax="0"/>
      <item id="2148" countmax="25" chance1="100000" chancemax="0"/>
      <item id="2393" chance="1000"/>
      <item id="7591" chance="5000"/>
      <item id="7590" chance="5000"/>
      <item id="2447" chance="1333"/>
      <item id="7382" chance="1333"/>
      <item id="2157" countmax="1" chance1="8000" chancemax="0"/>
      <item id="5880" chance="100000"/>
      <item id="2514" chance="500"/>
      <item id="2432" chance="1538"/>
      <item id="2472" chance="1000"/>
      <item id="2004" chance="100000">
        <inside>
          <item id="2678" countmax="3" chance1="10000" chancemax="0"/>
          <item id="2148" countmax="100" chance1="100000" chancemax="0"/>
          <item id="2151" countmax="4" chance1="4000" chancemax="0"/>
          <item id="2462" chance="555"/>
      <item id="2539" chance="3000"/>
      <item id="2542" chance="3000"/>
          <item id="2149" countmax="3" chance1="1428" chancemax="0"/>
          <item id="2171" chance="1333"/>
          <item id="2387" chance="6666"/>
          <item id="2470" chance="1200"/>
          <item id="2520" chance="666"/>
          <item id="2418" chance="833"/>
          <item id="2377" chance="3333"/>
        </inside>
      </item>
    </loot>
  </monster>
3-go to data/mods/scripts(if u dont have that folder create1)
go to scripts create a new folder name pets open that folder create 3 new lua
1-called creatureevents
PHP:
dofile('mods/scripts/pets/pets.lua')

function onPrepareDeath(cid, deathList)
	local owner = getCreatureMaster(cid)
	sendMessage(owner, "tu pet ha muerto.")
	setPlayerPet(owner, -2)
	setPlayerStorageValue(owner, STORAGE.LOSTHEALTH, getPlayerStorageValue(owner, STORAGE.MAXHEALTH))
	return true
end

function onKill(cid, target, lastHit)
	if isMonster(target) then
		local targetName = getCreatureName(target)
		local owner = getCreatureMaster(cid)
		local experienceGain = getMonsterInfo(targetName).experience
		addPetExp(owner, experienceGain)
	end
	return true
end

function onLogin(cid)
	registerCreatureEvent(cid, "PetChannelJoin")
	registerCreatureEvent(cid, "PetChannelLeave")
	registerCreatureEvent(cid, "PetLogout")
	return true
end

function onLogout(cid)
	local pet = getPlayerPet(cid)
	if not isCreature(pet) then
		return true
	end
	maxHealth = getCreatureMaxHealth(pet)
	setPlayerStorageValue(cid, STORAGE.MAXHEALTH, maxHealth)
	setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, maxHealth - getCreatureHealth(pet))
	setPlayerPet(cid, 0)
	doSendMagicEffect(getCreaturePosition(pet), CONST_ME_POFF)
	doRemoveCreature(pet)
	return true
end

function onJoinChannel(cid, channel, users)
	if channel == PETS.CHANNELID then
		if getPlayerPet(cid) == -1 then
			return addEvent(sendMessage, 100, cid, "Usted no tiene una mascota. diga 'help' para una introducción al sistema de mascotas.")
		elseif getPlayerPet(cid) == -2 then
			return addEvent(sendMessage, 100, cid, "Su mascota ha muerto. Revivir a través del comando 'revive'.")
		end
		return summonPet(cid, getPlayerLookPos(cid)) and addEvent(sendMessage, 100, cid, "Diga 'status' para ver el estado de su mascota.") or addEvent(sendMessage, 100, cid, "Usted no puede llamar a tu mascota aquí.")
	end
	return true
end

function onLeaveChannel (cid, channel, users)
	if channel == PETS.CHANNELID then
		return onLogout(cid)
	end
	return true
end
2- called pets
PHP:
PETS = {
	VERSION = "1.72",
	PREFIX = "PET_",
	CHANNELID = 15,
	IDENTIFICATION = {
		[1] = {
			name = "Diablito",
			price = 100,
			health = 15000,
			evolve = {
				to = 2,
				at = 20,
			},
			check = true,
		},
		[2] = {
			name = "Demonio",
			price = 5000000000000,
			health = 30000,
			evolve = {
				to = 3,
				at = 35,
			},
			check = false,
		        info = "Evoluciona de Diablito."
                },
		[3] = {
			name = "Diablo",
			price = 5000000000000,
			health = 100000,
			check = false,
			info = "Evoluciona de Demonio."
		},
	}
}

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, "tu "..PETS.IDENTIFICATION[petType].name.." se ha pasado hasta el nivel de "..level..".")
		if PETS.IDENTIFICATION[petType].evolve then
			if level >= PETS.IDENTIFICATION[petType].evolve.at then
				local position = getCreaturePosition(cid)
				evolvePet(cid)
				sendMessage(cid, "tu "..PETS.IDENTIFICATION[petType].name.." se ha convertido en un "..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_BLACK)
		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
3- called: talkactions
PHP:
dofile('mods/scripts/pets/pets.lua')

COMMANDS = {
	version = function(cid)
		return sendMessage(cid, "Pet System v"..PET.VERSION.." by Aggresor")
	end,
	help = function(cid)
		return sendMessage(cid, "Usted puede comprar mascotas por una sola vez. Los precios dependen del tipo de animales de compañía que usted elija. Si tu mascota muere, no hay manera de recuperarlo, salvo mediante la compra de otro. diga 'commands' Para obtener una lista de comandos disponibles.")
	end,
	commands = function(cid)
		local allCommands = ""
		for i, v in pairs(COMMANDS) do
			allCommands = allCommands..i.."; "
		end
		return sendMessage(cid, "Commands: "..allCommands)
	end,
	buy = function(cid, param)
		if getPlayerStorageValue(cid, STORAGE.PETUID) ~= -1 then
			return sendMessage(cid, "Usted ya tiene una mascota.")
		end
		if param == "" then
			return sendMessage(cid, "buy <name>")
		end
		local id = petNames[param:lower()]
		local pet = PETS.IDENTIFICATION[id]
		if pet then
			if canBuyPet(cid, id) then
				if doPlayerRemoveMoney(cid, pet.price) then
					addPet(cid, id)
					summonPet(cid, getPlayerLookPos(cid))
					return sendMessage(cid, "Usted ha comprado un "..pet.name.." por un precio de "..pet.price.." gps.")
				end
				return sendMessage(cid, "Usted no tiene suficiente dinero para un "..pet.name.." ("..pet.price..").")
			end
			return sendMessage(cid, "Usted no tiene los requisitos para una "..pet.name..". o de esta compañía no está en venta.")
		end
		return sendMessage(cid, "Diga 'list' Para obtener una lista de animales de compañía puede comprar.")
	end,
	info = function(cid, param)
		if param == "" then
			return sendMessage(cid, "info <name>")
		end
		local pet = PETS.IDENTIFICATION[petNames[param:lower()]]
		return sendMessage(cid, pet and (
		"Name: "..pet.name..
		(pet.price and "\nPrice: "..pet.price or "\nNot on sale.")..
		(pet.evolve and "\nEvolve to "..PETS.IDENTIFICATION[pet.evolve.to].name.." at level "..pet.evolve.at.."." or "\nUnable to evolve further.")..
		(pet.info and "\n"..pet.info or ""))
		or "There is no such pet.")
	end,
	list = function(cid)
		local allPets = ""
		for id, pet in ipairs(PETS.IDENTIFICATION) do
			if canBuyPet(cid, id) then
				allPets = allPets..pet.name.."; "
			end
		end
		return sendMessage(cid, "Mascotas disponibles para usted: "..allPets)
	end,
	status = function(cid)
		local pet = getPlayerPet(cid)
		local level = getPlayerStorageValue(cid, STORAGE.LEVEL)
		local health
		if isCreature(pet) then
			health = getCreatureHealth(pet).."/"..getCreatureMaxHealth(pet)
		elseif pet == 0 then
			local maxHealth = getPlayerStorageValue(cid, STORAGE.MAXHEALTH)
			health = maxHealth - getPlayerStorageValue(cid, STORAGE.LOSTHEALTH).."/"..maxHealth
		elseif pet == -2 then
			health = "DEAD"
		end
		return health and sendMessage(cid, "nombre: "..PETS.IDENTIFICATION[getPlayerPetType(cid)].name.."\nSalud: "..health.."\nNivel: "..level.."\nExperiencia: "..getPlayerStorageValue(cid, STORAGE.EXPERIENCE).."/"..getExpNeeded(level+1)) or sendMessage(cid, "Usted no tiene una mascota. Si compra uno utilizando el comando 'buy'.")
	end,
	summon = function(cid)
		local pet = getPlayerPet(cid)
		if isCreature(pet) then
			local telePos = getPlayerLookPos(cid)
			local petPos = getCreaturePosition(pet)
			if getDistanceBetween(telePos, petPos) > 1 then
				if doTileQueryAdd(pet, telePos) == 1 then
					doTeleportThing(pet, telePos)
					doSendMagicEffect(petPos, CONST_ME_POFF)
					doSendMagicEffect(telePos, CONST_ME_TELEPORT)
					return sendMessage(cid, "Su mascota ha sido llamado a usted.")
				end
				return sendMessage(cid, "Usted no puede llamar a tu mascota aquí.")
			end
			return sendMessage(cid, "Su mascota está demasiado cerca de usted.")
		elseif pet == 0 then
			return summonPet(cid, getPlayerLookPos(cid)) and addEvent(sendMessage, 100, cid, "Diga 'status' para ver el estado de su mascota.") or addEvent(sendMessage, 100, cid, "Usted no puede llamar a tu mascota aquí.")
		elseif pet == -2 then
			return sendMessage(cid, "Su mascota ha muerto. Revivelo utilizando el comando 'revive'.")
		end
		return sendMessage(cid, "Usted no tiene una mascota. Si compra uno utilizando el comando 'buy'.")
	end,
	speak = function(cid, param)
		local pet = getPlayerPet(cid)
		if isCreature(pet) then
			return doCreatureSay(pet, param, TALKTYPE_ORANGE_1)
		elseif pet == 0 then
			return sendMessage(cid, "Convoque a su primera mascota.")
		elseif pet == -2 then
			return sendMessage(cid, "Su mascota ha muerto. Revive utilizando el comando de revivir.")
		end
		return sendMessage(cid, "Usted no tiene una mascota. Si compra uno utilizando el comando 'buy'.")
	end,
	release = function(cid, param)
		local pet = getPlayerPet(cid)
		if pet == -1 then
			return sendMessage(cid, "Usted no tiene una mascota. Si compra uno utilizando el comando 'buy'.")
		end
		if param:lower() == PETS.IDENTIFICATION[getPlayerPetType(cid)].name:lower() then
			local pet = getPlayerPet(cid)
			if isCreature(pet) then
				doSendMagicEffect(getCreaturePosition(pet), CONST_ME_POFF)
				doRemoveCreature(pet)
			end
			resetPlayerPet(cid)
			return sendMessage(cid, "Ha lanzado su mascota T.T.")
		end
		return sendMessage(cid, "¿Estás seguro de que desea liberar a su mascota? Utilice el comando 'release <pet name>' para confirmar la acción.")
	end,
	revive = function(cid, param)
		local pet = getPlayerPet(cid)
		if pet == -1 then
			return sendMessage(cid, "Usted no tiene una mascota. Si compra uno utilizando el comando 'buy'.")
		elseif pet == -2 then
			local petType = getPlayerPetType(cid)
			local cost = PETS.IDENTIFICATION[getPlayerPetType(cid)].health * getPlayerStorageValue(cid, STORAGE.LEVEL)
			if tonumber(param) == cost then
				if doPlayerRemoveMoney(cid, cost) then
					setPlayerPet(cid, 0)
					setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, getPlayerStorageValue(cid, STORAGE.MAXHEALTH) - 1)
					return sendMessage(cid, "Ustedes han reavivado su mascota con el costo de "..cost.." gps. sanalo antes de enviarlo a la batalla.")
				end
				return sendMessage(cid, "Usted no tiene el dinero suficiente para revivir a su mascota.")
			end
			return sendMessage(cid, "esto costara "..cost.." gps para revivir a su mascota. Utilice el comando 'revive <cost>' para confirmar la acción.")
		end
		return sendMessage(cid, "Usted no tiene una mascota. Si compra uno utilizando el comando 'buy'.")
	end,
}

function onSay(cid, words, param, channel)
	return COMMANDS[words](cid, param) or false
end

thats all
 
Back
Top