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

Why does it lagg? When you die you freeze some

Dalale

GX
Joined
Jun 13, 2008
Messages
718
Reaction score
2
Location
Sweden
Ok when you die the server freeze some.
But it wasnt so when i used 8,40 client

im using tfs 0.2.4 mystic ~


here is my scripts
playerdeath
Code:
dofile("./config.lua")

function onDeath(cid, corpse, killer)
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are dead.")
	
	if isPlayer(killer) == TRUE then
		local levelDiff = getPlayerLevel(cid) - getPlayerLevel(killer)
		if (getPlayerLevel(cid) >= 200 or levelDiff >= 50) then
			local item = doPlayerAddItem(killer, 8698, 1)
			doSetItemSpecialDescription(item, "It's a trohpy " .. getCreatureName(killer) .. " [" .. getPlayerLevel(killer) .. "] gained for killing " .. getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "].")

			broadcastMessage(getCreatureName(cid) .. " [" .. getPlayerLevel(cid) .. "] just got slayed by " .. getCreatureName(killer) .. " [" .. getPlayerLevel(killer) .. "]!", MESSAGE_STATUS_WARNING)

			local maxMoney = levelDiff * math.random(1, 10000)
			local money = math.min(maxMoney, getPlayerMoney(cid))
			
			if money > 0 then
				doPlayerRemoveMoney(cid, money)
				doPlayerAddMoney(killer, money)
				doPlayerSendTextMessage(killer, MESSAGE_STATUS_CONSOLE_RED, "You gained " .. money .. " gold coins for killing " .. getCreatureName(cid) .. ".")
			end
		end
	end
	
	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

playerpreparedeath
Code:
function onPrepareDeath(cid, killer)
    --if getPlayerStorageValue(cid, 65080) == TRUE then
     --   doSetCreatureDropLoot(cid, 0)
    --end
end

Can anyone help me?
 
Back
Top