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

simple pet script wanted

Sacantera

New Member
Joined
Aug 20, 2009
Messages
33
Reaction score
0
hi guys im after a realy simple pet script where you can buy and summon a pet (maybe say !buypet"creaturesname" and when it dies you can revive it at a cost by saying !revivepet thanks
 
Code:
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
 
Last edited:
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

thanks loads mate respect ++ where shall i put it in talk action but when i do it wont load the server talk actions?
 
Last edited:
anywhere, but dont forget this in talkactions.xml;
Code:
<talkaction words="!buypet; !revivepet" event="script" value="pet.lua"/>
must be like this
 
Back
Top