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

CreatureEvent Players quitting because of early death

kokokoko

Veteran OT User
Joined
Feb 4, 2008
Messages
921
Reaction score
257
!NOT TESTED!

Note: This only works on servers that has doPlayerSetLossPercent(). The latest TFS(and some older versions of it) has it.

I have seen this in alot of servers i have played. Someone logs in, plays some and thinks the OT is ok. A minute later they die, and go "#¤¤%(¤%( I QUITZ!". So, i got the idea to make players under level X lose no items, skills or level.



Make a new file in creaturescripts/scripts. Name it starterDeath.lua
Add this to it:
Code:
function onLogin(cid)

level = 10 --Level to start losing items and levels

if getPlayerLevel(cid) < level then
	for i = 0, 4 do
		doPlayerSetLossPercent(cid, i, 0)
			end
		end
  return TRUE
end

function onAdvance(cid, skill, oldlevel, newlevel)

	local configloss = getConfigValue('deathLostPercent')


	if newlevel == 10 then
			for i = 0, 4 do
		doPlayerSetLossPercent(cid, i, configloss*10)
			end
		 end
   return TRUE
end

In creaturescripts.xml, add this:
Code:
<event type="advance" name="starterDeath" script="starterDeath.lua"/>
<event type="login" name="starterDeath2" event="script" value="starterDeath.lua"/>


To-do list:
*Player can teleport to where he died once(Only if he is under level 10).

It should work :p
 
Lua:
local level = 10 --Level to start losing items and levels
local configloss = getConfigValue('deathLostPercent')

function onLogin(cid)
	if getPlayerLevel(cid) < level then
		for i = 0, 4 do
			doPlayerSetLossPercent(cid, i, 0)
		end
	end
	return TRUE
end

function onAdvance(cid, skill, oldlevel, newlevel)
	if newlevel == level then
		for i = 0, 4 do
			doPlayerSetLossPercent(cid, i, configloss*10)
		end
	end
	return TRUE
end

to playerdeath.lua, before return true:
Lua:
	local position = getPlayerPosition(cid)
	
	if getPlayerLevel(cid) < 10 then
		setPlayerStorageValue(cid, 1000, position.x)
		setPlayerStorageValue(cid, 1001, position.y)
		setPlayerStorageValue(cid, 1002, position.z)
	end
talkaction:
Lua:
function onSay(cid, words, param)
	if getPlayerLevel(cid) < 10 then
		if getPlayerStorageValue(cid, 1000) ~= 0 then
			doTeleportThing(cid, { x = getPlayerStorageValue(cid, 1000), y = getPlayerStorageValye(cid, 1001), z = getPlayerStorageValue(cid, 1002) })
			setPlayerStorageValue(cid, 1000, 0)
		end
	end
	
	return true
end
 
@Topic,
I don't like this idea that much :confused:
Although it might be good for "RPG Servers."
 
Oh.. Lol, he beats me bigtime XD

Still a nice idea though :p
 
Back
Top