• 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 items when killing a player. rep+++

Status
Not open for further replies.

Dramix

New Member
Joined
Jun 26, 2009
Messages
289
Reaction score
1
Hello, i want a reward when i killing a player i get reward but i got this bug: data/creaturescript/scripts/reward.lua:ondeath
data/creaturescript/scripts/reward.lua:14: attempt to call global 'setitemname' <a nil value>
stack traceback:
[c]: in fuction 'setitemName'
data/creaturescript/script/reward.lua:14: in fuction <data/creaturescript/script/reward.lua:1> and my script:
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
local cidpos = getPlayerPosition(lastHitKiller)
loot = 2470 --Platinum coin
item = doPlayerAddItem(lastHitKiller,loot,1)
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getPlayerName(lastHitKiller)
doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")
doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")
doSendMagicEffect(cidpos,12)
else
hitKillerName = getCreatureName(lastHitKiller)
doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by a "..hitKillerName..".")
end
setItemName(item, ""..getPlayerName(cid).."\'s Heart")
return TRUE
end
Thx if you can help me.
 
try this :)

Code:
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)

	local cidpos = getPlayerPosition(lastHitKiller)

	loot = 2470 --Platinum coin

	item = doPlayerAddItem(lastHitKiller,loot,1)

	if(isPlayer(lastHitKiller) == TRUE) then

		hitKillerName = getPlayerName(lastHitKiller)

		doSetItemSpecialDescription(item.uid,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")

		doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")

		doSendMagicEffect(cidpos,12)

	else

		hitKillerName = getCreatureName(lastHitKiller)

		doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by a "..hitKillerName..".")

	end

	setItemName(item.uid, ""..getPlayerName(cid).."\'s Heart")

	return TRUE

end
 
try this :)

Code:
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)

	local cidpos = getPlayerPosition(lastHitKiller)

	loot = 2470 --Platinum coin

	item = doPlayerAddItem(lastHitKiller,loot,1)

	if(isPlayer(lastHitKiller) == TRUE) then

		hitKillerName = getPlayerName(lastHitKiller)

		doSetItemSpecialDescription(item.uid,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by "..hitKillerName..".")

		doPlayerSendTextMessage(lastHitKiller, MESSAGE_STATUS_CONSOLE_ORANGE, "You Killed " .. getCreatureName(cid) .. ".")

		doSendMagicEffect(cidpos,12)

	else

		hitKillerName = getCreatureName(lastHitKiller)

		doSetItemSpecialDescription(item,"This is the heart of "..getPlayerName(cid).." killed at Level "..getPlayerLevel(cid).." by a "..hitKillerName..".")

	end

	setItemName(item.uid, ""..getPlayerName(cid).."\'s Heart")

	return TRUE

end

this one doesnt work
 
Status
Not open for further replies.
Back
Top