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

Windows Gesior Deaths are not recorded [-Reputation-]

Water Fighter

New Member
Joined
Mar 11, 2008
Messages
47
Reaction score
0
Why are in Gesior acc deathlists not recordet andymoer?
i use tfs 0,3,1 cry~

Please help

i Will add Reputation who help me out

Thanks
 
Last edited:
I Use This Scrip
t
Playerdeath.lua

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

Error:

Code:
[17/02/2009 05:32:16] Lua Script Error: [CreatureScript Interface] 
[17/02/2009 05:32:16] data/creaturescripts/scripts/playerdeath.lua

[17/02/2009 05:32:16] data/creaturescripts/scripts/playerdeath.lua:2: attempt to call global 'getConfigInfo' (a nil value)
[17/02/2009 05:32:16] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/playerdeath.lua
 
Also you are using outdated onDeath...

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

function onDeath (cid, corpse, lastHitKiller, mostDamageKiller)
	if(config.deathListEnabled == TRUE) then
		local hitKillerName = "field item"
		local damageKillerName = ""
		if(lastHitKiller ~= FALSE) then
			if(isPlayer(lastHitKiller) == TRUE) then
				hitKillerName = getPlayerGUID(lastHitKiller)
			else
				hitKillerName = getCreatureName(lastHitKiller)
			end

			if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
				if(isPlayer(mostDamageKiller) == TRUE) then
					damageKillerName = getPlayerGUID(mostDamageKiller)
				else
					damageKillerName = getCreatureName(mostDamageKiller)
				end
			end
		end

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