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

Get killed monster name

desalib

New Member
Joined
Jul 4, 2010
Messages
30
Reaction score
0
As in title I need to know the name of the monster I just killed. I tried using :

Code:
function onKill(cid, target) 

    if(isPlayer(target) ~= TRUE) then

	local monstername = getCreatureName(target):lower()
                       print(monstername)
    end
    return true -- that was the missing part XD omg I'm so stupid
end

When I kill monster using this it print the correct name but the monster never die (it stay there only name and lifebar disapear) and the function print is called non-stop again and again.



----------------
Nerver mind.

If you are stupid like me and got this problem don't forget to add the "return true" XD

[Solved]
 
Last edited:
you should put return false and return true like this

Lua:
function onKill(cid, target) 

    if(isPlayer(target) ~= TRUE) then

	local monstername = getCreatureName(target):lower()
                       print(monstername)
          return false
	end
return true
end
 
I wrote one script like this few months before, I kept it as example to make other onKill scripts faster in the future.
I hope it will fix all your problems
Lua:
function onKill(cid, target, damage, flags)
	local killstorage = "25909"
	local name = getCreatureName(target):lower()
	
	if isPlayer(target) then return true end
	if name == 'testboss' then
		doCreatureSay(cid, 'You have defeated the ' .. name .. '. You may continue exploring now.', TALKTYPE_ORANGE_1)
		if(getCreatureStorage(cid, killstorage) < 1) then
		doCreatureSetStorage(cid, killstorage, 1)
		end
	end
	return true
end
 
Back
Top