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

Need Help OnKill noob char, teleport him and no frag.

Crew

New Member
Joined
Sep 12, 2008
Messages
51
Reaction score
0
Location
Chile , Maipu
Can someone make an script that when a player below level 50, when he dies, teleport to temple without losing

Please help
Rep++
 
i'll do it, editing when done.

-----Edited 1-------
script done:
Code:
local pos = {x=???, y=???, z=?}

function onPrepareDeath(cid, deathList)
  if isPlayer(cid) and getPlayerLevel(cid) <= 50 then
	for i = 0, 4 do
        doPlayerSetLossPercent(cid, i, 0)
    	doCreatureSetDropLoot(cid, false)
	doTeleportThing(cid,pos)
	doSendMagicEffect(pos,10)
  end
  return TRUE
end

i'll test if its working then i'll edit again

-----Edited1 not working, i got this one from Cykotitan----
add this line to creaturescripts.xml:
Code:
	<event type="preparedeath" name="NoLoss" event="script" value="noloss.lua"/>

create now a new .lua file called noloss.lua
Code:
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 6081 or 6080, 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

and add this line to login.lua

Code:
	registerCreatureEvent(cid, "NoLoss")
anyway if this helped you rep++ :)
 
Last edited:
[14:51:06.892] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/nol
oss.lua:12: 'end' expected (to close 'function' at line 3) near '<eof>'
[14:51:06.907] [Warning - Event::loadScript] Cannot load script (data/creaturesc
ripts/scripts/noloss.lua)
[14:51:06.907] data/creaturescripts/scripts/noloss.lua:12: 'end' expected (to cl
ose 'function' at line 3) near '<eof>'

this script
local pos = {x=???, y=???, z=?}

function onPrepareDeath(cid, deathList)
if isPlayer(cid) and getPlayerLevel(cid) <= 50 then
for i = 0, 4 do
doPlayerSetLossPercent(cid, i, 0)
doCreatureSetDropLoot(cid, false)
doTeleportThing(cid,pos)
doSendMagicEffect(pos,10)
end
return TRUE
end

help please
 
Last edited:
Because he had a skull! Remove:
Code:
	if getPlayerLevel(cid) < 50 [B][COLOR="red"]and getCreatureSkullType(cid) < SKULL_WHITE[/COLOR][/B] then
or change it to:
Code:
	if getPlayerLevel(cid) < 50 and getCreatureSkullType(cid) <[B][COLOR="red"]=[/COLOR][/B] SKULL_WHITE then
 
Back
Top