Jump to content

Delete all toptimes of a player with a command


koragg

Recommended Posts

Hey fellas, I kinda need a script which would delete all of a specified player's toptimes with the command "/deletealltops nickname" but I'm having some trouble getting it to work.

function delAllTopsOfPlayer(player, command, name)
	if isGuestAccount (getPlayerAccount(player)) then
		return
	end
	if not name then
		outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true)
		return
	end
	local otherPlayer = string.lower(name)
	local otherPlayerName
	local map_names = {}
	for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do
		local rname = getResourceName(v)
		local mode = 'Sprint'
		map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v
	end
	local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ")
	for k, v in ipairs(maps_table) do
		local mapTable = v.tbl_name
		if map_names[mapTable] then
			local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable)
			for i, t in ipairs(mapTimes) do
				if getAccount(t.playerName) then
					if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub( '#%x%x%x%x%x%x', '' )) == otherPlayer:gsub( '#%x%x%x%x%x%x', '' ) then
						otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName")
						executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, otherPlayer)
					end
				end
			end
		end
	end
	if otherPlayerName then
		outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true)
	end
end
addCommandHandler("deletealltimes", delAllTopsOfPlayer)
addCommandHandler("deletealltops", delAllTopsOfPlayer)
addCommandHandler("delalltimes", delAllTopsOfPlayer)
addCommandHandler("delalltops", delAllTopsOfPlayer)

I tried adding an "outputChatBox("1")" right after the line: "executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, otherPlayer)" and indeed it showed as many 1s as all of my toptimes were (I have a show toptimes script, that's how I know how many tops I have, then I copied the 1s in MS Word and used Word Count to get their number.). So, there are no errors in debug, everything else works as it should and the final chatbox message displays that all of the player's tops were deleted, yet they remain untouched. Any help with this? I guess I'm using the 'DELETE' parameter wrong or maybe some table, don't know really...

Edited by koragg
Link to comment
6 hours ago, 3laa33 said:

you saved the name of the player to the table or the name of the account ?
 

I saved the account name and i made it display the player's most current nickname saved as account data. 

And when i write /delalltops nick it would have to search for his nickname, not account. 

 

So if there's a player with account name "Brian" and nickname "Racer45", when i write /deletealltops Racer45 it would delete all toptimes of the player. But if for example he changes his nickname to "Drifter58" then I'd have to type /delalltops Drifter58 in order to delete his toptimes.

Link to comment
1 hour ago, NeXuS™ said:

executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, t.playerName)

Try this one. :D

I actually did this right before reading your reply :P Worked, but now I got other stuff that need deleting along with this.

When a player makes a toptime at position 1 his time gets recorded in 'mapinterims'. So the next time the map is played, whoever is first sees text like +0:00:34 for example, which shows how far away he is from beating the top1 time. I need to delete this delay text along with the toptimes ONLY IF the toptime is a top1. I tried something like this but didn't work (line 30 until 34):

function delAllTopsOfPlayer(player, command, name)
	local accountName = getAccountName(getPlayerAccount(player))
	if isGuestAccount (getPlayerAccount(player)) or not (isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("SuperModerator"))) then
		return
	end
	if not name then
		outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true)
		return
	end
	local otherPlayer = string.lower(name)
	local otherPlayerName
	local rname
	local map_names = {}
	for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do
		rname = getResourceName(v)
		local mode = 'Sprint'
		map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v
	end
	local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ")
	for k, v in ipairs(maps_table) do
		local mapTable = v.tbl_name
		if map_names[mapTable] then
			local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable)
			for i, t in ipairs(mapTimes) do
				if getAccount(t.playerName) then
					if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub( '#%x%x%x%x%x%x', '' )) == otherPlayer:gsub( '#%x%x%x%x%x%x', '' ) then
						otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName")
						executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, t.playerName)
						outputServerLog("Toptimes of "..otherPlayerName:gsub( '#%x%x%x%x%x%x', '' ).." deleted!")
						local delays = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", rname)
						if #delays > 0 then
							executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", rname)
							outputServerLog("Delay times for "..otherPlayerName:gsub( '#%x%x%x%x%x%x', '' ).." deleted!")
						end
					end
				end
			end
		end
	end
	if otherPlayerName then
		outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true)
	else
		outputChatBox("No such player name found in toptimes database.", p, 255, 0, 0, true)
	end
