I'm trying to make an account system for a small MP application, but I ran into a very weird problem today smile
Here's the code:

Code:
If(str_len(username_str) > 5 && str_len(password_str) > 5 && player == null)
	{
		str_cpy(id_str,player_name);
		str_clip(id_str,6);
		client_id1 = str_to_num(id_str);
		player = ent_create("arrow.pcx",vector(1000,1000,1000), mp_entity);
		sleep(1);
		player.ID = client_id1;
		send_skill(player.ID,0);
		str_cpy(login_command,id_str);
		str_cat(login_command,"*");
		str_cat(login_command,username_str);
		str_cat(login_command,"*");
		str_cat(login_command,password_str);
		send_string(login_command);
	}


username_str, password_str and id_str are strings, client_id1 is a variable... what I'm trying to do, is get a unique client ID by clipping 6 characters off of the string "player_name", then turning it into a variable using str_to_num and then send it to the newly created player entity.
Now, the problem is - client_id1 isn't the same as id_str!! No matter what I do, client_id1 just looks like a random number every time! But id_str is correct - if player_name is, for example, Client8141723, then id_str is 8141723...
I have checked every line of my code, I don't have variables with the same name, or something like that, so what's wrong?

Last edited by Leonardo; 06/16/08 14:38.

"Things of the mind left untested by the senses are useless."