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

When some one dies they get level 1!

exique

Natala-ot.com
Joined
Sep 28, 2008
Messages
1,673
Reaction score
25
Location
Sweden
When some one dies they get level 1 :(
deathlosepercent is set to 0 in config..

I use tfs 0.3.4 :(
help please!
 
Maybe something is wrong with playerdeath.lua?
Here is my playerdeath.lua:
config = {
deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}

config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if(config.deathListEnabled ~= TRUE) then
return
end
if getPlayerSlotItem(cid, 2).itemid == 2173 then
doPlayerRemoveItem(cid, 2173, 1)
end

local hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getPlayerGUID(lastHitKiller)
else
hitKillerName = getCreatureName(lastHitKiller)
end

if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
end
end

db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local amount = rows:getRows(true) - config.maxDeathRecords
if(amount > 0) then
if(config.sqlType == DATABASE_ENGINE_SQLITE) then
for i = 1, amount do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
end
else
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
end
end
end
end
 
About deathlosepercent, 0 means they lose NO exp when they die.

if you set it to 10, then they lose 10% exp when they die.. 20 then they lose 20%... and so on
 
same problem here plis help :(

use the php code v

Maybe something is wrong with playerdeath.lua?
Here is my playerdeath.lua:

try use this 1
PHP:
dofile("./config.lua")

function onDeath(cid, corpse, killer)
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
	if deathListEnabled == "yes" then
		if sqlType == "mysql" then
			env = assert(luasql.mysql())
			con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
		else -- sqlite
			env = assert(luasql.sqlite3())
			con = assert(env:connect(sqliteDatabase))
		end
		local byPlayer = FALSE
		if killer == FALSE then
			killerName = "field item"
		else
			if isPlayer(killer) == TRUE then
				byPlayer = TRUE
			end
			killerName = getCreatureName(killer)
		end
		assert(con:execute("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", '" .. escapeString(killerName) .. "', " .. byPlayer .. ");"))
		local cursor = assert(con:execute("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";"))
		local deathRecords = numRows(cursor)
		if sqlType == "mysql" then
			while deathRecords > maxDeathRecords do
				delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1;"))
				deathRecords = deathRecords - 1
			end
		else
			while deathRecords > maxDeathRecords do
				delete = assert(con:execute("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);"))
				deathRecords = deathRecords - 1
			end
		end			
		con:close()
		env:close()
	end
end
:thumbup::thumbup:
 
Im using tfs 2.5, I need to know whay does a player lvl 335 die and lost 16 lvls deathpercent = 9 and also if someone can explain about loss_experience on mysql should it has to be 10 by default or should i insert the query manually.

Please reply
 
Im using tfs 2.5, I need to know whay does a player lvl 335 die and lost 16 lvls deathpercent = 9 and also if someone can explain about loss_experience on mysql should it has to be 10 by default or should i insert the query manually.

Please reply

simply do the math.. find the amount of [e] that a level [x] has... and then multiply it by [v].

[e] = experience number/value (ex. lvl: 336 = 621023000)
[x] = level of player.
[v] = value of deathloss (ex. 9 or 9/100 or 0.09)

in other words... take 621023000 multiplied by 0.09, you get 565130930, then subtract that from the original 621023000, and figure out which level they are depending on the table, in this example it would be a 10 level loss~ which is something like 10-11 levels lost. Depending on blessings, server settings, custom vocations and other variables. it might differ from server to server, these numbers were based on rl tibia exp board located at:
Tibia - Free Multiplayer Online Role Playing Game - Library.


you can edit this within mysql, playerdeath, or login/scripts.
Im coming from a different community so as of now, ill try getting into lua scripting, and stuff. Im more of a graphic designer and other codeing.
 
Last edited:
simply do the math.. find the amount of [e] that a level [x] has... and then multiply it by [v].

[e] = experience number/value (ex. lvl: 336 = 621023000)
[x] = level of player.
[v] = value of deathloss (ex. 9 or 9/100 or 0.09)

in other words... take 621023000 multiplied by 0.09, you get 565130930, then subtract that from the original 621023000, and figure out which level they are depending on the table, in this example it would be a 10 level loss~ which is something like 10-11 levels lost. Depending on blessings, server settings, custom vocations and other variables. it might differ from server to server, these numbers were based on rl tibia exp board located at:
Tibia - Free Multiplayer Online Role Playing Game - Library.


you can edit this within mysql, playerdeath, or login/scripts.
Im coming from a different community so as of now, ill try getting into lua scripting, and stuff. Im more of a graphic designer and other codeing.

You've got brains. It's rare these days
 
You've got brains. It's rare these days

lol, im new to the community, i hate asking for help, but i like to help out, i figure its better for me to know how to do something then just fix it and have the same problem later on.. :)

blah well, pc^ and school now..
so buhbye
sincerely-
C00KIE
 
Back
Top