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
local txt = vgui.Create( "DLabel", cpanels[count] )
txt:SetText( v.name || "NAME" )
txt:SetText( v.name || "[ERROR] NAME=nil" )
txt:SetFont( "q_charNameText" )
txt:SetTextColor( Color( 200, 200, 200, 220 ) )
txt:SizeToContents()
@ -516,7 +516,8 @@ function menu.open( dt )
p.enter.DoClick = function()
surface.PlaySound( "UI/buttonclick.wav" )
-- 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
p.enter.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end
end

@ -61,6 +61,14 @@ local funcs = {
local netfuncs = {
createChar = function( pl, args )
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 )
end,
enterWorldChar = function( pl, args )

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

Loading…
Cancel
Save