FR

Morre E Cai O Caração

Por Fronick, 25 de jan. de 2010 em Archived

script
5
820
FronickF
25 de janeiro de 2010 às 16:50

Queria um script assim,Tipow,quandu a pessoa morrer,o loot dela aparecer automatiamente um morgaroth hearth,com o nome da pessoa morta,e o nome de quem matou... junto com ou loot,ou se a pessa tiver usandu aol, hearth tem que cair do msm jeito

 

Para ot 8.50 TFS 0.3.5

WiltryW
25 de janeiro de 2010 às 17:07

Tenta assim, em creaturescripts/playerdeath, embaixo de

if isPlayer(killer) == TRUE then
byPlayer = TRUE

Você coloca isso:

	pos = getCreaturePosition(cid)
nomoedomorto = getCreatureName(cid)
nomedoassassino = getCreatureName(killer)
heart = doCreateItem(HEARTID, 1, pos)
doDecayItem(heart)
doSetItemSpecialDescription(heart, "This is the heart of "..nomedomorto..", morto por "..nomedoassassino..")

FronickF
25 de janeiro de 2010 às 17:09

aki esta assim

 

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

Editado Janeiro 25 por Fronick

AblankA
25 de janeiro de 2010 às 19:18

Lembrando que o código acima só funciona se o servidor tiver suporte a LUA SQL, ou seja SVN não consta nesta lista!

 

Wilty gostei do código :D

WiltryW
25 de janeiro de 2010 às 19:59

Embaxo disso: if(isPlayer(lastHitKiller) == TRUE) then

hitKillerName = getPlayerGUID(lastHitKiller)

 

Ablank:

Obrigado ;P