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

function onTarget(cid, target)

Oskar1121

Excellent OT User
Joined
Jul 15, 2009
Messages
708
Reaction score
712
Location
Poland
I'm looking for someone who knows how to declare cid as a function onTarget as Monster, because normally cid is always assigned to the player.

Sorry for my English. I know that is horrible.
 
its not that horrible, but I dont understand. write in polish and I'll try to translate ok?(explain as much as possible)

dalej nie rozumiem, xD
if you want to register creature event to monster easiest(and most annoying) method is to add it in script tag in monster files(every single monster that have to have that script registered)
you can always try to register it in source when monster spawns

or use some smart hack, like if that monster spawns only in some special ocassion(in script) just register creatureevent in that script
like registerCreatureEvent(doCreateMonster().uid, eventsname) (dunno if create monster gonna work called this way)
 
Last edited:
just register the onTarget creature event ONLY for the monster you want and that's all :p
XML:
    <script>
        <event name="eventname"/> 
    </script>
 
PHP:
function onTarget(cid, target)
if isMonster(target) then
	registerCreatureEvent(cid, "Event")
	return false
end
return true
end
 
LUA:
function onTarget(cid,target)
	if isPlayer(target) then
		return false
	end
	return true
end

and in your monster file add this line

Code:
<script>
        <event name="[B][U]eventname[/U][/B]"/> 
</script>
 
Without registerCreatureEvent(cid, 'eventname')?
Are you sure that this function work if cid is monster? I read somewhere, that this function doesn't work if cid isn't player.
 
Back
Top