• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

OnDeath script

Omg yes

New Member
Joined
Apr 25, 2011
Messages
44
Reaction score
0
Can someone make me script that if someone dies he will not lose anything?

Rep++
 
login.lua replace
Code:
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end
with
Code:
	for i = 0, 4 do
		doPlayerSetLossPercent(cid, i, 0)
	end
 
Code:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/login.lua:onLogin
Description:
data/creaturescripts/scripts/login.lua:10: attempt to perform arithmetic on global 'loss' (a nil value)
stack traceback:
        data/creaturescripts/scripts/login.lua:10: in function <data/creaturescripts/scripts/login.lua:6>
login.lua
LUA:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	for i = 0, 4 do
		doPlayerSetLossPercent(cid, i, 0)

		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 2)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local mapMark = {x=1010, y=1015, z=6}
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			setPlayerStorageValue(cid,10010,0)
			doPlayerSendCancel(cid,"Your Killstreaks Have Been Reset")
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
			if getPlayerLevel(cid) < 80 then
				doPlayerAddExp(cid,4000000)
			end
		else
			doPlayerPopupFYI(cid,"Welcome to AOD War OT")
			doPlayerPopupFYI(cid,"After you choose your outfit and set your hotkeys..")
			doPlayerPopupFYI(cid,"Create Your Guild, Get Rady, Go For The Strike!")
			doPlayerAddMapMark(cid,mapMark,2,"TELEPORTER")
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
			if getPlayerLevel(cid) < 80 then
				doPlayerAddExp(cid,4000000)
			end
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	
	registerCreatureEvent(cid, "Advance")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	registerCreatureEvent(cid, "zombieevent")
	registerCreatureEvent(cid, "VipCheck")
	registerCreatureEvent(cid, "TempleTeleporter")
	registerCreatureEvent(cid, "extraExp")
	registerCreatureEvent(cid, "forever amulet")
	registerCreatureEvent(cid, "skull amulet")
	registerCreatureEvent(cid, "charge amulet")
       registerCreatureEvent(cid,'SpellUp')
	registerCreatureEvent(cid, "ondeath")
	registerCreatureEvent(cid, "onPrepareDeath")

	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	return true
end

EDIT: Found it
LUA:
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
had to remove it
 
Last edited:
Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
 
function onLogin(cid)
	for i = 0, 4 do
		doPlayerSetLossPercent(cid, i, 0)
	end
		doPlayerAddBlessing(cid, 1)
		doPlayerAddBlessing(cid, 2)
		doPlayerAddBlessing(cid, 3)
		doPlayerAddBlessing(cid, 4)
		doPlayerAddBlessing(cid, 5)
		doPlayerAddPremiumDays(cid, 2)
 
	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local mapMark = {x=1010, y=1015, z=6}
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			setPlayerStorageValue(cid,10010,0)
			doPlayerSendCancel(cid,"Your Killstreaks Have Been Reset")
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
			if getPlayerLevel(cid) < 80 then
				doPlayerAddExp(cid,4000000)
			end
		else
			doPlayerPopupFYI(cid,"Welcome to AOD War OT")
			doPlayerPopupFYI(cid,"After you choose your outfit and set your hotkeys..")
			doPlayerPopupFYI(cid,"Create Your Guild, Get Rady, Go For The Strike!")
			doPlayerAddMapMark(cid,mapMark,2,"TELEPORTER")
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
			if getPlayerLevel(cid) < 80 then
				doPlayerAddExp(cid,4000000)
			end
		end
 
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end
 
	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end
 
	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
 
	registerCreatureEvent(cid, "Advance")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	registerCreatureEvent(cid, "zombieevent")
	registerCreatureEvent(cid, "VipCheck")
	registerCreatureEvent(cid, "TempleTeleporter")
	registerCreatureEvent(cid, "extraExp")
	registerCreatureEvent(cid, "forever amulet")
	registerCreatureEvent(cid, "skull amulet")
	registerCreatureEvent(cid, "charge amulet")
       registerCreatureEvent(cid,'SpellUp')
	registerCreatureEvent(cid, "ondeath")
	registerCreatureEvent(cid, "onPrepareDeath")
 
	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	return true
end
 
Code:
local loginMessage = getConfigValue('loginMessage')

function onLogin(cid)
	for i = 0, 4 do
		doPlayerSetLossPercent(cid, i, 0)
		[B][COLOR="red"]doPlayerAddBlessing(cid, i + 1)[/COLOR][/B]
	end
	doPlayerAddPremiumDays(cid, 2)

	local accountManager = getPlayerAccountManager(cid)
	if accountManager == MANAGER_NONE then
		local lastLogin, str = getPlayerLastLoginSaved(cid), loginMessage
		if lastLogin ~= 0 then
			setPlayerStorageValue(cid, 10010, 0)
			doPlayerSendCancel(cid, 'Your Killstreaks Have Been Reset')
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = 'Your last visit was on ' .. os.date('%a %b %d %X %Y', lastLogin) .. '.'
		else
			doPlayerPopupFYI(cid, 'Welcome to AOD War OT')
			doPlayerPopupFYI(cid, 'After you choose your outfit and set your hotkeys..')
			doPlayerPopupFYI(cid, 'Create Your Guild, Get Rady, Go For The Strike!')
			doPlayerAddMapMark(cid, {x=1010, y=1015, z=6}, 2, 'TELEPORTER')
			str = str .. ' Please choose your outfit.'
			doPlayerSendOutfitWindow(cid)
		end
		if getPlayerLevel(cid) < 80 then
			doPlayerAddExp(cid, 4000000)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif accountManager == MANAGER_NAMELOCK then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Hello, it appears that your character has been namelocked, what would you like as your new name?')
	elseif accountManager == MANAGER_ACCOUNT then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Hello, type \'account\' to manage your account and if you want to start over then type \'cancel\'.')
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Hello, type \'account\' to create an account or type \'recover\' to recover an account.')
	end

	if not isPlayerGhost(cid) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, 'Mail')
	registerCreatureEvent(cid, 'GuildMotd')

	registerCreatureEvent(cid, 'Advance')
	registerCreatureEvent(cid, 'ReportBug')
	registerCreatureEvent(cid, 'AdvanceSave')
	registerCreatureEvent(cid, 'ReportBug')
	registerCreatureEvent(cid, 'AdvanceSave')
	registerCreatureEvent(cid, 'zombieevent')
	registerCreatureEvent(cid, 'VipCheck')
	registerCreatureEvent(cid, 'TempleTeleporter')
	registerCreatureEvent(cid, 'extraExp')
	registerCreatureEvent(cid, 'forever amulet')
	registerCreatureEvent(cid, 'skull amulet')
	registerCreatureEvent(cid, 'charge amulet')
	registerCreatureEvent(cid, 'SpellUp')
	registerCreatureEvent(cid, 'ondeath')
	registerCreatureEvent(cid, 'onPrepareDeath')

	registerCreatureEvent(cid, 'Idle')
	registerCreatureEvent(cid, 'SkullCheck')
	return true
end
 

Similar threads

Back
Top