Possible bug regarding default value of cash

This commit is contained in:
2025-07-19 02:28:42 +03:00
parent d2c215df36
commit 3a4bf72bcc

View File

@@ -54,12 +54,13 @@ inline std::string getUserBalance(const dpp::snowflake userid) {
if (balance.empty()) { if (balance.empty()) {
addUserToDatabase(userid); addUserToDatabase(userid);
balance = "0"; execSQL("SELECT CASH FROM MONEY WHERE UID=" + userid.str(),
} else { &balance); // We are rerunning it cus if the default starting cash
std::uint8_t begining = balance.find(':') + 1; // changes I might forget to change it here
balance = balance.substr(begining, balance.find(';') - begining);
} }
return balance; std::uint8_t begining = balance.find(':') + 1;
return balance.substr(begining, balance.find(';') - begining);
} }
inline void addUserToDatabase(const dpp::snowflake userid) { inline void addUserToDatabase(const dpp::snowflake userid) {