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

Błąd z ciałami, proszę o pomoc

Brylant

Member
Joined
Feb 3, 2012
Messages
116
Reaction score
6
Cześć, mam problem:

Po śmierci gracza ciało po prostu znika, jest tak zarówno w przypadku śmierci od potworów jak i od śmierci graczy

Błędy:
[5/10/2012 19:53:43] mysql_real_query(): INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (614, 1349459623, 5, '', ''); - MYSQL ERROR: Unknown column 'time' in 'field list' (1054)
[5/10/2012 19:53:43] mysql_real_query(): DELETE FROM `player_deaths` WHERE `player_id` = 614 ORDER BY `time` LIMIT 5; - MYSQL ERROR: Unknown column 'time' in 'order clause' (1054)

Wcześniej nie miałem żadnych błędów, ale starałem się zmienić playerdeath.lua, a teraz mam te błędy, mógłby ktoś poradzić co zrobić?
 
Dodaj kolumnę time do player_deaths.
 
Byłbym wdzięczny sn4ake, gdybyś wytłumaczył jak stworzyć taką kolumnę

PS: Senimari - stare lua to brak błędów i ciała, więc nie widzę powodu, dla którego miałbym to robić
 
phpmyadmin ma kreator do tworzenia tabel, edytowania ich bez używania komend - więc to nie będzie dla ciebie trudne.
Ważne żeby typ był liczbą.
 
A możesz mi podać krok po kroku jak to zrobić. Bo szukam i nie wiem jak to dodać.
 
Dobra dzięki. Dodałem wszystko lecz nadal jest problem. Teraz wyświetla się błąd w konsoli taki :

Code:
[7/10/2012 19:34:4] [Error - CreatureScript Interface] 
[7/10/2012 19:34:4] data/creaturescripts/scripts/playerdeath.lua:onDeath
[7/10/2012 19:34:4] Description: 
[7/10/2012 19:34:4] (luaGetCreatureName) Creature not found


To jest kod playerdeath.lua

Code:
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
return true
end
 
Last edited:
Wie ktoś może co to za błąd z tymi ciałami ?? Do bazy wszystko dodałem.
 
Back
Top