Added character limit

master
AlmTech 5 years ago
parent 87eec886bf
commit 1a9b325174
  1. 5
      gamemode/engine/derma/menus/menu_character.lua
  2. 8
      gamemode/engine/lib/server/sv_networking.lua
  3. 2
      gamemode/settings/sv_settings.lua

@ -424,7 +424,7 @@ function menu.open( dt )
end end
local txt = vgui.Create( "DLabel", cpanels[count] ) local txt = vgui.Create( "DLabel", cpanels[count] )
txt:SetText( v.name || "NAME" ) txt:SetText( v.name || "[ERROR] NAME=nil" )
txt:SetFont( "q_charNameText" ) txt:SetFont( "q_charNameText" )
txt:SetTextColor( Color( 200, 200, 200, 220 ) ) txt:SetTextColor( Color( 200, 200, 200, 220 ) )
txt:SizeToContents() txt:SizeToContents()
@ -516,7 +516,8 @@ function menu.open( dt )
p.enter.DoClick = function() p.enter.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
-- enter world -- -- enter world --
snm.RunNetworkedFunc( "enterWorldChar", {index = selectedChar.index} ) -- FIX CRASH ISSUE ( 0xC00000FD ) local dt = { index = selectedChar.index }
snm.RunNetworkedFunc( "enterWorldChar", dt ) -- FIX CRASH ISSUE ( 0xC00000FD )
end end
p.enter.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end p.enter.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end end

@ -61,6 +61,14 @@ local funcs = {
local netfuncs = { local netfuncs = {
createChar = function( pl, args ) createChar = function( pl, args )
pl.charcount = Quantum.Server.Char.GetCharCount( pl ) pl.charcount = Quantum.Server.Char.GetCharCount( pl )
if( #args.name > 16 ) then
Quantum.Debug( "Player " .. tostring( pl ) .. " character name too long. Unable to create." )
return
elseif( pl.charcount + 1 > Quantum.Server.Settings.CharacterLimit ) then -- character limit
Quantum.Debug( "Player " .. tostring( pl ) .. " tried to exceed their character limit." )
return
end
print(pl.charcount + 1)
Quantum.Server.Char.Load( pl, pl.charcount + 1, args ) Quantum.Server.Char.Load( pl, pl.charcount + 1, args )
end, end,
enterWorldChar = function( pl, args ) enterWorldChar = function( pl, args )

@ -7,6 +7,8 @@
Quantum.Server.Settings = {} Quantum.Server.Settings = {}
Quantum.Server.Settings.CharacterLimit = 5
Quantum.Server.Settings.VoiceChatRange = 400 Quantum.Server.Settings.VoiceChatRange = 400
Quantum.Server.Settings.MaxHealth = 100 Quantum.Server.Settings.MaxHealth = 100

Loading…
Cancel
Save