Ulysses Stuff > Releases
sui_scoreboard with UTime and Steam Avatars
JamminR:
Not forgotten, just not made / found time to test/research deeper.
As for the errors, well, it's not this release causing those (kind of obvious, no?)
krooks:
It's all good man, take your time.
Yes I had an idea that they would be unrelated, but I've had plugins conflict on me before, so figured I'd list it all ;D
Stickly Man!:
Hmm, I think I remember running into an error with this once in XGUI, not being able to properly determine the gamemode name right when the scripts were loaded.. I'll try and look at my code as soon as possible.
Stickly Man!:
Did you guys try ULib.isSandbox()? http://ulyssesmod.net/docs/files/lua/ulib/shared/util-lua.html#isSandbox
It returns true if sandbox or sandbox-derived, but.. might not work if you want ONLY sandbox.
EDIT: Nevermind, it's just as I suspected. The sui_scoreboard script is being loaded before the GAMEMODE is properly established, and before even ULib/ULX loads. In order to get your check to work properly, you'll have to delay the startup of sui_scoreboard (done with Timer.Simple( 0, function )). However, this ends up delaying it till it's pretty much the last thing loaded, so this may or may not end up causing more problems (for the few minutes I tested it, everything was working fine.)
Assuming the sui_scoreboard.lua file is exactly the same whether you have the UTime versions or not (or some other modified version), then your code should look something like this:
--- Code: ---if SERVER then
AddCSLuaFile( "autorun/sui_scoreboard.lua" )
AddCSLuaFile( "sui_scoreboard/admin_buttons.lua" )
AddCSLuaFile( "sui_scoreboard/cl_tooltips.lua" )
AddCSLuaFile( "sui_scoreboard/player_frame.lua" )
AddCSLuaFile( "sui_scoreboard/player_infocard.lua" )
AddCSLuaFile( "sui_scoreboard/player_row.lua" )
AddCSLuaFile( "sui_scoreboard/scoreboard.lua" )
AddCSLuaFile( "sui_scoreboard/vote_button.lua" )
include( "sui_scoreboard/rating.lua" )
else
local function sui_startup()
if GAMEMODE.Name == "Sandbox" then
include( "sui_scoreboard/scoreboard.lua" )
SuiScoreBoard = nil
timer.Simple( 1.5, function()
function GAMEMODE:CreateScoreboard()
if ( ScoreBoard ) then
ScoreBoard:Remove()
ScoreBoard = nil
end
SuiScoreBoard = vgui.Create( "SuiScoreBoard" )
return true
end
function GAMEMODE:ScoreboardShow()
if not SuiScoreBoard then
self:CreateScoreboard()
end
GAMEMODE.ShowScoreboard = true
gui.EnableScreenClicker( true )
SuiScoreBoard:SetVisible( true )
SuiScoreBoard:UpdateScoreboard( true )
return true
end
function GAMEMODE:ScoreboardHide()
GAMEMODE.ShowScoreboard = false
gui.EnableScreenClicker( false )
SuiScoreBoard:SetVisible( false )
return true
end
end )
end
end
timer.Simple( 0, sui_startup )
end
--- End code ---
It creates a function with all of the sui_scoreboard client startup code, then calls it after the timer.Simple goes through (which is basically when everything is loaded, ESPECIALLY the gamemode). Once that function is called, the first thing we do is check and see if it's a Sandbox gamemode or not-- If it is, then continue loading sui_scoreboard, if not, then just cancel it.
Hope that helps!
JamminR:
Stickly man, the GAMEMODE table not being ready was actually my first theory I was going to test.
Even the original code itself has a timer in it to add the "CreateScoreboard" function to GAMEMODE table delayed, so I thought that was the root cause.
Thanks for chasing it down.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version