ULX

Author Topic: Help with ASCII Characters (LUA).  (Read 5948 times)

0 Members and 1 Guest are viewing this topic.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Help with ASCII Characters (LUA).
« on: December 04, 2011, 05:08:11 PM »
I am trying to make a LUA, that will run on players when they spawn and check their name, if they have special characters in their name it will freeze them and ask them to change their name.

...but I noticed that Gmod handles ASCII differently, can any one provide me with the equivalents for ASCII characters 33 - 126?

This is the site, I have been using for the regular ones... http://www.asciitable.com/

I can not find one for Gmod.
« Last Edit: December 05, 2011, 10:51:36 PM by HeLLFox_15 »
I cry every time I see that I am not a respected member of this community.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Need LUA Help.
« Reply #1 on: December 04, 2011, 07:35:35 PM »
2 things..

1. You are mixing client only and server side code in the same file. This is usually not a good idea unless you block it off with something like this..

Code: [Select]
if SERVER then


end

if CLIENT then

end


and 2. You are overwriting the GAMEMODE.PlayerSpawn function.. which could be what is causing whatever issues you are having (you didn't specify) There are other things that are done in that function such as setting the player's loadout and player model. If you override the function you need to do these manually. I would suggest hooking the playerspawn function instead of overwriting it.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
(Help with ASCII Characters (LUA)) Re: Need LUA Help.
« Reply #2 on: December 05, 2011, 10:45:17 PM »
OK, my script now works, but I noticed that Gmod handles ASCII differently, can any one provide me with the equivalents for ASCII characters 33 - 126?

This is the site, I have been using for the regular ones... http://www.asciitable.com/

I can not find one for Gmod.

Edit: I mean that some characters are converted into other characters with different ASCII codes.
« Last Edit: December 06, 2011, 11:20:00 AM by HeLLFox_15 »
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Help with ASCII Characters (LUA).
« Reply #3 on: December 06, 2011, 04:19:18 PM »
Perhaps a Unicode table might help you? http://unicodetable.org
Ascii is, originally, American.
Unicode is meant to be used world wide, just about any language.
Valve and or Garry may have made a mosh of both, or using one over other.

Or perhaps another standard, ISO8859, which, is ASCII + (extra), and actually sounds more like what you describe.
« Last Edit: December 06, 2011, 04:21:16 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Help with ASCII Characters (LUA).
« Reply #4 on: December 06, 2011, 06:59:18 PM »
"Some characters are converted into other characters with different ASCII codes" -- what? All standard Latin characters will fall under the standard ASCII table. I believe the Source engine is using UTF-8 (indistinguishable from standard ASCII for Latin characters). If you have further specific questions, I am fairly knowledgable on this subject. :)
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Help with ASCII Characters (LUA).
« Reply #5 on: December 06, 2011, 08:10:11 PM »
blah
"Some characters are converted into other characters with different ASCII codes" -- what? All standard Latin characters will fall under the standard ASCII table. I believe the Source engine is using UTF-8 (indistinguishable from standard ASCII for Latin characters). If you have further specific questions, I am fairly knowledgable on this subject. :)

Basically, what he said :)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Help with ASCII Characters (LUA).
« Reply #6 on: December 07, 2011, 07:03:32 AM »
You might want to check out the following article, it helped me when I had to research character encodings: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) by Joel Spolsky
Experiencing God's grace one day at a time.