MYSQL Register
#1

For some reason, when I register in the game it doesnt create the row with the player data like it should. I have to keep registering. Its something to do with the "INSERT" line.
Anyone that can help?

Here is my code:
Код:
case DIALOG_REGISTER:
	    {
	        if(response)
	        {
			    if(strlen(inputtext) == 0)
			    {
			        new IP[16], str[128], string[168];
			        GetPlayerIp(playerid, IP, 16);
			        format(string, sizeof(string), "Welcome to Legion of Los Angeles, %s \n\n IP Address: %s \n\n You may register an account by entering a desired password here:", GetName(playerid), IP);
		            ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, str, string, "Register", "Cancel");
				}
				else
				{
				    new EscapedText[60], Query[168];
				    new skin = 1+random(298);
				    mysql_real_escape_string(inputtext, EscapedText);
				    format(Query, sizeof(Query), "INSERT INTO playerdata (Name, Password, Cash, Bank, Level, PosX, PosY, PosZ, AdminLevel) VALUES ('%s', MD5('%s'), 5000, 10000, 1, 1780.1759, -1933.6698, 13.3859, 0)", GetName(playerid), EscapedText);
				    mysql_query(Query);
				    SendClientMessage(playerid, -1, "You have successfully registered.");
				    GivePlayerMoney(playerid, 5000);
				    SetPlayerScore(playerid, 1);
				    SetSpawnInfo(playerid, 0, skin, 1780.1759, -1933.6698, 13.3859, 356.5534, 0, 0, 0, 0, 0, 0);
    				SpawnPlayer(playerid);
				    
				}
			}
		}
Thanks
Reply
#2

Bigger query?
Reply
#3

pawn Код:
format(Query, sizeof(Query), "INSERT INTO `playerdata` (`Name`, `Password`, `Cash`, `Bank`, `Level`, `PosX`, `PosY`, `PosZ`, `AdminLevel`) VALUES ('%s', MD5('%s'), '5000', '10000', '1', '1780.1759', '-1933.6698', '13.3859', '0')", GetName(playerid), EscapedText);
Try this but, have you made the table in the database?
Reply
#4

Quote:

Bigger query?

That helped thanks, Cant believe I didnt think of that
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)