ULX

Author Topic: little chat command help  (Read 2721 times)

0 Members and 1 Guest are viewing this topic.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
little chat command help
« on: August 28, 2015, 06:44:28 PM »
Alright so right now i'm making a new chat command to set a persons bail... now this is the command:

!setbail xxlmm 100

Now i have this var:

jailer = text[2] (Yes this is all set up with the explode thing)

so how do i take the string and turn it to a player entity??

Thanks!

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: little chat command help
« Reply #1 on: August 28, 2015, 06:48:54 PM »
You could make it run through ULX and it would be so much easier, but if you don't want to...

You have to use player.GetAll().  Put that in a for loop and check each player instance to see if the string matches any part of the name.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: little chat command help
« Reply #2 on: August 28, 2015, 06:51:54 PM »
You could make it run through ULX and it would be so much easier, but if you don't want to...

You have to use player.GetAll().  Put that in a for loop and check each player instance to see if the string matches any part of the name.

Thats what i was thinking but if the player does xxlmm instead of my FULL name then what do i do? How do i call a part of the players name??

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: little chat command help
« Reply #3 on: August 28, 2015, 06:53:56 PM »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: little chat command help
« Reply #4 on: August 28, 2015, 06:55:38 PM »
I'm confused, didn't you make this already?

im trying to make this branch off from ulx to add support for others/non ulx users/losers (BECAUSE ULX IS GOD OF GMOD)

Anyway im also remaking a bail npc to hopefully release on scriptfodder to beat the current broken one!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: little chat command help
« Reply #5 on: August 28, 2015, 06:56:43 PM »
I'm confused, didn't you make this already?

As for how, you'd have to use string.find within GetAll loop for value:Nick() (or :Name(), I always forget))
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: little chat command help
« Reply #6 on: August 28, 2015, 07:01:17 PM »
I just got ninja'd by like 3 posts.

As for how, you'd have to use string.find within GetAll loop for value:Nick() (or :Name(), I always forget))
Exactly what I was about to say.  And Nick() and Name() are the same function.  Garry literally just copied the functions over to each other.