Würde gerne die Hitrate, die gesamten Schüsse und alle Treffer berechnen und Speichern - würde mich freuen wenn da mal jemand drüber schauen und mir sagen könnte, ob ich was falsch gemacht habe. In meiner Tabelle erhalte ich bei Shots und Hits Einträge wie "1318930000"..
//im enum//..
Float:Shots
Float:Hits,
Float:Hitrate,//...
//OnPlayerConnect
PlayerInfo[playerid][Hits] = 0.0;
PlayerInfo[playerid][Shots] = 0.0;
PlayerInfo[playerid][Hitrate] = 0.0;
//OnUserLogin
PlayerInfo[playerid][Shots] = cache_get_field_content_float(0, "shots");
PlayerInfo[playerid][Hits] = cache_get_field_content_float(0, "hits");
PlayerInfo[playerid][Hitrate] = cache_get_field_content_float(0, "hitrate");
//Save
Float:shots = PlayerInfo[playerid][Shots],
Float:hits = PlayerInfo[playerid][Hits],
Float:hitrate = PlayerInfo[playerid][Hitrate],
mysql_format(handle, query, sizeof(query), "UPDATE users SET shots = '%f', hits = '%f', hitrate = '%f' WHERE id = '%d'", shots, hits, hitrate, pID);mysql_pquery(handle, query);
//OnPlayerWeaponShot
PlayerInfo[playerid][Shots] += 1.0;
if(hittype == BULLET_HIT_TYPE_PLAYER){
PlayerInfo[playerid][Hits] += 1.0;
}
//Stats Rechnung + Anzeige
PlayerInfo[playerid][Hitrate] = PlayerInfo[playerid][Hits] * 100 / PlayerInfo[playerid][Shots];
new Float:hitrate = PlayerInfo[playerid][Hitrate];
Shots: %0.2f Hits: %0.2f Hitrate: %0.2f", floatround(shots), floatround(hits), floatround(hitrate));