ID:1241644
 
(See the best response by The Motto.)
I was just wondering how are guest keys disallowed from entering your game.. or how you determine them like mob/guest? hmm
http://www.byond.com/developer/LegendaryPrince12/ GuestRestrictions

Haven't opened that myself but just gonna take a stab at the dark and say that's what your after
What I do is this:

if(client.key==copytext("Guest",6))
return//they aren't allowed in.
In response to Dariuc
This should not work mainly because you are saying that client key MUST equal Guest.

a guest has a key something akin to Guest-xxxxxxxx

e.g. The player/guest2906939203 has Logged into the world.. and this is a basic name/ckey message.

it should be as it is pointed out in the library (which i viewed for sake of testing)

client
New()
if(copytext(src.key,1,7) == "Guest-")//if 'Guest-' is found within the first 7 letters of the key, it doesn't let them through
src<<"Guest logins are currently restricted, please log in under a valid key"
del(src)//kick them out of the game
..()


This doesn't need to be in client new but i believe it would be the best place to put it as honestly where else would you put it?
In response to Midgetbuster
Best response
Or He could do something like this, using the built in computer_id client var
client//the client
New()//when logs on to game
..()
if(key=="Guest-[computer_id]")//Checks if guest and finds their id
sleep(20) //hold for a few mili seconds
del(src)//kick them out

Of course this is an example and you can add a message to them if you'd like to with src<<, Also According to the DM Guide computer_id is, "A unique numerical identifier for the player's computer. The value is in text form."
I'd strongly recommend against disallowing guest keys. With the upcoming flash update, you may want to ensure that trial players have easy access to your game.
In response to Midgetbuster
It works and it's been tested.
Copytext looks for the word guest in the first 6 letters of the key- when you login as a guest it's always "Guest +randomized unique signature".

But I'm confused why you are saying it won't work since you pretty much typed the same thing I just said?
In response to Dariuc
Dariuc wrote:

But I'm confused why you are saying it won't work since you pretty much typed the same thing I just said?

You are using copytext wrong in your post.

copytext("Guest",6)


The above will return "Guest"

So you are checking if client.key=="Guest"

As such, your snippet won't work.

What you meant to type was:

if(copytext(src.key,6)=="guest")
In response to Ter13
"Guest" is what it ends up being when people login as a guest.
Until recently I had it set up to deny guests as well.
I'm about 90% sure it also had it set up the way I just mentioned.

Either way it doesn't matter. Using copytext to deny guest keys if you wish to do so-- is the right way to go.
In response to Dariuc
yes but you are just using the copytext is wrong was all :p
In response to Midgetbuster
http://puu.sh/2DCdL.jpg

And yea you are right, I was using it the wrong way.
It might be better to use findtext() - there is no comparing involved, and a numerical (true) value is returned. Copytext is like one of the heaviest text-related procs, I think.

if(findtext(key, "guest", 1,6)) del src
In response to The Motto
The Motto wrote:
Or He could do something like this, using the built in computer_id client var
> client//the client
> New()//when logs on to game
> ..()
> if(key=="Guest-[computer_id]")//Checks if guest and finds their id
> sleep(20) //hold for a few mili seconds
> del(src)//kick them out
>

Of course this is an example and you can add a message to them if you'd like to with src<<, Also According to the DM Guide computer_id is, "A unique numerical identifier for the player's computer. The value is in text form."

I think this way is best, because if you are checking if the first 5 characters of the person's key is equal to guest wouldn't that restrict any people who have a key such as guestomania or guestofhonor, not just guest keys, to play your game?

EDIT: I said 6 characters, I meant 5.
In response to Nailez
Nailez wrote:
The Motto wrote:
Or He could do something like this, using the built in computer_id client var
client//the client
New()//when logs on to game
..()
if(key=="Guest-[computer_id]")//Checks if guest and finds their id
sleep(20) //hold for a few mili seconds
del(src)//kick them out

Of course this is an example and you can add a message to them if you'd like to with src<<, Also According to the DM Guide computer_id is, "A unique numerical identifier for the player's computer. The value is in text form."

I think this way is best, because if you are checking if the first 6 characters of the person's key is equal to guest wouldn't that restrict any people who have a key such as guestomania or guestofhonor, not just guest keys, to play your game?

I don't believe BYOND allows users to create keys with "guest" as the first five characters.
Oh okay.