ID:176252
 
Could anyone please tell me how I would go about making a game check when a user is making a character and disallow him from creating it with a Name that already exists in the game?

Eg I make the char with name Bebi

But the name is already in use by another player.

Thanks:)
make it check for saves. Make sure the file name on the save is the users name, if the users saved, then he will have a save file with his name on it.
mob/verb/Name_ME(T as text)
for(var/mob/M in world)
if(M.name == T)
usr <<"That name is taken."
return
else
usr.name = "[html_encode(T)]
usr <<"That name wasn't taken,You can use it."
Create a global list that contains the names of all players in the game. If your game uses saving, you'll need to save the list along with the rest of the game's savefiles, so that once your chracter is created, no one else can use that name. Once you've created that list, you need to add players to it whenever they create a new character (or whenever they login/logout if it's a per-session game). Here's an example.

<code> var/list/player_names = list() mob/proc/create_character() name = null while(!name) name = input(src, "Name your character", "Name", name) as text if(name) if(player_names.Find(name)) src << "That name is already taken! Pick another one." player_names += name // continue with character creation </code>