SA-MP Forums Archive
C-MySQL Loading Floats... Help please. - 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: C-MySQL Loading Floats... Help please. (/showthread.php?tid=217384)



C-MySQL Loading Floats... Help please. - 1337connor - 27.01.2011

PlayerInfo[playerid][HP] = CMySQL_Float(PlayerName(playerid),"HP");

This will load as 0 even though it's there..
Urr.
I have edited it because of StrickenKid's plugin being bugged.... ( [Thu Jan 27 15:11:30 2011] Error (0): Function: mysql_fetch_field could not find field name: "HP". When it exists.. )
Код:
stock Float:CMySQL_Float(Username[], Field[],ThreadID = -1, extraID = -1) {
    mysql_real_escape_string(ACCOUNT_TABLE, SQLEscapeX[0]);
	mysql_real_escape_string(USERNAME_FIELD, SQLEscapeX[1]);
	mysql_real_escape_string(Username, SQLEscapeX[2]);
	mysql_real_escape_string(Field, SQLEscapeX[3]);
    if(ThreadID != -1 && extraID != -1) {
	 	format(SQLEscapeX[5], 128, "SELECT %s FROM %s WHERE %s = '%s'", SQLEscapeX[1], SQLEscapeX[0], SQLEscapeX[1], SQLEscapeX[2]);
   		mysql_query(SQLEscapeX[5], ThreadID, extraID);
   		return 0.0;
	}
	format(SQLEscapeX[5], 128, "SELECT %s FROM %s WHERE %s = '%s'", SQLEscapeX[1], SQLEscapeX[0], SQLEscapeX[1], SQLEscapeX[2]);
	mysql_query(SQLEscapeX[5], ThreadID, extraID);
	mysql_store_result();
	new Storage[30];
	#if defined MYSQL_PLUGIN
		mysql_fetch_field_row(Storage, Field);
	#else
	    mysql_fetch_string(Storage);
	#endif
	new Float:StoredResult = floatstr(Storage);
	mysql_free_result();
	return StoredResult;
}
Any help?


Re: C-MySQL Loading Floats... Help please. - 1337connor - 27.01.2011

Bump


Re: C-MySQL Loading Floats... Help please. - PeteShag - 27.01.2011

Quote:

b) Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 48 hours old, and it needs to have useful information about your problem.

The message you have entered is too short. Please lengthen your message to at least 4 characters