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

Problem when a player dies [0.3.7][0.3.r5928][9.81]

Pnurt

New Member
Joined
Apr 22, 2009
Messages
205
Reaction score
0
So I'm having this issue when a player dies, he never gets kicked from the server like you are supposed to.

The "Your are dead." windows stays up and after a while you get "Connection lost" (or something like that) and then you get kicked. After that you have to login again and once you are logged in, your backpack that you died and lost is open in a window. You can't do anything with it and you don't actually have the backpack on you.

So this isn't something that destroys my server in any way but it would be nice to fix as it would confuse a lot of people.


Wangsta said this
You could make a creaturescript onDeath using doRemoveCreature.


Anyone could help me out here?

*******************************************************************
EDIT:

For everyone that needs a fix have a look at this!!

http://otland.net/project.php?issueid=2419#note13459
 
Last edited:
Do you have any current onDeath, logout, or preparedeath scripts in your creaturescripts? If they are not executed properly the server will not properly finish the players death.

Post them here if you do.
 
Do you have any current onDeath, logout, or preparedeath scripts in your creaturescripts? If they are not executed properly the server will not properly finish the players death.

Post them here if you do.

Nah I don't have any :s

FEMarIY.png
 
demonOakLogout
Code:
function onLogout(cid)
 
	if getCreatureStorage(cid, storages.treeCut) > 0 and getCreatureStorage(cid, storages.done) < 1 then
		doCreatureSetStorage(cid, storages.treeCut, 0)
	end
	return true
end

demonOakDeath
Code:
function onDeath(cid, corpse)
 
	if getCreatureStorage(cid, storages.treeCut) > 0 and getCreatureStorage(cid, storages.done) < 1 then
		local creatures = getCreaturesInQuestArea(TYPE_MONSTER, questAreaPosition[1], questAreaPosition[2], GET_UID)
		if creatures and #creatures > 0 then
			for _, it in ipairs(creatures) do
				doRemoveCreature(it)
			end
		end
		doCreatureSetStorage(cid, storages.treeCut, 0)
	end
	return true
end
 
I don't see any issues with them, comment them out and test it without quick, and I don't think onkill could do it but I suppose its possible try commenting that out after to see if it changes

- - - Updated - - -

Also, what function does the thankyou and extendedopcode serve? Never seen it before.
 
I don't see any issues with them, comment them out and test it without quick, and I don't think onkill could do it but I suppose its possible try commenting that out after to see if it changes

- - - Updated - - -

Also, what function does the thankyou and extendedopcode serve? Never seen it before.

I'll try commenting them out.

thankyou
Code:
function onThankYou(cid, statementId)
	-- TODO :)
	return true
end

extendedopcode
Code:
OPCODE_LANGUAGE = 1

function onExtendedOpcode(cid, opcode, buffer)
	if(opcode == OPCODE_LANGUAGE) then
		-- otclient language
		if(buffer == 'en' or buffer == 'pt') then
			-- example, setting player language, because otclient is multi-language...
			--doCreatureSetStorage(cid, CREATURE_STORAGE_LANGUAGE, buffer)
		end
	else
		-- other opcodes can be ignored, and the server will just work fine...
	end
end
 
Try putting return true at the end of your extendedopcode

extendedopcode
Code:
OPCODE_LANGUAGE = 1

function onExtendedOpcode(cid, opcode, buffer)
	if(opcode == OPCODE_LANGUAGE) then
		-- otclient language
		if(buffer == 'en' or buffer == 'pt') then
			-- example, setting player language, because otclient is multi-language...
			--doCreatureSetStorage(cid, CREATURE_STORAGE_LANGUAGE, buffer)
		end
	else
		-- other opcodes can be ignored, and the server will just work fine...
	end
        return true
end

Like that?

- - - Updated - - -

Changed the extendedopcode and commented out the death and logout connected with demonoak.

Still same problem...
 
That's weird, did you make any source modifications? And try commenting out the thank you and kill for demonoak, that's all that's left that could even possibly cause it, besides sources
 
Nah I've not changed anything with the source.

But Wangsta said that he would fix it soon. So I'm guessing the death function is inside the source now.
Though he also said that I could make a creaturescript
You could make a creaturescript onDeath using doRemoveCreature.

Could you help me with that?
 
Well initially I'm sure that he meant one that creates the corpse and the killers name on the corpse and all before removing the creature, yes this would work but this is already a function built into tfs so there is something stopping it from working correctly
 
That code made my character logut immidiately after death and when logging in I got to the place that I died xD

Ahh I had a little typo lols


Yeah it's kicking me instantly. Then I'm spawning on the same place that I died on.

Here is what Mr.Console is saying about it
Code:
[21:2:54.399] Capmaster has logged out.

[21:2:54.429] [Error - CreatureScript Interface]
[21:2:54.431] data/creaturescripts/scripts/advancesave.lua:onAdvance
[21:2:54.435] Description:
[21:2:54.436] (LuaInterface::luaGetCreatureMaxHealth) Creature not found

[21:2:54.438] [Error - CreatureScript Interface]
[21:2:54.440] data/creaturescripts/scripts/advancesave.lua:onAdvance
[21:2:54.443] Description:
[21:2:54.444] (LuaInterface::luaGetCreatureHealth) Creature not found

[21:2:54.446] [Error - CreatureScript Interface]
[21:2:54.448] data/creaturescripts/scripts/advancesave.lua:onAdvance
[21:2:54.451] Description:
[21:2:54.452] data/creaturescripts/scripts/advancesave.lua:12: attempt to perfor
m arithmetic on a boolean value
[21:2:54.456] stack traceback:
[21:2:54.457]   data/creaturescripts/scripts/advancesave.lua:12: in function <da
ta/creaturescripts/scripts/advancesave.lua:6>

- - - Updated - - -

Well initially I'm sure that he meant one that creates the corpse and the killers name on the corpse and all before removing the creature, yes this would work but this is already a function built into tfs so there is something stopping it from working correctly

The corpse and killer name is working. Everything is just like normal just that the one who dies doesn't get kicked.
 
Set this as death script.

Lua:
function deathKick(cid)
	doRemoveCreature(cid)
end

function onDeath(cid, corpse)
	addEvent(deathKick, 0, cid)
	return true
end

For the addEvent the 0 is the time before it executes

So say it doesn't work try adding 100 to it which is 1/10th of a second before acting

1000 is a full second

And don't for get to register the creaturevent in login.lua
 
Back
Top Bottom