diff --git a/Release/Plugins/RenX.Core.lib b/Release/Plugins/RenX.Core.lib index 3ed995c..0908f00 100644 Binary files a/Release/Plugins/RenX.Core.lib and b/Release/Plugins/RenX.Core.lib differ diff --git a/RenX.Core/RenX_Server.cpp b/RenX.Core/RenX_Server.cpp index af4c3ff..0c2f7da 100644 --- a/RenX.Core/RenX_Server.cpp +++ b/RenX.Core/RenX_Server.cpp @@ -358,6 +358,16 @@ bool RenX::Server::removePlayer(RenX::PlayerInfo *player) return RenX::Server::removePlayer(player->id); } +bool RenX::Server::giveCredits(int id, double credits) +{ + return RenX::Server::xRconVersion != 0 && RenX::Server::sock.send(Jupiter::StringS::Format("_x\x04%d%c%.4f\n", id, RenX::DelimC, credits)) > 0; +} + +bool RenX::Server::giveCredits(RenX::PlayerInfo *player, double credits) +{ + return RenX::Server::giveCredits(player->id, credits); +} + const Jupiter::ReadableString &RenX::Server::getPrefix() const { return RenX::Server::IRCPrefix; diff --git a/RenX.Core/RenX_Server.h b/RenX.Core/RenX_Server.h index 376ea25..49a480c 100644 --- a/RenX.Core/RenX_Server.h +++ b/RenX.Core/RenX_Server.h @@ -278,6 +278,24 @@ namespace RenX */ bool removePlayer(RenX::PlayerInfo *player); + /** + * @brief Gives a player additional credits, if the server supports it. + * + * @param id ID of the player to give credits to + * @param credits Credits to give to player + * @return True on success, false otherwise. + */ + bool giveCredits(int id, double credits); + + /** + * @brief Gives a player additional credits, if the server supports it. + * + * @param player Player to give credits to + * @param credits Credits to give to player + * @return True on success, false otherwise. + */ + bool giveCredits(RenX::PlayerInfo *player, double credits); + /** * @brief Fetches a server's IRC logging prefix. *