Ulysses Stuff > Releases

[TTT] Scoreboard Ranks for ULX - Version 1.2.0

<< < (6/12) > >>

GG142:

--- Quote from: Decicus on February 15, 2016, 05:01:30 AM ---Yeah... I already had the idea of doing it for each PlayerSpawn, but then it could potentially be called too often and in worst cases someone might notice lag (even for a split second for each spawn, but still somewhat annoying).
Although, I think implementing a similar hook for the first round after a mapchange using TTTBeginRound might be a possible fix.

--- End quote ---
Good! And I do agree on the point of the annoying lag spikes, but the scoreboard works :)
Still wondering why the problem was here in the first place...

monkeymacman:
I feel like it must have something to do with you using gamemode.call("CreateScoreboard") or whatever but I am unfamiliar with the function. Also, why must you resend the whole file when something is updated? Why not just send what you are adding. Also, I don't see why refreshscoreboard would make the scoreboard work for the whole map because (unless this is a recently added part but I don't think so) it refreshes the scoreboard for a player on playerinitialspawn, so that might just be too early of a hook, but IDK in like 50% of the addon I have no clue why you are doing something.

Decicus:

--- Quote from: monkeymacman on February 15, 2016, 09:34:36 PM ---I feel like it must have something to do with you using gamemode.call("CreateScoreboard") or whatever but I am unfamiliar with the function.
--- End quote ---

It's possible. I believe I added that as just a quick hack a long time ago when I noticed the scoreboard would bug out if I refreshed the scoreboard.


--- Quote from: monkeymacman on February 15, 2016, 09:34:36 PM ---Also, why must you resend the whole file when something is updated? Why not just send what you are adding. Also, I don't see why refreshscoreboard would make the scoreboard work for the whole map because (unless this is a recently added part but I don't think so) it refreshes the scoreboard for a player on playerinitialspawn, so that might just be too early of a hook, but IDK in like 50% of the addon I have no clue why you are doing something.

--- End quote ---

That is mainly due to poor practices that I decided to do roughly a year ago when I started this. Over time I've realized that it's honestly a pretty bad addon, as it has become more of a hassle to maintain. Personally I don't really have the time or interest in rewriting this from scratch as I don't actually play Garry's Mod or TTT anymore, even if it would probably be easier than trying to maintain it.

PlayerInitialSpawn might be too early of a hook, I agree. I could possibly look into a different hook for this usage, but for, I might just refresh it on the beginning of a round (as well as the PlayerInitialSpawn) to see if that fixes it.

GG142:
The following seems to work for us, we hardly notice any lag spikes when people join, but maybe another hook would be nice;

--- Code: ---local function TTTSBRanksRefresh( ply )

    if not ULib.fileExists( dir ) then ULib.fileCreateDir( dir ) end
    if ULib.fileRead( dir .. ranks ) then TTTSBRanks = util.JSONToTable( ULib.fileRead( dir .. ranks ) ) end
    if ULib.fileRead( dir .. settings ) then TTTSBSettings = util.JSONToTable( ULib.fileRead( dir .. settings ) ) end
    if ULib.fileRead( dir .. groups ) then TTTSBGroups = util.JSONToTable( ULib.fileRead( dir .. groups ) ) end

    if SERVER then

        net.Start( "ULX_TTTSBRanks" )
        net.WriteTable( TTTSBRanks )
        net.WriteTable( TTTSBSettings )
        net.WriteTable( TTTSBGroups )
        if ply then

            net.Send( ply )

        else

            net.Broadcast()

        end

    end

end
hook.Add( "PlayerInitialSpawn", "ULXTTTRefresh_PlayerJoin", TTTSBRanksRefresh )
function RefreshStart(ply)
MsgN( ply:Nick() .. " has spawned!" )
TTTSBRanksRefresh()
end
hook.Add( "PlayerSpawn", "ulxttt_RefreshStart", RefreshStart )
--- End code ---

Decicus:
Updated to version 1.1.1 with a hotfix that GG142 provided.

Sorry it took so long.

Further updates may or may not occur as I have don't have much interested in maintaining this. If you can find a better alternative, then please feel free to use that.
If anyone wishes to continue the work for some odd reason, the source is available on GitHub, but I highly recommend rewriting this from scratch instead of continuing from my old work.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version