C-MySQL Loading Floats... Help please.
#1

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?
Reply
#2

Bump
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)