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

player death problem

Calon

Experienced Member
Joined
Feb 6, 2009
Messages
1,070
Reaction score
21
When someone Die my cons~ have this following

PHP:
23/07/2010 21:05:46] mysql_real_query(): INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (656, 1279915546, 261, '', ''); - MYSQL ERROR: Unknown column 'time' in 'field list' (1054)

[23/07/2010 21:06:24] [Error - CreatureScript Interface] 
[23/07/2010 21:06:24] data/creaturescripts/scripts/playerdeath.lua:onDeath
[23/07/2010 21:06:24] Description: 
[23/07/2010 21:06:24] (luaGetCreatureName) Creature not found

[23/07/2010 21:06:24] [Error - CreatureScript Interface] 
[23/07/2010 21:06:24] data/creaturescripts/scripts/playerdeath.lua:onDeath
[23/07/2010 21:06:24] Description: 
[23/07/2010 21:06:24] (luaGetCreatureName) Creature not found
Playerdeath.lua
PHP:
local config = {
	deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords')
}

config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if(config.deathListEnabled ~= TRUE) then
		return
	end

	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:getRows(true) - config.maxDeathRecords
		if(amount > 0) then
			if(config.sqlType == DATABASE_ENGINE_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
 
Last edited:
So... What error are you getting then?...

Code:
MYSQL ERROR: Unknown column 'time' in 'field list' (1054)
or
Code:
#1060 - Duplicate column name 'time'
 
when i try to add that sql in my other thread that guy posted i find this error cz think i already added it and the same problem

#1060 - Duplicate column name 'time'
 
Have you checked the table to make sure the column "time" is there?

Because if it is then there should be no error appearing in your server window. You sure you're checking the right database?
 
Back
Top