end
addCommandHandler("deletealltimes", delAllTopsOfPlayer)
addCommandHandler("deletealltops", delAllTopsOfPlayer)
addCommandHandler("delalltimes", delAllTopsOfPlayer)
addCommandHandler("delalltops", delAllTopsOfPlayer)

PS: This is how I made it work for current map only with the command /deletedelay which I trigger with the /deletetime 1 command. I tried using it as an example but since I'm not sure what I'm doing I decided to post here xD

function deleteTimeDelay(player)
	local currentMap = exports.mapmanager:getRunningGamemodeMap()
	local mapName = getResourceName(currentMap)
	local sql = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", mapName)
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accName, aclGetGroup("SuperModerator")) then
        if #sql > 0 then
			executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", mapName)
			outputServerLog("Delay time for "..mapName.." deleted!")
        end
    end
end
addCommandHandler("deletedelay", deleteTimeDelay)

 

Edited by koragg
Link to comment
5 minutes ago, NeXuS™ said:

Does the outputServerLog outputs anything?

Yep

[2017-04-27 10:36:39] Delay times for [SiK]Megas deleted!

But I'm not even sure if I'm doing it the right way, as I wanna delete the delays only on maps on which the nickname (in this case me) has a top1, if not - don't touch as that would delete another player's delay times.

Edited by koragg
Link to comment
function delAllTopsOfPlayer(player, command, name)
	local accountName = getAccountName(getPlayerAccount(player))
	if isGuestAccount (getPlayerAccount(player)) or not (isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("SuperModerator"))) then
		return
	end
	if not name then
		outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true)
		return
	end
	local otherPlayer = string.lower(name)
	local otherPlayerName
	local rname
	local map_names = {}
	for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do
		rname = getResourceName(v)
		local mode = 'Sprint'
		map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v
	end
	local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ")
	for k, v in ipairs(maps_table) do
		local mapTable = v.tbl_name
		if map_names[mapTable] then
			local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable)
			for i, t in ipairs(mapTimes) do
				if getAccount(t.playerName) then
					if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub( '#%x%x%x%x%x%x', '' )) == otherPlayer:gsub( '#%x%x%x%x%x%x', '' ) then
						otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName")
						executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, t.playerName)
						outputServerLog("Toptimes of "..otherPlayerName:gsub( '#%x%x%x%x%x%x', '' ).." deleted!")
						local delays = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", getResourceName(map_names[mapTable]))
						if #delays > 0 then
							executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", getResourceName(map_names[mapTable]))
							outputServerLog("Delay times for "..otherPlayerName:gsub( '#%x%x%x%x%x%x', '' ).." deleted!")
						end
					end
				end
			end
		end
	end
	if otherPlayerName then
		outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true)
	else
		outputChatBox("No such player name found in toptimes database.", p, 255, 0, 0, true)
	end
end
addCommandHandler("deletealltimes", delAllTopsOfPlayer)
addCommandHandler("deletealltops", delAllTopsOfPlayer)
addCommandHandler("delalltimes", delAllTopsOfPlayer)
addCommandHandler("delalltops", delAllTopsOfPlayer)

Try this one. If this doesn't work, post a screenshot of the SQL table. :D

Edited by NeXuS™
  • Like 1
Link to comment

It works but is a bit bugged. If I have a toptime at position other than 1 on some maps and I delete all of my toptimes it still deletes the delays on those maps, although they weren't made by me :\ How to check if each and every one of my toptimes is a top1? If it is, delete delays on those maps, otherwise do nothing regarding delays.

Edited by koragg
Link to comment
1 hour ago, NeXuS™ said:

Can you do a screenshot of the mapinterims table?

