Ir para conteúdo

Playerdeath


guixap

Posts Recomendados

Playerdeath



Player morre, não dropa nada e não fica corpse no chão

 

Bom estou com um erro no servidor grave. Os players morrem e não perdem a backpack

e não fica Corpse no chão. Bom vejam meu playerdeath.

 

 

 

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

 

 

Obs.: Eu já resetei database do server, meu servidor é 8.6 a TFS do mix yourots 1.0.0 database MySql.

Link para o comentário
Compartilhar em outros sites

Playerdeath



Player morre, não dropa nada e não fica corpse no chão

 

Bom estou com um erro no servidor grave. Os players morrem e não perdem a backpack

e não fica Corpse no chão. Bom vejam meu playerdeath.

 

 

 

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

 

 

Obs.: Eu já resetei database do server, meu servidor é 8.6 a TFS do mix yourots 1.0.0 database MySql.

 

Você colocou alguma coisa influente a morte por exemplo.

-War System

-Bounty system

 

????

 

 

ou se não aconteçeu nada tenta apagatudo do seu e bota isso dentro do seu playerdeath.lua

 

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 conseguiu, se quizer REP+

Se não conseguiu poste aqui.

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...