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

Ot definitely does not record... (Help Big Scripters)

Paulim

New Member
Joined
Jun 3, 2009
Messages
31
Reaction score
0
I use TFS version 0.3.6 ( Real Server 3.1 )

The situation is as follows:
Since version update was given in my ot
DB continued the same old version and changed the Ot ..
Since then, it is not registered any frag, death etc on site

I'll give some information that may help to remedy my problem

There is a file called (playerdeath.lua)
Here is the content

Lua:
local 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

	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


Note: previous version did not exist that file (not needed)
But I noticed a line of the file that says:

Code:
... db.executeQuery ("INSERT INTO` player_deaths `(` [COLOR="red"]player_id[/COLOR] `,` [COLOR="red"]time[/COLOR] `,` [COLOR="red"]level[/COLOR] `,` [COLOR="red"]killed_by[/COLOR] `,` [COLOR="red"]altkilled_by[/COLOR] `) VALUES (" .. getPlayerGUID (cid) .. "" .. os.time () .. "" .. getPlayerLevel (cid) .. "" .. db.escapeString (hitKillerName) .. "" .. db.escapeString (damageKillerName) ");")  ...

And I think the big problem is some conflict in database
Even after 500 deaths in ot
Without any errors in console
Here is ..

Table Player_deaths

MySQL returned an empty set
There are those Fields in that table:
`Id`, `player_id`, `date`, `level`

So I think it is impossible to record the deaths as well ..

If relevant, also has this table:

Table Killers
MySQL returned an empty set
`id`, `death id`, `final_hit`, `unjustfied`

I humbly request aid to this problem
because it is already getting boring, and horrible .. Ot without a record of frags, deaths etc.

Nowhere else can help me, except here, Help please ..
Thanks! : D
 
Last edited:
playerdeath.lua was removed from TFS 0.3.6 because it automatically saves the death in db.. also the db table is different now (to store more than 2 killers)
 
Bump. Its easy for you guys,
I don't know why, you dont help me :x

Its a big problem inside the RPG of Otserver.
Without this, there is no Ot!
 
Try do delete this script and put this instead:

<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>

Lua:
function onThink(cid, interval)
	if(not isCreature(cid)) then
		return
	end

	local skull, skullEnd = getCreatureSkull(cid), getPlayerSkullEnd(cid)
	if(skullEnd > 0 and skull > SKULL_WHITE and os.time() > skullEnd and not getCreatureCondition(cid, CONDITION_INFIGHT)) then
		doPlayerSetSkullEnd(cid, 0, skull)
	end
end
 
Back
Top