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

verific and remove summon

foxkbt

Member
Joined
Sep 29, 2009
Messages
290
Reaction score
7
Location
Salvador
I need a function that checks whether a specific monster summoned
and then remove it

ex: it getPlayerSummon(cid) == demon then
doRemoveSummon(cid, demon)
end

I know it's wrong. is only one example
 
Code:
function doRemoveCreatureSummon(cid, name)
	if isCreature(cid) and type(name) == "string" then
		for _, sid in ipairs(getCreatureSummons(cid)) do
			if getCreatureName(sid):lower() == name:lower() then
				return doRemoveCreature(sid)
			end
		end
	end
end
 
man
it dosent work

function onCastSpell(cid, var)
if getPlayerItemCount(cid, 11416) >= 1 then
if isCreature(cid) and type(name) == "wolf" then
doPlayerRemoveItem(cid, 11416)
return doCombat(cid, combat, var)
for _, sid in ipairs(getCreatureSummons(cid)) do
if getCreatureName(sid):lower() == name:lower() then
return doRemoveCreature(sid)
end
end
else
doPlayerSendCancel(cid, "voce nao tem monstro invocado pa transmutar.")
end
end
 
You're using it wrong :P
Code:
function doRemoveCreatureSummon(cid, name)
	if isCreature(cid) and type(name) == "string" then
		for _, sid in ipairs(getCreatureSummons(cid)) do
			if getCreatureName(sid):lower() == name:lower() then
				doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
				return doRemoveCreature(sid)
			end
		end
	end
end

function onCastSpell(cid, var)
	if getPlayerItemCount(cid, 11416) > 0 and doRemoveCreatureSummon(cid, "Wolf") then
		doPlayerRemoveItem(cid, 11416, 1)
		return doCombat(cid, combat, var)
	else
		doPlayerSendCancel(cid, "Você não tem monstro invocado pa transmutar.")
	end
end
 
Last edited:
Back
Top