ID:160264
Oct 11 2008, 4:33 pm
|
|
Can anyone help me out with a code to prevent guests from signing on my game?
|
In response to Tiberath
|
|
ok thanks im doing that now
|
In response to Christopher52488
|
|
You might also want to make sure that it's in the beginning of the name, so "SuanaGuest999" doesn't get banned.
|
In response to Jeff8500
|
|
ok............
|
In response to Jeff8500
|
|
Jeff8500 wrote:
You might also want to make sure that it's in the beginning of the name, so "SuanaGuest999" doesn't get banned. Oh hey! Good point! That completely slipped my mind. To do that, you'll want to pay a visit to the DM reference and look up copytext() |
In response to Tiberath
|
|
_> Nah, you could still use findtext(). if(findText(key,"Guest-")==1) //if it was found at the beginning (first char position) Or, if you want it to be perfect in the detection: [link] Also, you could manage this kind of checking in world/IsBanned(), before a client is even created. |
In response to Kaioken
|
|
Good find on that IsGuest() proc. But I think the concept of it might be overstepping a beginner-programmers understanding ability. (But you're right, it's pretty perfect.)
And huh, I never really considered findText(). I very rarely, if at all use it, so it falls under the category of "I seem to recall a proc doing this..." |
Now, logically thinking, guest keys aren't just "guest" anymore, so we can do an if(src.ckey == "guest"). If I recall correctly, guest now has a series of alphanumerics after it. But still contains the word "guest".
With that in mind, we're going to have to look at the findtext() proc.
This is a very simple question, so I supplied you with a working snippet. But please, read the reference to the functions I mentioned. It'll help you later down the road when you wish to do more complex things.