generated from AfonsoCMSousa/CPP-Template
Fix: small fix
This commit is contained in:
parent
b39c74f294
commit
4e5a9ec837
@ -179,16 +179,27 @@ void *db_write_thread(void *arg) {
|
||||
if (packet.message_type == ACSP_LAP_COMPLETED) {
|
||||
printf("[+] Lap completed by (%d).\n", packet.cars_colided[0]);
|
||||
|
||||
const char *get_rank_query = "UPDATE users SET user_rank = user_rank + 20 WHERE driver_guid = $1;";
|
||||
const char *get_rank_query = "UPDATE users SET user_rank = user_rank + $1 WHERE driver_guid = $2;";
|
||||
|
||||
const char *driver_guid = packet.cars[packet.cars_colided[0]].driver_GUID;
|
||||
const char *get_rank_paramValues[1] = {driver_guid};
|
||||
|
||||
char rank_buf[32];
|
||||
|
||||
PGresult *rank_res = PQexecParams(conn, get_rank_query, 1, nullptr, get_rank_paramValues, nullptr, nullptr, 0);
|
||||
// snprintf(rank_buf, sizeof(rank_buf), "%d",
|
||||
// (packet.cars[packet.cars_colided[0]].total_laps_completed + 1)
|
||||
// / (packet.cars[packet.cars_colided[0]].cuts + 1) * 10
|
||||
// );
|
||||
|
||||
const char *get_rank_paramValues[2];
|
||||
get_rank_paramValues[0] = "10";
|
||||
get_rank_paramValues[1] = driver_guid;
|
||||
|
||||
|
||||
PGresult *rank_res = PQexecParams(conn, get_rank_query, 2, nullptr, get_rank_paramValues, nullptr, nullptr, 0);
|
||||
if (PQresultStatus(rank_res) != PGRES_TUPLES_OK) {
|
||||
printf("[!] Failed to UPDATE driver Rank for GUID %s: %s", driver_guid, PQerrorMessage(conn));
|
||||
} else {
|
||||
printf("[+] Increase driver rank +20\n");
|
||||
printf("[+] Increase driver rank\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user