ive been writing some scripts for my servers using target zones and display some information as a center message including the player name that entered the zone but heres where im getting stuck
if a player called fred enters the target the ladderlog writes the players name fred and my center message displays fred and thats great
but if a player is logged in as fred@forums and enters the target then the full login name is displayed by the center message fred@forums
so I added some code to strip the @ and anything else after it and the center message now just displays fred
the problem i now face is with someone thats not logged in but calls themself @fred or @@@fred, now their name is blank
Ive thought about this a lot but I cannot think of a solution, Is it impossible to filter the name ?
any thoughts on this would be very helpful
thanks
filter names impossible task ?
Re: filter names impossible task ?
there is one way i could do this but its a lot of work
ive noticed that in ladderlog when i player logs in it'll say fred renamed to fred@forums so I could keep a name table
when a player enters the game add their name to the table
when a player is renamed by the login then add this new logged in name along side their original name
use the original name for displaying center messages
also need to keep track of players renaming during a game and remove their entry when they leave the game
i think this should work but its a pain, is there an easier way ?
ive noticed that in ladderlog when i player logs in it'll say fred renamed to fred@forums so I could keep a name table
when a player enters the game add their name to the table
when a player is renamed by the login then add this new logged in name along side their original name
use the original name for displaying center messages
also need to keep track of players renaming during a game and remove their entry when they leave the game
i think this should work but its a pain, is there an easier way ?
Re: filter names impossible task ?
First off, the @ I believe will be escaped to \@.
However, you should be able to grab actual names from elsewhere... for example, PLAYER_ENTERED/PLAYER_RENAMED, and/or on other versions, ONLINE_PLAYER or PLAYER_COLORED_NAME.
However, you should be able to grab actual names from elsewhere... for example, PLAYER_ENTERED/PLAYER_RENAMED, and/or on other versions, ONLINE_PLAYER or PLAYER_COLORED_NAME.
Re: filter names impossible task ?
i did a test and found out that the @ is not escaped
as a quick hack i test the filtered name and if its blank i use the unfiltered name, still the name @@@fred is showing as @@ lol
so i need to rewrite th filter a little bit more but i think for now i'll not worry if the name is displayed incorrectly as long as i use the unfiltered name for game events then i'll have no issues with the game logic
later i'll add a name table and all the junk to make it work
thanks
as a quick hack i test the filtered name and if its blank i use the unfiltered name, still the name @@@fred is showing as @@ lol
so i need to rewrite th filter a little bit more but i think for now i'll not worry if the name is displayed incorrectly as long as i use the unfiltered name for game events then i'll have no issues with the game logic
later i'll add a name table and all the junk to make it work
thanks
- delinquent
- Match Winner
- Posts: 761
- Joined: Sat Jul 07, 2012 3:07 am
Re: filter names impossible task ?
Since there are a limited number of current authentication methods, I would simply use an exact match filter - strip out @forums, @lt, @armanelgtron.tk and you're golden.
Re: filter names impossible task ?
yeah thats good idea, i'll create an array of authentication names and can add to it if any more pop updelinquent wrote: ↑Sat Aug 29, 2020 12:11 am Since there are a limited number of current authentication methods, I would simply use an exact match filter - strip out @forums, @lt, @armanelgtron.tk and you're golden.
thanks
Re: filter names impossible task ?
nelg pointed out that I should enable ladderlog_write_player_colored_name and use that instead
it sends the playername@somewhere along with the normal playername including colors without the @somewhere
so now i store both in an array, use the 1st one with @ for things like add_score_player etc and the 2nd one for displaying messages
looks great, thanks nelg
it sends the playername@somewhere along with the normal playername including colors without the @somewhere
so now i store both in an array, use the 1st one with @ for things like add_score_player etc and the 2nd one for displaying messages
looks great, thanks nelg