Ir para conteúdo

[Urgente] Erro Quando Player Morre !


TheGODMaX

Posts Recomendados

Versão do OT: 8.54

 

Quando um player morre, o corpo dele n aparece, e ele n perde loot, e por causa deste erro, os players n conseguem comprar bless e nem usar o comando /deathlist...

 

quando algum player morre da o seguinte erro no executavel do ot:

[Error - CreatureScript Interface]

data/creaturescripts/scripts/playerdeath.lua:-OnDeath

Description:

(luaGetCreatureName) Creature not found

OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: table player_deaths has no column named time (INSERT INTO "player_deaths" ("player_id", "time", "level", "killed_by", "altkilled_by") VALUES (117, 1269999259, 93, '', '');)

a parte:

VALUES (117, 1269999259, 93, '', '');)

varia de morte para morte...

 

eu tentei fazer o seguinte... como eu li ali: 'SQLITE ERROR: table player_deaths has no column named time'

eu fui ver o SQLITE do meu server, e vi que na coluna 'player_deaths' faltava o 'time'... estava assim:

CREATE TABLE "player_deaths" (

"id" INTEGER PRIMARY KEY,

"player_id" INTEGER NOT NULL,

"date" INTEGER NOT NULL,

"level" INTEGER NOT NULL,

FOREIGN KEY ("player_id") REFERENCES "players" ("id")

);

Aí eu peguei e deichei assim:

CREATE TABLE "player_deaths" (

"id" INTEGER PRIMARY KEY,

"player_id" INTEGER NOT NULL.

"time" BIGINT UNSIGNED NOT NULL DEFAULT 0,

"level" INT NOT NULL DEFAULT 1,

"killed_by" INTEGER NOT NULL,

"altkilled_by" INTEGER NOT NULL,

"date" INTEGER NOT NULL,

FOREIGN KEY ("player_id") REFERENCES "players" ("id")

);

Igual á de um OT 8.4 que eu tinha, mas continua com o mesmo problema... :/

 

Aqui o script playerdeath da pasta creaturescripts:

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

Se alguem puder me ajuda, plx... to passando sufoco com esse erro, e n queria 'resetar' o ot :/

 

Cya.

Editado por TheGODMaX
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...