Disable Cheats (APlayerController) or Disallow Cheats (AGameModeBase) ???

How can I disable cheats for a controller without having to recreate the client controller? I need to leave it disabled by default, since this starts enabled by default.

// Fill out your copyright notice in the Description page of Project Settings.

#include "CheatActivation.h"
#include "GameFramework/GameSession.h"
#include "GameFramework/GameModeBase.h"
#include "Runtime/Engine/Public/TimerManager.h"
#include "Kismet/GameplayStatics.h"

void UCheatActivation::SetCheatActivation(APlayerController* Controlador, AGameModeBase* CurrentGameMode)
{
	if (CurrentGameMode != NULL && Controlador != NULL)
	{
		CurrentGameMode->AllowCheats(Controlador);
		Controlador->EnableCheats();
	}
}

There isn’t a Disable Cheats or Disallow Cheats();

You can destroy the CheatManager in order to disable it.

if(PlayerController->CheatManager)
{
	PlayerController->CheatManager->ConditionalBeginDestroy();
	PlayerController->CheatManager = nullptr;
}
1 Like