/login bag
#1

If i do the command /login when i didnt register
its crash my samp server

Here is my /login and /register system:


Код:
//-------------------------------[Login]--------------------------------------------------------------------------
	if (strcmp(cmd, "/login", true) ==0 || strcmp(cmd, "/l", true) == 0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    new tmppass[64];
			if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /login [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			//Encrypt(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
	}
	//-----------Register---------------
	if (strcmp(cmd, "/register", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in.");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new namestring = strfind(sendername, "_", true);
			if(namestring == -1)
			{
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: Your name is not acceptable.");
				SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Hint: Your name must be in the format Firstname_Lastname.");
				Kick(playerid);
				return 1;
			}
			else
			{
				GetPlayerName(playerid, sendername, sizeof(sendername));
				//format(string, sizeof(string), "%s.ini", sendername);
				new sqlaccountexists = MySQLCheckAccount(sendername);
				//new File: hFile = fopen(string, io_read);
				if (sqlaccountexists != 0)
				{
					SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: There is already a citizen with that name.");
					//fclose(hFile);
					return 1;
				}
	    	new tmppass[64];
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /register [password]");
					return 1;
				}
				strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
				//Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
			}
		}
		return 1;
	}
Reply


Messages In This Thread
/login bag - by Ben147 - 23.07.2009, 06:56
Re: /login bag - by Abernethy - 23.07.2009, 10:33
Re: /login bag - by Ben147 - 23.07.2009, 16:52
Re: /login bag - by yezizhu - 23.07.2009, 17:14
Re: /login bag - by Ben147 - 23.07.2009, 17:20
Re: /login bag - by yezizhu - 23.07.2009, 17:28
Re: /login bag - by Ben147 - 27.07.2009, 07:55
Re: /login bag - by yezizhu - 27.07.2009, 08:51
Re: /login bag - by Ben147 - 27.07.2009, 10:46
Re: /login bag - by yezizhu - 27.07.2009, 14:15

Forum Jump:


Users browsing this thread: 2 Guest(s)