I have no idea how to even see tables... :( But the code you did works, I just need to make a condition that if a toptime made by the specified player is not a top1 then it won't delete that map's delay. And idk how to make this condition*

Edited by koragg
Link to comment
32 minutes ago, NeXuS™ said:

Search for something like "databases" folder. :D

There are 3 more folders in that folder: 

- global

- other

- system

And there is a registry.db file in both 'global' and 'other'. And idk how to open db files :D

Link to comment
2 hours ago, NeXuS™ said:

No, you'll have to use executeSQLQuery and then use inspect on it's return value.

Well I did this:

function :~(player)
	local currentMap = exports.mapmanager:getRunningGamemodeMap()
	local mapName = getResourceName(currentMap)
	local sql = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", mapName)
	myDisplay = textCreateDisplay()
	textDisplayAddObserver(myDisplay, player)
	myTextItem = textCreateTextItem(inspect(sql), 0.5, 0.30, "high", 230, 0, 0, 255, 4.0, "center", "center" )
	textDisplayAddText(myDisplay, myTextItem)
end
addCommandHandler(":~", :~)

And all I got were one pair of curly brackets {} on my screen. No table, no nothing :\

Link to comment

So I tried this and I don't know where the problem can be:

function delAllTopsOfPlayer(player, command, name)
	local accountName = getAccountName(getPlayerAccount(player))
	if isGuestAccount (getPlayerAccount(player)) or not (isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("SuperModerator"))) then
		return
	end
	if not name then
		outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true)
		return
	end
	local otherPlayer = string.lower(name)
	local otherPlayerName
	local top1Nick
	local map_names = {}
	for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do
		local rname = getResourceName(v)
		local mode = 'Sprint'
		map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v
	end
	local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ")
	for k, v in ipairs(maps_table) do
		local mapTable = v.tbl_name
		if map_names[mapTable] then
			local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable)
			for i, t in ipairs(mapTimes) do
				if getAccount(t.playerName) then
					if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub('#%x%x%x%x%x%x', '')) == otherPlayer:gsub('#%x%x%x%x%x%x', '') then
						otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName")
						executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, t.playerName)
						local topsTable = getModeAndMap('Sprint', getResourceInfo(map_names[mapTable], 'name'))
						local topsSql = executeSQLQuery('SELECT playerName AS topName FROM '..qsafetablename(topsTable))
						if type(topsSql) == 'table' and #topsSql > 0 then
							if topsSql[1] then
								if getAccount(topsSql[1].topName) then
									if string.lower(getAccountData(getAccount(topsSql[1].topName), "currentPlayerName"):gsub('#%x%x%x%x%x%x', '')) == otherPlayer:gsub('#%x%x%x%x%x%x', '') then
										outputChatBox("1")
										local delays = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", getResourceName(map_names[mapTable]))
										if delays and #delays > 0 then
											executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", getResourceName(map_names[mapTable]))
										end
										if fileExists("ghosts/"..getResourceName(map_names[mapTable])..".ghost") then
											fileDelete("ghosts/"..getResourceName(map_names[mapTable])..".ghost")
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
	if otherPlayerName then
		outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true)
		outputServerLog("Toptimes of "..otherPlayerName:gsub('#%x%x%x%x%x%x', '').." deleted!")
		outputServerLog("Delay times of "..otherPlayerName:gsub('#%x%x%x%x%x%x', '').." deleted!")
		outputServerLog("Ghost records of "..otherPlayerName:gsub('#%x%x%x%x%x%x', '').." deleted!")
	else
		outputChatBox("No such player name found in toptimes database.", p, 255, 0, 0, true)
	end
end
addCommandHandler("deletealltimes", delAllTopsOfPlayer)
addCommandHandler("deletealltops", delAllTopsOfPlayer)
addCommandHandler("delalltimes", delAllTopsOfPlayer)
addCommandHandler("delalltops", delAllTopsOfPlayer)
-------------------------------------------------------------------------------------------------------------------------
function getModeAndMap(gMode, mapName)
	return 'race maptimes '..gMode..' '..mapName
end
-------------------------------------------------------------------------------------------------------------------------
function qsafetablename(s)
    return qsafestring(s)
end
-------------------------------------------------------------------------------------------------------------------------
function qsafestring(s)
    return "'"..safestring(s).."'"
end
-------------------------------------------------------------------------------------------------------------------------
function safestring(s)
    return s:gsub("(['])", "''")
end

It doesn't go below line 34 for some reason. Also is that a correct way of checking if each map's top1 name is the same as the entered text?

