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

Need some help. with onkill

Slaying World

Member
Joined
Apr 9, 2009
Messages
212
Reaction score
9
Location
Texas
Okay so i want a creaturescript so whenever i kill 1 Nazi Zombie i will get 1 Nazi Token. But with my script after i kill the nazi zombie he doesnt turn into a corpse. And i keep getting 1+ nazi tokens D:

Heres the script.
Code:
	local t = {
	['nazi zombie'] = {1337}
}
 
function onKill(cid, target, damage, flags)
	local k = t[string.lower(getCreatureName(target))]
	if(k and (damage == true or bit.band(flags, 1) == 1) and isMonster(target)) then
		doPlayerAddItem(cid,6527,1)
	doCreatureSay(cid, "+1 Nazi Token!", TALKTYPE_ORANGE_1)
		end
	end
	return true
 
Okay so i want a creaturescript so whenever i kill 1 Nazi Zombie i will get 1 Nazi Token. But with my script after i kill the nazi zombie he doesnt turn into a corpse. And i keep getting 1+ nazi tokens D:

Heres the script.
Code:
	local t = {
	['nazi zombie'] = {1337}
}
 
function onKill(cid, target, damage, flags)
	local k = t[string.lower(getCreatureName(target))]
	if(k and (damage == true or bit.band(flags, 1) == 1) and isMonster(target)) then
		doPlayerAddItem(cid,6527,1)
	doCreatureSay(cid, "+1 Nazi Token!", TALKTYPE_ORANGE_1)
		end
	end
	return true

Well, for the problem you are saying you are having the script probably is creating an infinite loop...
I can't clearly see why..
But, think the problem might be with the "return" part of the script...
Try it like this and let me know if it works: (didn't test, and I have no idea if it is going to work, I'm just guessing)

Lua:
	local t = {
	['nazi zombie'] = {1337}
}
 
function onKill(cid, target, damage, flags)
	local k = t[string.lower(getCreatureName(target))]
	if(k and (damage == true or bit.band(flags, 1) == 1) and isMonster(target)) then
		doPlayerAddItem(cid,6527,1)
	doCreatureSay(cid, "+1 Nazi Token!", TALKTYPE_ORANGE_1)
		end
            return TRUE
	end

Hope it helps...
 
Back
Top