Commands

From Ark & Atlas Server API
Jump to: navigation, search

Go Back: Plugin_Development

Chat Commands

void TestCMD(AShooterPlayerController* shooter_controller, FString* message, int mode)
{
	if (!shooter_controller->PlayerStateField()) return;
	Log::GetLog()->warn("Test Chat Command Called: {}", message->ToString());
}

Adding a Chat Command

ArkApi::GetCommands().AddChatCommand("/test", &TestCMD);

Removing a Chat Command

ArkApi::GetCommands().RemoveChatCommand("/test");

Console Commands

void TestConsoleCMD(APlayerController* player_controller, FString* message, bool write_to_log)
{
	AShooterPlayerController* player = static_cast<AShooterPlayerController*>(player_controller);
	if (!shooter_controller->PlayerStateField()) return;
	Log::GetLog()->warn("Test Console Command Called: {}", message->ToString());
}

Adding a Console Command

ArkApi::GetCommands().AddConsoleCommand("test", &TestConsoleCMD);

Removing a Console Command

ArkApi::GetCommands().RemoveConsoleCommand("test");

RCON Commands

void TestRconCMD(RCONClientConnection* rcon_connection, RCONPacket* rcon_packet, UWorld* /*unused*/)
{
	FString reply = FString::Format(L"Test RCON Command Called: {}", rcon_packet->Body);
	rcon_connection->SendMessageW(rcon_packet->Id, 0, &reply);
}

Adding a Rcon Command

ArkApi::GetCommands().AddRconCommand("test", &TestRconCMD);

Removing a Rcon Command

ArkApi::GetCommands().RemoveRconCommand("test");

Go Back: Plugin_Development