Ulysses

General => Developers Corner => Topic started by: XxLMM13xX on August 28, 2015, 06:44:28 PM

Title: little chat command help
Post by: XxLMM13xX 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!
Title: Re: little chat command help
Post by: Aaron113 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() (http://wiki.garrysmod.com/page/player/GetAll).  Put that in a for loop and check each player instance to see if the string matches any part of the name.
Title: Re: little chat command help
Post by: XxLMM13xX 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() (http://wiki.garrysmod.com/page/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??
Title: Re: little chat command help
Post by: JamminR on August 28, 2015, 06:53:56 PM
I'm confused, didn't you make this already (http://forums.ulyssesmod.net/index.php/topic,8515.msg43715.html)?
Title: Re: little chat command help
Post by: XxLMM13xX on August 28, 2015, 06:55:38 PM
I'm confused, didn't you make this already (http://forums.ulyssesmod.net/index.php/topic,8515.msg43715.html)?

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 (http://www.scriptfodder.com) to beat the current broken one!
Title: Re: little chat command help
Post by: JamminR on August 28, 2015, 06:56:43 PM
I'm confused, didn't you make this already (http://forums.ulyssesmod.net/index.php/topic,8515.msg43715.html)?

As for how, you'd have to use string.find within GetAll loop for value:Nick() (or :Name(), I always forget))
Title: Re: little chat command help
Post by: Aaron113 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.