AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing ',",[,],~. (https://forums.alliedmods.net/showthread.php?t=10079)

TotalNoobScripter 02-07-2005 18:42

Removing ',",[,],~.
 
How would you replace a get_user_name from -Snort- 'Woot' Leader to Snort Woot Leader (Because I'm having problems doing stuff when my name has random symbols like that...I.E. my name wont register to my MYSQL database, but when it is something as simple as Ben Dover, it works....)

heres some chars I would like to know how to remove also...

',",[,],~,-,=,/,\, and anything else of that nature.

Da Bishop 02-07-2005 19:38

Use the replace command.

TotalNoobScripter 02-07-2005 21:57

Yea, but its treating me bad :P

PM 02-08-2005 06:49

Try this:
Code:
stock remove_weird_stuff(text[]) {    new i;    new off=0;    new validcnt=0;    for (i = 0; text[i]; ++i)    {       text[i - off] = text[i];       if (text[i] == '\'' || text[i] == '\"' || text[i] == '[' || text[i] == ']' || text[i] == '~')          ++off;       else          ++validcnt;    }    text[validcnt] = 0; }

Note that this is untested, I have written it in one minute :X

EDIT: Typo


All times are GMT -4. The time now is 19:27.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.