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

Solved Death problem

XouruS

Active Member
Joined
Dec 29, 2009
Messages
941
Reaction score
36
Location
Canada
Hello, i have a problem with my creaturescripts.
When a player dies, it takes him to the temple.
When he logs in, it dosent restore his mana/hp
and it stays at 0. Result (He dies again, & again etc.)

Pic:


I really need to fix this problem

I Repp++

Thanks in advance.
 
Last edited:
only got login.lua

Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
local items = {
    [0] = { 8819, 8820, 2468, 2509, 2643, 2190, 7620, 2175, 7731, 5710, 2160, 2173 },
    [1] = { 8819, 8820, 2468, 2509, 2643, 2190, 7620, 2175, 7731, 5710, 2160, 2173 },
    [2] = { 8819, 8820, 2468, 2509, 2643, 2182, 7620, 2175, 7731, 5710, 2160, 2173 },
    [3] = { 2509, 2643, 8923, 8891, 2481, 2389, 7620, 2175, 7731, 5710, 2160, 2173 },
    [4] = { 2643, 2478, 2465, 2481, 2509, 2383, 7620, 2175, 7731, 5710, 2160, 2173 }
}
function onLogin(cid)

local target = cid
if getPlayerStorageValue(cid, 999999) > 0 then
doAddSpecialExhaust(target,getPlayerStorageValue(cid, 999999))
end

if getPlayerStorageValue(cid, 1987) > 0 then
setPlayerStorageValue(cid, 1987, 0)
end
if getPlayerStorageValue(cid, 20015) > 0 then
if getPlayerStorageValue(cid, 20015) < 11 then
setPlayerStorageValue(cid, 20015, 0)
end
end

if getPlayerStorageValue(cid, 50781) == 1 then
setPlayerStorageValue(cid, 50781, 0)
end

local temple = {x=501, y=807, z=7}


if getPlayerStorageValue(cid, 6612) == 1 then
setPlayerStorageValue(cid, 6612, 0)
doPlayerPopupFYI(cid, "You have recently died, but since you are below level 200 you did not lose anything.\n At 201+ you will lose levels/items and PVP will be ON.")
end


if getPlayerStorageValue(cid, 2000) > 0 then
setPlayerStorageValue(cid, 2000, 0)
end

	if getPlayerStorageValue(cid, 12346) <=0 then
		doTeleportThing(cid,temple, FALSE)
		setPlayerStorageValue(cid, 12346, 1)
end

    if getPlayerStorageValue(cid, 30001) == -1 then
        for voc, item in pairs(items) do
            if getPlayerVocation(cid) == voc then
                local container = doPlayerAddItem(cid, 2000, 1)
                for i = 1, table.maxn(item) do
                    doAddContainerItem(container, item[i], 1)
                end
                setPlayerStorageValue(cid, 30001, 1)
            end
        end
    end
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		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, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "advance")
	registerCreatureEvent(cid, "PrepareDeath")
--(hunting graphics)	registerCreatureEvent(cid, "kill")
--Reflect Spells
registerCreatureEvent(cid, "ReflectSpellKnight")
registerCreatureEvent(cid, "ReflectSpellPally")
registerCreatureEvent(cid, "ReflectSpellMage")
--Vocation Items
registerCreatureEvent(cid, "KnightShieldBlock")
	registerCreatureEvent(cid, "teamchannels")
    doCreatureSay(cid, "Welcome!", 20)
	return true
end
 
I dont know if theres anything wrong with that because I'm not a scripter but try using this
Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
accountManager = "Account Manager"                       
managerCounter = 0

   for i, player in ipairs(getOnlinePlayers()) do
      if accountManager:lower() == player:lower() then             
      managerCounter = managerCounter + 1
      end 
   end
 
   if managerCounter >= 3 then
      return false
   end
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		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, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end

registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "attackguild")	
registerCreatureEvent(cid, "advance")
registerCreatureEvent(cid, "FimVip")
registerCreatureEvent(cid, "SkullCheck")
registerCreatureEvent(cid, "demonOakLogout")
registerCreatureEvent(cid, "demonOakDeath")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, VipReceive)
registerCreatureEvent(cid, "PlayerKill")
registerCreatureEvent(cid, "reward")
registerCreatureEvent(cid, "KillingInTheNameOf")
registerCreatureEvent(cid, "PythiusDead")
registerCreatureEvent(cid, "VipCheck")
registerCreatureEvent(cid, "TempleTeleporter")
registerCreatureEvent(cid, "MonsterPortal")

    if (InitArenaScript ~= 0) then
    InitArenaScript = 1

        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end

    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end

    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end

    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0)
    end
    setPlayerStorageValue(cid, 42350, 0)
    setPlayerStorageValue(cid, 42352, 0)
return true
end
login.lua
 
I've found a problem. It happens, when the player has lower max health than required max health for his level.
For example: level 999, max health 50.
 
Back
Top