It should work but...no idea :( 100% something is wrong with line 34 (as the "1" doesn't show in chat) but I can't put my finger on what it is.

Link to comment

That means you'll need to debug both of the if statements, after line 33 do another outputChatBox to see if it gets triggered, if it triggers, check both of the values in the next if statement:

local state1 = getAccountData(getAccount(topsSql[1].topName), "currentPlayerName"):gsub('#%x%x%x%x%x%x', '')
local state2 = otherPlayer:gsub('#%x%x%x%x%x%x', '')
outputChatBox("Values - " .. state1 .. ":" .. state2 )

-- this is your if statement
if getAccountData(getAccount(topsSql[1].topName), "currentPlayerName"):gsub('#%x%x%x%x%x%x', '')) == otherPlayer:gsub('#%x%x%x%x%x%x', '') then

SQLite tables that you created with the executeSQLQuery should be saved in the registry.db. You can easily view the tables and the data with any SQL browsers you want to, eg: SQLite Browser

  • Like 1
Link to comment

@pa3ck if I put a chat msg after line 33 it shows, but the one after line 34 doesn't. Also when I check both values they show normally.

I found the problem :D It isn't really a problem with the script/syntax/logic. If you look at the code I sent above you'll see that I first delete the toptimes and then try to compare them with the written nickname (I'm comparing the written nick with top1s which will never be same as it, because I've already deleted that top1 nickname earlier in the code).

So now it works, but ghosts don't get deleted.

if fileExists("raceghost/ghosts/"..getResourceName(map_names[mapTable])..".ghost") then
	fileDelete("raceghost/ghosts/"..getResourceName(map_names[mapTable])..".ghost")
end

The path is correct and the ghost file names are the map's folder name (aka getResourceName) so why aren't ghost files being deleted?

 

Full code below:

function delAllTopsOfPlayer(player, command, name)
	local accountName = getAccountName(getPlayerAccount(player))
	if isGuestAccount (getPlayerAccount(player)) or not (isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("SuperModerator"))) then
		return
	end
	if not name then
		outputChatBox("You must specify a player name in order to delete all of their toptimes!", player, 255, 0, 0, true)
		return
	end
	local otherPlayer = string.lower(name)
	local otherPlayerName
	local map_names = {}
	for k, v in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName('race'))) do
		local rname = getResourceName(v)
		local mode = 'Sprint'
		map_names['race maptimes '..mode..' ' .. (getResourceInfo(v, 'name' ) or getResourceName(v))] = v
	end
	local maps_table = executeSQLQuery("SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'race maptimes %' ")
	for k, v in ipairs(maps_table) do
		local mapTable = v.tbl_name
		if map_names[mapTable] then
			local mapTimes = executeSQLQuery("SELECT playerName FROM ?", mapTable)
			for i, t in ipairs(mapTimes) do
				if getAccount(t.playerName) then
					if string.lower(getAccountData(getAccount(t.playerName), "currentPlayerName"):gsub('#%x%x%x%x%x%x', '')) == otherPlayer:gsub('#%x%x%x%x%x%x', '') then
						otherPlayerName = getAccountData(getAccount(t.playerName), "currentPlayerName")
						local topsTable = getModeAndMap('Sprint', getResourceInfo(map_names[mapTable], 'name'))
						local topsSql = executeSQLQuery('SELECT playerName AS topName FROM '..qsafetablename(topsTable))
						if type(topsSql) == 'table' and #topsSql > 0 then
							if topsSql[1] then
								if getAccount(topsSql[1].topName) then
									if string.lower(getAccountData(getAccount(topsSql[1].topName), "currentPlayerName"):gsub('#%x%x%x%x%x%x', '')) == otherPlayer:gsub('#%x%x%x%x%x%x', '') then
										local delays = executeSQLQuery("SELECT * FROM mapinterims WHERE mapname = ?", getResourceName(map_names[mapTable]))
										if delays and #delays > 0 then
											executeSQLQuery("DELETE FROM mapinterims WHERE mapname=?", getResourceName(map_names[mapTable]))
										end
										if fileExists("raceghost/ghosts/"..getResourceName(map_names[mapTable])..".ghost") then
											fileDelete("raceghost/ghosts/"..getResourceName(map_names[mapTable])..".ghost")
										end
									end
								end
							end
						end
						executeSQLQuery("DELETE FROM ? WHERE playerName=?", mapTable, t.playerName)
					end
				end
			end
		end
	end
	if otherPlayerName then
		outputChatBox("#FF0000All of #FFFFFF"..otherPlayerName.."#FF0000's toptimes were deleted!" , root, 255, 0, 0, true)
		outputServerLog("Toptimes of "..otherPlayerName:gsub('#%x%x%x%x%x%x', '').." deleted!")
		outputServerLog("Delay times of "..otherPlayerName:gsub('#%x%x%x%x%x%x', '').." deleted!")
		outputServerLog("Ghost records of "..otherPlayerName:gsub('#%x%x%x%x%x%x', '').." deleted!")
	else
		outputChatBox("No such player name found in toptimes database.", player, 255, 0, 0, true)
	end
