SAMP_MySQL Big Problem
#1

Hi,
I've just startet working win MySQL in SAMP.
I use the Plugin from Adrenaline-Dj

For testing purposes I made 2 Commands.
The first one Saves the Name and the Password into the MySQL Database.
The second one compares the Password in the DB with the Password the User Typed in.

First CMD works fine.
But my Problem is that I can run the second CMD only once.
If I want to run the CMD a second time the Server crashes without any Error.

Код:
	if(strcmp(cmd, "/mysqlpwcheck", true) == 0)
	{
		samp_mysql_connect("--------", "-----", "-----");
		if(samp_mysql_connect("-------", "---------", "-------") == 1)
			{
				print("[MYSQL] Verbindung hergestellt! ");
			  tmp = strtok(cmdtext, idx);
				new name[MAX_PLAYER_NAME];
				new reihe[256];
				new pwcheck[128];
				new Pass[128],row[100], passmsg[128];
				new pw[100];
				
				GetPlayerName(playerid,name,sizeof(name));
				samp_mysql_select_db("samp_7115");
				format(pwcheck,sizeof(pwcheck),"SELECT `Password` FROM `User` WHERE `Username` = '%s'",name);
				samp_mysql_query(pwcheck);
				samp_mysql_store_result();
				samp_mysql_fetch_row(row);
				format(reihe, sizeof(reihe), "%s", row);
				print(reihe);
				samp_mysql_get_field("Password", Pass);
				strmid(pw, tmp, 0, strlen(cmdtext), 255);
				Encrypt(pw);

					if(!strcmp(pw, Pass, true) && strlen(tmp))
						{

						  format(passmsg, sizeof(passmsg), "So sieht dein PW gespeichert aus : %s", Pass);
							SendClientMessage(playerid, COLOR_YELLOW, "WOW! Du kennst dein PW noch :D");
							SendClientMessage(playerid, COLOR_YELLOW, passmsg);
							SendClientMessage(playerid, COLOR_YELLOW, "Wir kцnnen dein PW also nie 'im Original' sehen!");
							samp_mysql_close();
								if(samp_mysql_close() == 1)
									{
									print("[MYSQL] Verbindung getrennt!");
									}
				return 1;
			}
		else
			{
				SendClientMessage(playerid, COLOR_RED, "OMG! Du kennst dein Pw nich! -.-");
				samp_mysql_close();
					if(samp_mysql_close() == 1)
						{
							print("[MYSQL] Verbindung getrennt!");
						}

		return 1;
		}

	}
	else
		{
			print ("[MYSQL] Verbindung konnte nicht hergestellt werden! ");
		}
	}
Wheres the Problem?

Sorry for my bad english I'm from Germany.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)