/register and /login bug
#1

Well basically I am trying to get login and register command working on my script. For some reason, I can compile it but when I try to connect to game and register an account it says "SERVER: Unknown Command" when I choose a password. I really don't know what's wrong. Here is my login and register script

Register Command:

Код:
	if(!strcmp(cmdtext, "/register", true))
	{
	  new name[MAX_PLAYER_NAME];
	  tmp = strtok(cmdtext, idx);
	  GetPlayerName(playerid, name, sizeof(name));
	  if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_PINK, "Use /register (Password)");
	  format(string,sizeof(string),"Accounts/%s.ini",name);
	  if(!dini_Exists(string))
			{
			  dini_Create(string);
			  dini_Set(string, "Password", tmp);
				dini_IntSet(string, "Cash", 25000);
				dini_IntSet(string, "Kills", 0);
				dini_IntSet(string, "Deaths", 0);
				dini_IntSet(string, "Score", 0);
				dini_IntSet(string, "AdminLevel", 0);
				PlayerInfo[playerid][Cash] = 25000;
				GivePlayerMoney(playerid, 25000);
			  SendClientMessage(playerid, COLOR_LLGREEN, "Account created, now type /login to log in.");
			  GetPlayerName(playerid, name, sizeof(name));
			  printf("%s(%d) has registered a account!", name, playerid);
			}
			else
			{
			  SendClientMessage(playerid, COLOR_ASKQ, "Account already exists, please choose another one!");
			}
		return 1;
	}
Login Command:

Код:
	if(!strcmp(cmdtext,"/login",true))
 	{
 	  if(PlayerInfo[playerid][Logged]) return SendClientMessage(playerid, COLOR_PINK, "You've already logged in!");
 	  new name[MAX_PLAYER_NAME];
		GetPlayerName( playerid, name, 20);
		format(string, sizeof(string), "Accounts/%s.ini", name);
		if(!dini_Exists(string)) return SendClientMessage(playerid, COLOR_LRED, "This account doesn't exit, /register one now!");
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_PINK, "Use /login (Password)");
		if(strcmp(dini_Get(string, "Password"), tmp, true) == 1) return SendClientMessage(playerid, COLOR_LRED, "Login Failed!");
		PlayerInfo[playerid][Cash] = dini_Int(string, "Cash");
		PlayerInfo[playerid][Kills] = dini_Int(string, "Kills");
		PlayerInfo[playerid][Deaths] = dini_Int(string, "Deaths");
		PlayerInfo[playerid][Score] = dini_Int(string, "Score");
		PlayerInfo[playerid][AdminLevel] = dini_Int(string, "AdminLevel");
		GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
 		PlayerInfo[playerid][Logged] = 1;
 		SendClientMessage(playerid, COLOR_LLGREEN, "You're now logged in!");
 		if (PlayerInfo[playerid][AdminLevel] > 0)
		{
			format(string, sizeof(string), "You logged in as Admin level %d.",PlayerInfo[playerid][AdminLevel]);
			SendClientMessage(playerid, COLOR_YELLOW2,string);
		}
 		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)