local function this(cid, pet)
if getCreatureHealth(pet) < (getCreatureMaxHealth(pet) / 2) then
setPlayerStorageValue(cid, 5000, 2)
end
return addEvent(this, 1, cid, pet)
end
function onSay(cid, words, param, channel)
if words == "!buypet" then
if getPlayerStorageValue(cid, 5000) == -1 then
v = doSummonCreature(param, getThingPos(cid))
doPlayerSendTextMessage(cid, 27, "")
setPlayerStorageValue(cid, 5000, 1)
doConvinceCreature(cid, v)
this(cid, v)
else
doPlayerSendTextMessage(cid, 27, "?")
end
elseif words == "!revivepet" then
if getPlayerStorageValue(cid, 5000) == 2 then
v = doSummonCreature(param, getThingPos(cid))
doConvinceCreature(cid, v)
this(v)
setPlayerStorageValue(cid, 5000, 1)
else
doPlayerSendTextMessage(cid, 27, "?")
end
end
return true
end
Code:local function this(pet) if getCreatureHealth(pet) < (getCreatureMaxHealth(pet) / 2) then setGlobalStorageValue(5000, 2) end return addEvent(this, 1, pet) end function onSay(cid, words, param, channel) if words == "!buypet" then if getGlobalStorageValue(5000) == -1 then v = doSummonCreature(param, getThingPos(cid)) doPlayerSendTextMessage(cid, 27, "") setGlobalStorageValue(5000, 1) doConvinceCreature(cid, v) this(v) else doPlayerSendTextMessage(cid, 27, "?") end elseif words == "!revivepet" then if getGlobalStorageValue(5000) == 2 then v = doSummonCreature(param, getThingPos(cid)) doConvinceCreature(cid, v) this(v) setGlobalStorageValue(5000, 1) else doPlayerSendTextMessage(cid, 27, "?") end end return true end