fix: a player's own messages have to be sent for that player

The die request, the smash request, the loaded notice, chat commands
and the racing pickup notice were handled for whichever object they
named. They are now only handled for the player that sent them, or for
the vehicle that player drives where the client sends them for it. A
racing pickup also has to be an object of a race track that is not a
player, a vehicle or the zone's own object.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 13:06:27 -06:00
parent f170b46a5e
commit 081e26ded8
6 changed files with 57 additions and 0 deletions

View File

@@ -105,6 +105,12 @@ void CheatDetection::ReportCheat(User* user, const SystemAddress& sysAddr, const
va_end(args);
}
bool CheatDetection::IsSendersPlayer(const LWOOBJID& id, const SystemAddress& sysAddr) {
// The player themselves, or the player that possesses the object
const auto* const entity = GetPossessedEntity(id);
return entity && entity->IsPlayer() && entity->GetSystemAddress() == sysAddr;
}
bool CheatDetection::VerifyLwoobjidIsSender(const LWOOBJID& id, const SystemAddress& sysAddr, const CheckType checkType, const char* messageIfNotSender, ...) {
// Get variables we'll need for the whole function
bool invalidPacket = false;

View File

@@ -24,6 +24,15 @@ namespace CheatDetection {
*/
bool VerifyLwoobjidIsSender(const LWOOBJID& id, const SystemAddress& sysAddr, const CheckType checkType, const char* messageIfNotSender, ...);
void ReportCheat(User* user, const SystemAddress& sysAddr, const char* messageIfNotSender, ...);
/**
* @brief Whether an object is the player at a system address or the object that player possesses, such as their vehicle.
* Unlike VerifyLwoobjidIsSender this is false for every other object, so it is for messages only a player sends about themselves.
*
* @param id The object ID a message was sent for
* @param sysAddr The system address which sent the message
*/
bool IsSendersPlayer(const LWOOBJID& id, const SystemAddress& sysAddr);
};
#endif //!__CHEATDETECTION__H__