diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 2826dc6..8bdb4e8 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -49,6 +49,20 @@ local function getNextIndex( index, isNext, min, max ) end end +local function checkNameString( name ) + local strTbl = string.Explode( "", name ) + for i, char in pairs( strTbl ) do + if( i == 1 || strTbl[ math.Clamp( i-1, 1, #strTbl ) ] == " " ) then -- if it is the first letter then make it a capital one + strTbl[i] = string.upper( char ) -- or if it is a space inbetween make it a capital one aswell + end + for n, char_ in pairs( strTbl ) do + if( n >= #strTbl && char == " " && strTbl[n-1] ~= " " ) then strTbl[i] = nil end -- remove the spaces at the end + end + end + PrintTable( strTbl ) + print( #strTbl >= 3 ) +end + local pages = { charCreate = function( parent ) local pW, pH = parent:GetSize() @@ -120,6 +134,9 @@ local pages = { theme.blurpanel( self ) self:DrawTextEntryText( Color( 255, 255, 255, 255 ), Color( 150, 150, 150, 255 ), Color( 100, 100, 100, 255 ) ) end + name.OnEnter = function() + checkNameString( name:GetText() ) + end -- input panel contens --