27.01.2011, 21:00
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.. )
Any help?
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;
}

