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

A way to protect lower levels

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
I have this script. The problem is: Who kill level 49- do not get frag.
Script description: If level 49- die WITHOUT skull, will lose nothing.

LUA:
function getNameDescription(creature)
	local v = getCreatureName(creature)
	return isMonster(creature) and getMonsterInfo(v).description or v
end
 
function onPrepareDeath(cid, deathList)
	if getPlayerLevel(cid) < 50 and getCreatureSkullType(cid) < SKULL_WHITE then
		local corpse, ss = doCreateItem(getPlayerSex(cid) == 0 and 3065 or 3058, 1, getThingPos(cid)), ''
		ss = "You recognize " .. getCreatureName(cid) ..  ". " .. (getPlayerSex(cid) % 2 ~= 0 and "He" or "She") .. " was killed by "
		if isCreature(deathList[1]) then
			ss = ss .. getNameDescription(deathList[1])
			local master = getCreatureMaster(deathList[1])
			if master and master ~= deathList[1] then
				ss = ss .. " summoned by " .. getNameDescription(master)
			end
		else
			ss = ss .. deathList[1]
		end
 
		if #deathList > 1 then
			if type(deathList[1]) ~= type(deathList[2]) then
				if isCreature(deathList[2]) then
					ss = ss .. " and by " .. getNameDescription(deathList[2])
					local master = getCreatureMaster(deathList[2])
					if master and master ~= deathList[2] then
						ss = ss .. " summoned by " .. getNameDescription(master)
					end
				else
					ss = ss .. " and by " .. deathList[2]
				end
			elseif isCreature(deathList[2]) then
				if getNameDescription(deathList[1]) ~= getNameDescription(deathList[2]) then
					ss = ss .. " and by " .. getNameDescription(deathList[2])
					local master = getCreatureMaster(deathList[2])
					if master and master ~= deathList[2] then
						ss = ss .. " summoned by " .. getNameDescription(master)
					end
				end
			elseif deathList[1]:lower() ~= deathList[2]:lower() then
				ss = ss .. " and by " .. deathList[2]
			end
		end
		doItemSetAttribute(corpse, 'description', ss)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid))
		doRemoveConditions(cid, false)
		return false
	end
	return true
end
Script made by Cykotitan.
 
Last edited:
LUA:
function onLogin(cid)

	if getPlayerLossPercent(cid, 3) ~= 100 or getPlayerLossPercent(cid, 4) ~= 100 then
		doPlayerSetLossPercent(cid, 3, 100)
		doPlayerSetLossPercent(cid, 4, 100)
	end
	
	registerCreatureEvent(cid, "log")
	return true
end


function onStatsChange(cid, attacker, type, combat, value)
	if getPlayerLevel(cid) < 50 and getCreatureSkullType(cid) < SKULL_WHITE then
        if combat == COMBAT_HEALING then
                return true
        end

        if getCreatureHealth(cid) < value then
			doCreatureSetDropLoot(cid, false)    
			doPlayerSetLossPercent(cid, 3, 0)
			doPlayerSetLossPercent(cid, 4, 0)			
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
			doCreatureSay(cid, "I don't drop loot!", TALKTYPE_ORANGE_1)
		end
	
	end
	
	return true
end
 
Follow this dont play in names :
go to creatureevent --> make a new lua file no_loss.lua , paste this inside
LUA:
function onLogin(cid)
 
	if getPlayerLossPercent(cid, 3) ~= 100 or getPlayerLossPercent(cid, 4) ~= 100 then
		doPlayerSetLossPercent(cid, 3, 100)
		doPlayerSetLossPercent(cid, 4, 100)
	end
 
	registerCreatureEvent(cid, "noloss_stats")
	return true
end
 
 
function onStatsChange(cid, attacker, type, combat, value)
	if getPlayerLevel(cid) < 50 and getCreatureSkullType(cid) < SKULL_WHITE then
        if combat == COMBAT_HEALING then
                return true
        end
 
        if getCreatureHealth(cid) < value then
			doCreatureSetDropLoot(cid, false)    
			doPlayerSetLossPercent(cid, 3, 0)
			doPlayerSetLossPercent(cid, 4, 0)			
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
			doCreatureSay(cid, "I don't drop loot!", TALKTYPE_ORANGE_1)
		end
 
	end
 
	return true
end

Now go to creatureevent.xml paste thos 2 lines :
Code:
<event type="login" name="noloss_login" event="script" value="no_loss.lua"/>
<event type="statschange" name="noloss_stats" event="script" value="no_loss.lua"/>

restart server.
 
Back
Top