Help with /login CMD
#1

Ok this is my /login cmd:
Код:
if (strcmp("/login", cmd, true) == 0)
	{
		if(RestartTimer != DONT_RESTART)
		{
			format(string, sizeof(string), "The Server will be restarting, untill then login has been disabled.");
			SendClientMessage(playerid, COLOR_LIGHTRED, string);
			return 1;
		}

		if(gPlayerLogged[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
			return 1;
		}
		if(strcount(cmdtext, ' ') != 2)
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /login [password]");
			return 1;
		}
		if(PlayerInfo[playerid][pSQLId] == INVALID_SQL_ID)
		{
			SendClientMessage(playerid, COLOR_YELLOW, "You dont have an account. Please register by using /register [password]");
			return 1;
		}

		new inputhash[50];
		new checkhash[33];
		new cmdstring[64];
		new rawcheckhash[99];
		inputhash = MD5_Hash(strtok(cmdtext, idx));
		strmid(checkhash,PlayerInfo[playerid][pPassword],0,strlen(PlayerInfo[playerid][pPassword]),sizeof(checkhash));
    	strmid(rawcheckhash,PlayerInfo[playerid][pPassword],0,strlen(PlayerInfo[playerid][pPassword]),sizeof(checkhash));

		//printf("RAW CHECK HASH: %s",rawcheckhash);
		//printf("CHECK HASH: %s",checkhash);
		//printf("INPUT HASH: %s",inputhash);

    if (strfind(checkhash, inputhash, true) != -1)

		{
			gPlayerLogged[playerid] = 1;
			//printf("%s has entered his password",PlayerInfo[playerid][pName]);
			SendClientMessage(playerid, COLOR_WHITE,"Please hold while we log you in...");
			format (cmdstring, sizeof(cmdstring), "/xlogin %s", checkhash);
      CallRemoteFunction("OnPlayerCommandText", "is", playerid, cmdstring);
			// new timer for login -> spawn
			SetTimerEx("SpawnPlayerEx",5000,0,"i",playerid);

		}



		else
		{
			SendClientMessage(playerid, COLOR_RED, "ERROR: Password does not match your name.");
		}
		return 1;
	}
As you see, I am using the next lines:
Код:
format (cmdstring, sizeof(cmdstring), "/xlogin %s", checkhash);
      CallRemoteFunction("OnPlayerCommandText", "is", playerid, cmdstring);
I have 2 account systems here, to log into one I have to /login and then /xlogin to log into the seconds one (The same with /register and /xregister)
Now my question is how to script that when I type /login [pass] it will save this pass and auto write /xlogin [the same pass]??
If I put this code as my /login CMD, its log into the server with 1 account, but its write "incorrect password" after the login with the first.

Can someone fix this thing for me please? I really need this help,
Thanks
Reply
#2

Anyone please?
Reply
#3

Hey guys I need the same help, I need it for double the /register [(pass), but its the same please help
Reply
#4

please help me i need this thing also for my mode!!
i have the same problem
Reply
#5

Код:
if (strcmp(cmd, "/login", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    new tmppass[64];
			if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /login [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			Encrypt(tmppass);
			OnPlayerLogin(playerid,tmppass);
		}
		return 1;
	}
	if (strcmp(cmd, "/register", true) ==0 )
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(gPlayerLogged[playerid] == 1)
			{
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "%s.ini", sendername);
			new File: hFile = fopen(string, io_read);
			if (hFile)
			{
				SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one.");
				fclose(hFile);
				return 1;
			}
	    new tmppass[64];
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /register [password]");
				return 1;
			}
			strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
			Encrypt(tmppass);
			OnPlayerRegister(playerid,tmppass);
		}
		return 1;
	}
try this

its taken from the godfather, but it should work okay.



has both /register and /login
DanielBurridge
Reply
#6

Dude its not an error or somethin like that, It just I need a help to make an auto /xregister [same Pass] when I type only /register [pass]
Please help!
Reply
#7

Quote:
Originally Posted by tomnidi
Dude its not an error or somethin like that, It just I need a help to make an auto /xregister [same Pass] when I type only /register [pass]
Please help!
what? you want an auto login?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)