Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

Servidor : the forgotten server tibia 0.3.6
Versión :  8.54
Server war: Enforce

Qual o motivo deste tópico? 

 

Eu tenho um servidor WAR no qual eu quero uma proteção contra morte para jogador abaixo do lvl 500. Eu tenho esses scripts de morte preparados em que se o jogador morrer por monstro ou por jogador (PVP forçar) ele te teleporta para o templo e te regenera full life e mana. mas não dá level ao jogador que o matou

 

Você tem o código disponível? Se tiver publique-o aqui: 

local config = {
	deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords'),
	deadProtection = getConfigInfo('deadProtection')
}
config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

function onPrepareDeath(cid, lastHitKiller, mostDamageKiller)
	if(isPlayer(cid))then
		if(math.abs(config.deadProtection) >= getPlayerLevel(cid))then
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid), TRUE)
			doCreatureAddMana(cid, (getCreatureMaxMana(cid) - getCreatureMana(cid)))
			doSendMagicEffect(getCreaturePosition(cid), 37)
			doRemoveCondition(cid, CONDITION_INFIGHT)
		else
			if(config.deathListEnabled ~= TRUE) then
				return TRUE
			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
	end
end

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

Editado por eduardobon (veja o histórico de edições)

Postado
Em 01/09/2022 em 16:58, eduardobon disse:

Eu tenho um servidor WAR no qual eu quero uma proteção contra morte para jogador abaixo do lvl 500. Eu tenho esses scripts de morte preparados em que se o jogador morrer por monstro ou por jogador (PVP forçar) ele te teleporta para o templo e te regenera full life e mana. mas não dá level ao jogador que o matou

 

 

tem um script meu por source que faz quase isso, ele é por posição, mas só vc trocar o "player->getPosition()" pra "int level = player->getLevel()"
e ai colocar if (level < 500){ return true }

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.3k

Informação Importante

Confirmação de Termo