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

Frag reward bug

MiPo91

Member
Joined
Mar 30, 2010
Messages
299
Reaction score
18
Location
Finland
Hello! I got error in console when players are killed by monsters, but its work fine when they are killed by other players.

Code:
[08/05/2010 11:14:11] [Error - CreatureScript Interface] 
[08/05/2010 11:14:11] data/creaturescripts/scripts/reward.lua:onDeath
[08/05/2010 11:14:11] Description: 
[08/05/2010 11:14:11] (internalGetPlayerInfo) Player not found when requesting player info #3


Code:
function onDeath(cid, corpse, deathList)
local corpse_ids = {
        [0] = 3065,
        [1] = 3058
}
        local v = { killer_name = getCreatureName(deathList[1]), killer_level = getPlayerLevel(deathList[1]), target_name = getCreatureName(cid), target_level = getPlayerLevel(cid) }
        local reward = doAddContainerItem(corpse.uid, 5943, 1)
        if isPlayer(cid) then
                for i = 1, #deathList do
                        if(isPlayer(deathList[i])) then
                                doItemSetAttribute(reward, "description", "" .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed at level " .. v.target_level .. " by " .. v.killer_name .. " who was level " .. v.killer_level .. " at the time. " .. (getCreatureSkullType(cid) <= SKULL_GREEN and "[Unjustified]" or "[Justified]"))
                                local corpse, killers = doCreateItem(corpse_ids[getPlayerSex(cid)], 1, getThingPos(cid)), ""
                                for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
                                        killers = killers .. (i == 1 and "" or ", ") .. (isMonster(deathList[i]) and "a " or "") .. getCreatureName(deathList[i])
                                end
                        end
                        doItemSetAttribute(reward, "name", v.target_name .."'s Heart")
                end
        end
        return true
end
 
Code:
function onDeath(cid, corpse, deathList)
	for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
		if isPlayer(deathList[i]) then
			local reward = doAddContainerItem(corpse.uid, 5943, 1)
			doItemSetAttribute(reward, 'description', (getPlayerSex(cid) == 0 and 'She' or 'He') .. ' was killed at level ' .. getPlayerLevel(cid) .. ' by ' .. getCreatureName(deathList[i]) .. ' who was level ' .. getPlayerLevel(deathList[i]) .. ' at the time. ' .. (getCreatureSkullType(cid) <= SKULL_GREEN and '[Unjustified]' or '[Justified]'))
			doItemSetAttribute(reward, 'name', getCreatureName(cid) ..'\'s Heart')
			break
		end
	end
	return true
end
 
Last edited:
When player got killed by monster the hearth was just normal morgaroths hearth.
Code:
21:35 You see the Morgaroth's heart.
It weighs 35.00 oz.
ItemID: [5943].
Position: [X: 31605] [Y: 32019] [Z: 8].
 
Thanks alot, its working now! Would give you rep++ but "You must spread some reputation around before giving it to Cykotitan again".
 
Back
Top