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

Solved Solved

hangnail

New Member
Joined
Nov 28, 2011
Messages
54
Reaction score
0
when people die on my server they don't really die there health bar just disappears and i get a whole bunch of errors.

PHP:
[07/01/2012 22:21:59] [Error - CreatureScript Interface] 
[07/01/2012 22:21:59] data/creaturescripts/scripts/playerdeath.lua:onPrepareDeath
[07/01/2012 22:21:59] Description: 
[07/01/2012 22:21:59] data/creaturescripts/scripts/playerdeath.lua:12: bad argument #1 to 'abs' (number expected, got nil)
[07/01/2012 22:21:59] stack traceback:
[07/01/2012 22:21:59] 	[C]: in function 'abs'
[07/01/2012 22:21:59] 	data/creaturescripts/scripts/playerdeath.lua:12: in function <data/creaturescripts/scripts/playerdeath.lua:11>

please help




here is the playerdeath.lua file



PHP:
local config = {
    deadProtection = getConfigInfo('deadProtection')
}

function relogPlayer(cid)
	if isPlayer(cid) then
		doRemoveCreature(cid)
	end
end

function onPrepareDeath(cid, deathList)
       	if (isPlayer(cid) and ((math.abs config.deadProtection) >= getPlayerLevel(cid))) then
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
			setPlayerStorageValue(cid, 6612, 1)
			addEvent(relogPlayer, 1000, cid)
		else
		return true
        end    
end
 
Last edited:
Try this:
LUA:
local config = { 
    deadProtection = getConfigInfo('deadProtection') 
} 

function relogPlayer(cid) 
    if isPlayer(cid) then 
        doRemoveCreature(cid) 
    end 
end 

function onPrepareDeath(cid, deathList) 
           if (isPlayer(cid) and (math.abs(config.deadProtection) >= getPlayerLevel(cid))) then 
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) 
            setPlayerStorageValue(cid, 6612, 1) 
            addEvent(relogPlayer, 1000, cid) 
        else 
        return true 
        end     
end
 
LUA:
local deadProtection = getConfigInfo('deadProtection')

local function relogPlayer(cid)
	if isPlayer(cid) then
		doRemoveCreature(cid)
	end
end

function onPrepareDeath(cid, deathList)
	if deadProtection >= getPlayerLevel(cid) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 255, true)
		doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
		doTeleportThing(cid, getPlayerMasterPos(cid))
		doCreatureSetStorage(cid, 6612, 1)
		addEvent(relogPlayer, 1000, cid)
	else
		return true
	end
end
 
still didnt work this time i got


PHP:
[07/01/2012 22:50:52] [Error - CreatureScript Interface] 
[07/01/2012 22:50:52] data/creaturescripts/scripts/playerdeath.lua:onPrepareDeath
[07/01/2012 22:50:52] Description: 
[07/01/2012 22:50:52] data/creaturescripts/scripts/playerdeath.lua:10: attempt to compare number with nil
[07/01/2012 22:50:53] stack traceback:
[07/01/2012 22:50:53] 	data/creaturescripts/scripts/playerdeath.lua:10: in function <data/creaturescripts/scripts/playerdeath.lua:9>
 
Back
Top