MySql Problem
#1

Well i have been having some troubles with MySql getting info from user files and giving it to people, i havent edited it at all, i was in the server with other people and i restarted many times (updating stuff) then i went afk for about 5 mins and SA-MP crashed and i got some xfire messages saying everyone had lost cash score admin etc, so i went thru and added print("1") thru the mysql part where it gives everyone their stats and here is where the prints stopped
pawn Код:
SendClientMessage(playerid, 0x009600AA, "Welcome back, You have been automaticlly logged into your account.");
print("1"); //last print that was in my logs
            if(mysql_fetch_row(line)) //Fetches the line
            {
can someone help me please
Reply
#2

Line being what?
Reply
#3

not sure why that matters

Код:
1371            SendClientMessage(playerid, 0x009600AA, "Welcome back, You have been automaticlly logged into your account.");
1372print("1");
1373			if(mysql_fetch_row(line)) //Fetches the line
1374			{
Reply
#4

Your telling us yourt having an issue with SQL,

In your SQL code your fetching a row Called "Line"

We need to know what that line is in order to see if that may be teh confliciting code.
Reply
#5

here

Код:
        if(mysql_num_rows() != 0) // If the players IP is the same in the DB
        {
print("1");
            new line[750];
print("1");
            logged[playerid] = 1; //Sets the logged variable to 1
print("1");
            registered[playerid] = 1;
print("1");
            SendClientMessage(playerid, 0x009600AA, "Welcome back, You have been automaticlly logged into your account.");
print("1");
			if(mysql_fetch_row(line)) //Fetches the line
			{
print("1");
                   new data[4][50]; //The data strings
print("1");
                   new data2[13];
print("1");
                   sscanf(line, "p|dssdddddssdddddddd", data2[0], data[0], data[1], data2[1], data2[2], data2[3], data2[4], data2[5], data[2], data[3], data2[6], data2[7], data2[12], data2[8], data2[9], data2[10], data2[11], data2[12]); //Splits the line with sscanf
print("1");
				   Admin[playerid] = data2[0];
print("1");
                   SetPlayerScore(playerid, data2[4]); //Sets players score
print("1");
                   ResetPlayerMoney(playerid); //Resets the players cash
print("1");
                   GivePlayerMoney(playerid, data2[5]); //Sets players cash
print("1");
                   new loginmessage[120];
print("1");
					logged[playerid] = 1;
print("1");
					if(Admin[playerid] >= 1)
					{
print("1");
					format(loginmessage, sizeof(loginmessage), "[FF]Bot: Administrator %s Has connected to Finest Freeroam", Pname);
print("1");
					SendClientMessageToAll(blue, loginmessage);
print("1");
					}
					else
					{
print("1");
					format(loginmessage, sizeof(loginmessage), "[FF]Bot: Player %s Has connected to Finest Freeroam", Pname);
print("1");
					SendClientMessageToAll(WHITE, loginmessage);
print("1");
					}
print("1");
                   mysql_free_result();
print("1");
               }
        }
        if(!mysql_num_rows())
        {
print("1");
            SendClientMessage(playerid, 0x009600AA, "This account is registered, please login"); //User is registered but IP does not match
print("1");
			ShowPlayerDialog(playerid, 15000, DIALOG_STYLE_INPUT , "Login", "This account is registered, please login", "OK", "Cancel");
print("1");
        }
	//}
    else
    {
print("1");
    	ShowPlayerDialog(playerid, 14600, DIALOG_STYLE_INPUT , "Register", "This account is not registered, please register!", "OK", "Cancel");
print("1");
        SendClientMessage(playerid, 0x009600AA, "This account is not registered, please register!"); // User is not registed
print("1");
        registered[playerid] = 0;
print("1");
    }
print("1");
    mysql_free_result();
print("1");
	Teleport[playerid] = 1;
print("1");
	if(Admin[playerid] < 9) ShowPlayerDialog(playerid,535,DIALOG_STYLE_MSGBOX,"****Finest FreeRoam SERVER RULES****"," * Do Not Cheat/hack \n * Do Not Car Jack \n * Do not beg to be admin \n * Respect all players regardless \n * Do Not Advertise \n * Do not kill in stunt zones. \n * Visit our website at \n www.finestfreeroam.co.cc \n for more information","Agree","Decline");
print("1");
	AllowPlayerTeleport( playerid, 1 );
print("1");
	Teleport[playerid] = 1;
print("1");
	SendClientMessage(playerid,0xE60000FF,"Welcome To Finest FreeRoam!");
print("1");
	SendClientMessage(playerid,0xE60000FF,"For commands, type /cmds");
print("1");
 	SendClientMessage(playerid,0xE60000FF,"To tele somewhere, type /teles");
print("1");
    SendClientMessage(playerid,0xE60000FF,"If you need help, type /help");
print("1");
	PlayerPlaySound(playerid, 1184, 0.0, 0.0, 0.0);
print("1");
	GivePlayerMoney(playerid, 10000);
print("1");
	PlayerWantedLevel[playerid] = 0;
print("1");
    mysql_free_result();
print("1");
 	return 1;
}
Hope it help alot :P
Reply
#6

sorry for early bump, but i fixed it and i have another question, do i have to connect to the database multiple times? (meaning put it in a callback and put a timer repeating on it) or do i just have to connect to it once?, im not exactly sure, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)