SA-MP Forums Archive
MySQL House Problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL House Problem. (/showthread.php?tid=180610)



MySQL House Problem. - Gforcez - 02.10.2010

Hello, Iam busy with a MySQL Housing system, But i have a problem...,
When the server shuts down, The houses get saved, But..

It returns everything in the Houses table too 0.0,
Here's my UpdateHouses:

Код:
UpdateHouses()
{
	RefreshMySQL();
	
	new string[512];
    for(new i; i < MAX_HOUSES; i++)
	{
 		format(string, sizeof(string), "UPDATE `houses` SET hDiscription='%s', hEnterX='%.4f', hEnterY='%.4f', hEnterZ='%.4f', hExitX='%.4f' WHERE hID=%d", HouseInfo[i][hDiscription], HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], HouseInfo[i][hExitX], HouseInfo[i][hID]);
        mysql_query(string);
 		format(string, sizeof(string), "UPDATE `houses` SET hExitY='%.4f', hExitZ='%.4f', hVecPosX='%.4f', hVecPosY='%.4f', hVecPosZ='%.4f' WHERE hID=%d", HouseInfo[i][hExitY], HouseInfo[i][hExitZ], HouseInfo[i][hVecPosX], HouseInfo[i][hVecPosY], HouseInfo[i][hVecPosZ], HouseInfo[i][hID]);
        mysql_query(string);
 		format(string, sizeof(string), "UPDATE `houses` SET hVecColor1='%d', hVecColor2='%d', hInt='%d', hVir='%d', hPrice='%d' WHERE hID=%d", HouseInfo[i][hVecColor1], HouseInfo[i][hVecColor2], HouseInfo[i][hInt], HouseInfo[i][hVir], HouseInfo[i][hPrice] , HouseInfo[i][hID]);
        mysql_query(string);
 		format(string, sizeof(string), "UPDATE `houses` SET hOwned='%d', hOwner='%s', hLocked='%d' WHERE hID=%d", HouseInfo[i][hOwned], HouseInfo[i][hOwner], HouseInfo[i][hLocked], HouseInfo[i][hID]);
        mysql_query(string);
	}
	mysql_free_result();
}
Maybe one of you guys know the problem... :S

Greetings, Gforcez


Re: MySQL House Problem. - Scenario - 02.10.2010

I didn't spend a lot of time revising your code as it's just too little to understand the way you're getting you system to work. However, are you sure you have everything correct in the MySQL database? If you have defined the default values, it could cause a problem...


Re: MySQL House Problem. - Gforcez - 02.10.2010

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I didn't spend a lot of time revising your code as it's just too little to understand the way you're getting you system to work. However, are you sure you have everything correct in the MySQL database? If you have defined the default values, it could cause a problem...
i can place a Screen of the MySQL database :P

Here it is:

Click Here!


Re: MySQL House Problem. - Sergei - 02.10.2010

Why 4 queries? Do it in only one. And use '' only for strings.