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

PrepareDeath Error

Shalk

Royal Angels ATS
Joined
Sep 19, 2007
Messages
214
Reaction score
4
Location
Brazil
Code:
function onPrepareDeath (cid, deathList)
	lastHitKiller = deathList[1]
	mostDamageKiller = deathList[2]

	if cid ~= target and isPlayer(cid) then



		if getPlayerIp(mostDamageKiller) == getPlayerIp(cid) then
			doPlayerSendTextMessage(mostDamageKiller, MESSAGE_STATUS_CONSOLE_BLUE, 'You dont receive scores by killing the same ip.')

 					for _, tid in ipairs(getPlayersOnline()) do
					doPlayerSendChannelMessage(tid, "", "".. getCreatureName(cid) .." (".. getPlayerKillAll(cid) .."/".. getPlayerDeathAll(cid) ..") was killed by ".. getCreatureName(mostDamageKiller).." (".. getPlayerKillAll(mostDamageKiller) .."/".. getPlayerDeathAll(mostDamageKiller) ..").", TALKTYPE_CHANNEL_Y, 99)

end

		else
			if(lastHit == true) then

           		doPlayerSendTextMessage(mostDamageKiller, MESSAGE_STATUS_CONSOLE_BLUE,"You have killed " .. getCreatureName(cid) .. ".")
			end
		end

end
	return true
end


console error
Code:
[17:25:53.037] Sercc has logged in.

[17:26:14.118] [Error - CreatureScript Interface]
[17:26:14.119] data/creaturescripts/scripts/death.lua:onPrepareDeath
[17:26:14.121] Description:
[17:26:14.121] (internalGetPlayerInfo) Player not found when requesting player i
nfo #29
[17:26:14.138] Sercc has logged out.


can someone try to help me solve my problem? I'm getting bald already aahuahuauh
 
As Cykotitan said. Make sure lasthit and mostdamage killers are players. Fetching death list from a monster creature is a boo boo. :p
 
They already told you how to fix it
Lua:
function onPrepareDeath (cid, deathList)
	lastHitKiller = deathList[1]
	mostDamageKiller = deathList[2]

	if cid ~= target and isPlayer(cid) and isPlayer(mostDamageKiller) then
		if getPlayerIp(mostDamageKiller) == getPlayerIp(cid) then
			doPlayerSendTextMessage(mostDamageKiller, MESSAGE_STATUS_CONSOLE_BLUE, 'You dont receive scores by killing the same ip.')
			for _, tid in ipairs(getPlayersOnline()) do
			doPlayerSendChannelMessage(tid, "", "".. getCreatureName(cid) .." (".. getPlayerKillAll(cid) .."/".. getPlayerDeathAll(cid) ..") was killed by ".. getCreatureName(mostDamageKiller).." (".. getPlayerKillAll(mostDamageKiller) .."/".. getPlayerDeathAll(mostDamageKiller) ..").", TALKTYPE_CHANNEL_Y, 99)
			end
		else
			if(lastHit == true) then
           		doPlayerSendTextMessage(mostDamageKiller, MESSAGE_STATUS_CONSOLE_BLUE,"You have killed " .. getCreatureName(cid) .. ".")
			end
		end
	end
	return true
end
 
Back
Top