• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

onDeath ifSummon

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hey,

Is there any function which will check if a creature which died (onDeath) is a summon?

and I don't mean 'isCreature(cid)'

Code:
function onDeath(cid, corpse, deathList)
	if(isCreature(cid) and getCreatureMaster(cid)) then

would that work, can't test it.
 
so this would work?
Code:
function onDeath(cid, corpse, deathList)
local s = 5002
	if (getCreatureMaster(cid) ~= cid) then
		return setPlayerStorageValue(cid,s,0)
	end
end
 
LUA:
function isSummon(cid)
    return (getCreatureMaster(cid) ~= cid)
end

returns -> true is creature is summon / false if not is summon

if you will use with players should be

if not isSummon(cid) then
 
so this would work?
Code:
function onDeath(cid, corpse, deathList)
local s = 5002
	if (getCreatureMaster(cid) ~= cid) then
		return setPlayerStorageValue(cid,s,0)
	end
end

The check if it is a summon would work but:
setPlayerStorageValue(cid,s,0)
won't work, because you can't set a storage value to a monster..

You could use
setPlayerStorageValue(getCreatureMaster(cid),s,0)
to set a storage to the owner of the creature..
 
getCreatureMaster(cid) ~= cid:
-->cid is a summon of getCreatureMaster(cid)
getCreatureMaster(cid) == cid:
-->cid is no summon

If you want to set the owner of a summoned creature to get a storage when it dies then you need to change:
setPlayerStorageValue(cid,s,0)
to:
setPlayerStorageValue(getCreatureMaster(cid) ,s,0)

I don't know how your onDeath is registered, but in some cases you need to check: isPlayer(getCreatureMaster(cid))
 
stop posting in threads everywhere about the same issue and stick to one thread, noone likes ppl spamming everywhere for the same problem
 
Back
Top