ULX

Author Topic: Finding a player by chat.  (Read 2000 times)

0 Members and 1 Guest are viewing this topic.

Offline Conor

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Finding a player by chat.
« on: August 27, 2010, 11:28:08 AM »
Hello  ;D
I've been coding lua for about 2 months now,
I am trying to figure out how to find a players entire name by just typing have of it and searching for results.
Let's say I wanted to change a persons color to red when an admin types
Code: [Select]
!Red <PARTIAL SEGMENT OF PLAYERS NAME>".
How would I do this?

edit:
Code: [Select]
hook.Add( "PlayerSay", "HookNameBlarg", FunctionBlarg )

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Finding a player by chat.
« Reply #1 on: August 27, 2010, 12:25:09 PM »
if you are using ULib, then it is really easy.

If you are trying to return a player object so that you can use it in your code you can do the following.

ULib.getUser(partialname)

this will return the user with that partial name or an error if there are more than 1 results.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming