Jump to content

special characters and empty names allowed?


Recommended Posts

  • Subscriber

I searched the WIKI and forums for this, and I know I had asked it at one point but I see that this problem still happens.


There is a player on our server that likes to use non-printable non-standard characters in their name (e.g not alphanumerics and punctuation symbols).   I don't know how they do it, but they get non-standard ascii codes or something in their name.  It really looks funky in the logs and parsing tools.


I did find this, for version 0.7.0:


  • Fixed: Only real characters allowed in names.


I'd say that is not true, as this weekend (we're running 0.8.2) we had two instances of what I would consider illegal names:

0:55:43 Userinfo: \cg_ident\0000000025AD8511A356\cg_etver\4\cg_c\0.8.2\cg_cmodbuild\win-x86 Apr 24 2014\cg_uinfo\12 0 100\sil_guid\XXXXXGUIDXXXXXX\cl_guid\XXXXXGUIDXXXXX\cl_wwwDownload\1\name\^7\rate\32000\snaps\20\cl_anonymous\0\cl_punkbuster\1\ip\XXXXIPXXXX

It might be hard to see, but the name is : ^7   --- just a color?  It shows up as nothing in the game and in online trackers, just an empty slot.   I thought that you'd get kicked or the game would not allow you to enter an empty name.


I was going to paste another example where the guy used extended ascii characters in his name, but you can't see that when I print it here. In notepad it just looks like boxes where the special characters are, but I think you know what I mean.


Anyway - it seems that this fix either doesn't work anymore, or I'm unaware of settings that would require people to just use regular characters in their name instead of trying to be special using some sort of name exploit.    Any suggestions here?



Link to comment
Share on other sites

I would make sure to check length of cleanstr and trimmed for trailing spaces.


Can be done in lua. I don't have the code for the trim function though.

name = et.Info_ValueForKey( et.trap_GetUserinfo( clientnum ) , "name" )
name = trim(et.Q_CleanStr(name))

if ( string.len(name) < 1 ) then
    -- kick rename w/e
Link to comment
Share on other sites

  • Subscriber

Good suggestion.  I'm a novice at best at LUA, but would it be best to call something like this at a given interval (say every minute) or what would you suggest?   What would be the LUA to automatically rename someone?  Thanks.

Link to comment
Share on other sites

Basically I check it once in ClientBegin and I check it in ClientUserInfoChanged


As for the renaming: it will only save for the current round, which isn't ideal, but its better than nothing. ( You could replace it with the !rename command instead, I think that lasts until they disconnect )

function Client:setName(name)
    if ( name == nil ) then return end
    if ( string.len(Misc:trim(et.Q_CleanStr(name))) <= 0 ) then return end
    local userinfo = self:getUserInfo()
    userinfo = et.Info_SetValueForKey( userinfo, "name", name )
    et.trap_SetUserinfo( self.id, userinfo )
    et.ClientUserinfoChanged( self.id )


I really should open my lua to public lol.
It is hard to copy my code without seeing the entire project.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...