end
addCommandHandler("deletealltimes", delAllTopsOfPlayer)
addCommandHandler("deletealltops", delAllTopsOfPlayer)
addCommandHandler("delalltimes", delAllTopsOfPlayer)
addCommandHandler("delalltops", delAllTopsOfPlayer)
-------------------------------------------------------------------------------------------------------------------------
function getModeAndMap(gMode, mapName)
	return 'race maptimes '..gMode..' '..mapName
end
-------------------------------------------------------------------------------------------------------------------------
function qsafetablename(s)
    return qsafestring(s)
end
-------------------------------------------------------------------------------------------------------------------------
function qsafestring(s)
    return "'"..safestring(s).."'"
end
-------------------------------------------------------------------------------------------------------------------------
function safestring(s)
    return s:gsub("(['])", "''")
end

 

PS: When I delete all toptimes of a player, the table updates on new map start. Any way to make it update the toptimes display the moment it finishes deleting tops of the specified player?

 

Example:

1. Brian

2. Mia

3. Dom

I do /delalltops Mia

It shows that they're deleted (and they are) but in the toptimes display window in F5 Mia is still at #2 because the display has not yet updated. I think this can cause trouble if someone else does a top but the one before it was deleted yet is still displayed.

Edited by koragg
Link to comment
1 hour ago, pa3ck said:

Is the if statements evaluates to true? About the GUI part, probably it gets the toptimes when the map starts and holds it in a LUA table, you would need to update that table after deleting the toptime.

Yes both if statements work fine. Also fixed the ghost files. It should have been ":raceghost/ghosts" and not "raceghost/ghosts". But the display update is acting weird. Below code is all in race_toptimes/toptimes_server.lua file. Then I just use 'executeCommandHandler("updatetops", player)' to use it in my resource.

--Used in the "deltops" resource to update current map's tops display after all of the tops of a player are deleted.
function triggerCurrentMapTopsUpdate(player)
	local accountName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) or isObjectInACLGroup("user."..accountName, aclGetGroup("SuperModerator")) then
		outputChatBox("1")
		if g_SToptimesManager and g_SToptimesManager.mapTimes then
			local row = g_SToptimesManager.mapTimes:deletetime()
			if row then
				g_SToptimesManager:updateTopText()
			end
		end
		outputChatBox("3")
		outputChatBox("2")
	end
end
addCommandHandler("updatetops", triggerCurrentMapTopsUpdate)

If I remove lines 6, 7, 8, 10 and 11 it does not update. But if I keep it like that^ it updates. There's just one problem. Line 7 deletes the top1 on a map so it ruins everything. Why can't I just use the function on line 9 without first being forced to delete the top1 on current map (again, this ruins everything). I only want to update the display, not delete things. But it won't let me update it unless I delete top1, wtf? This is the last thing that's left to fix, evertything else works perfectly now.

Edited by koragg
Link to comment
1 hour ago, pa3ck said:

I'm not familiar with this gamemode, so I don't know how updateTopText() works, so if you could post the "updateTopText()" function that would help.

function SToptimesManager:updateTopText()
	if not self.mapTimes then return end
	-- Update data
	-- Read top rows from map toptimes table and send to all players who want to know
	self.toptimesDataForMap = self.mapTimes:getToptimes( self.displayTopCount )
	self.serverRevision = self.serverRevision + 1
	
	-- Queue send to all players
	for i,player in ipairs(self.playersWhoWantUpdates) do
		self:queueUpdate(player)
	end
end

As you can see it's linked with 1000 other things...

Edited by koragg
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...