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

[Tutorial] How to fix playerdeath

pierroth

Mar Co.
Joined
Sep 11, 2008
Messages
343
Reaction score
10
Location
Mexico - California
Heya, another tutorial. I saw this from another post, I just cant find it again, don't remember who it was.

I've seen so many players struggling with Gesiors ACC showing a number instead of the player name when someone gets a frag.

So here it goes.

Go to creaturescripts/scripts/playerdeath.lua

Erase what u have there and copy paste this one.

Code:
local config = {
	deathListEnabled = getConfigInfo('deathListEnabled'),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords')
}

function onDeath(cid, corpse, killer)
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
	if(config.deathListEnabled == "yes") then
		if(killer ~= FALSE) then
			if(isPlayer(killer) == TRUE) then
				killerName = getPlayerGUID(killer)
			else
				killerName = getCreatureName(killer)
			end
		else
			killerName = "field item"
		end

		db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(killerName) .. ");")
		local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
		if(rows:getID() ~= -1) then
			local deathRecords = rows:numRows(true)
			if(config.sqlType == "sqlite") then
				while(deathRecords > config.maxDeathRecords) do
					db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
					deathRecords = deathRecords - 1
				end
			else
				while(deathRecords > config.maxDeathRecords) do
					db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;")
					deathRecords = deathRecords - 1
				end
			end
		end
	end
end

Now it should be fix :)

Creadits to
Code:
ME - pierroth
 
You should most likely edit the gesiors file instead.
 
Agree. Tfs did it correct, Gesior fucked up:p(Cruel way to say it, not ment to be instulting.)

He made it way before TFS changed to use killerid instead of name, so, complaints to TFS team, not Gesior, or wait for him to update.
 
Men THNKS A LOT, y the dead system was bugging me, thnks to this now it's all ok love you.
 
well... i have to say... the script it's not working againg.. i dont know why...
 
Back
Top