[Command] Reduce the duration of toasts when successfull
I felt like 3 seconds is a little too long, especially when toggling noclip on and off repeatedly.
This commit is contained in:
parent
5ec469b117
commit
a9b7cb384f
@ -160,6 +160,10 @@ namespace Components
|
|||||||
{
|
{
|
||||||
AssertSize(Game::cmd_function_t, 24);
|
AssertSize(Game::cmd_function_t, 24);
|
||||||
|
|
||||||
|
static int toastDurationShort = 1000;
|
||||||
|
static int toastDurationMedium = 2500;
|
||||||
|
static int toastDurationLong = 5000;
|
||||||
|
|
||||||
// Disable native noclip command
|
// Disable native noclip command
|
||||||
Utils::Hook::Nop(0x474846, 5);
|
Utils::Hook::Nop(0x474846, 5);
|
||||||
|
|
||||||
@ -169,21 +173,21 @@ namespace Components
|
|||||||
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
||||||
{
|
{
|
||||||
Logger::Print("You are not hosting a match!\n");
|
Logger::Print("You are not hosting a match!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", 3000);
|
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Dvar::Var("sv_cheats").get<bool>())
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
||||||
{
|
{
|
||||||
Logger::Print("Cheats disabled!\n");
|
Logger::Print("Cheats disabled!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", 3000);
|
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::g_entities[clientNum].client->flags ^= Game::PLAYER_FLAG_NOCLIP;
|
Game::g_entities[clientNum].client->flags ^= Game::PLAYER_FLAG_NOCLIP;
|
||||||
|
|
||||||
Logger::Print("Noclip toggled\n");
|
Logger::Print("Noclip toggled\n");
|
||||||
Toast::Show("cardicon_abduction", "Success", "Noclip toggled", 3000);
|
Toast::Show("cardicon_abduction", "Success", "Noclip toggled", toastDurationShort);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("ufo", [](Command::Params*)
|
Command::Add("ufo", [](Command::Params*)
|
||||||
@ -192,21 +196,21 @@ namespace Components
|
|||||||
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
||||||
{
|
{
|
||||||
Logger::Print("You are not hosting a match!\n");
|
Logger::Print("You are not hosting a match!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", 3000);
|
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Dvar::Var("sv_cheats").get<bool>())
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
||||||
{
|
{
|
||||||
Logger::Print("Cheats disabled!\n");
|
Logger::Print("Cheats disabled!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", 3000);
|
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::g_entities[clientNum].client->flags ^= Game::PLAYER_FLAG_UFO;
|
Game::g_entities[clientNum].client->flags ^= Game::PLAYER_FLAG_UFO;
|
||||||
|
|
||||||
Logger::Print("UFO toggled\n");
|
Logger::Print("UFO toggled\n");
|
||||||
Toast::Show("cardicon_abduction", "Success", "UFO toggled", 3000);
|
Toast::Show("cardicon_abduction", "Success", "UFO toggled", toastDurationShort);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("setviewpos", [](Command::Params* params)
|
Command::Add("setviewpos", [](Command::Params* params)
|
||||||
@ -215,21 +219,21 @@ namespace Components
|
|||||||
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
if (!Game::CL_IsCgameInitialized() || clientNum >= 18 || clientNum < 0 || !Game::g_entities[clientNum].client)
|
||||||
{
|
{
|
||||||
Logger::Print("You are not hosting a match!\n");
|
Logger::Print("You are not hosting a match!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", 3000);
|
Toast::Show("cardicon_stop", "Error", "You are not hosting a match!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Dvar::Var("sv_cheats").get<bool>())
|
if (!Dvar::Var("sv_cheats").get<bool>())
|
||||||
{
|
{
|
||||||
Logger::Print("Cheats disabled!\n");
|
Logger::Print("Cheats disabled!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", 3000);
|
Toast::Show("cardicon_stop", "Error", "Cheats disabled!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params->length() != 4 && params->length() != 6)
|
if (params->length() != 4 && params->length() != 6)
|
||||||
{
|
{
|
||||||
Logger::Print("Invalid coordinate specified!\n");
|
Logger::Print("Invalid coordinate specified!\n");
|
||||||
Toast::Show("cardicon_stop", "Error", "Invalid coordinate specified!", 3000);
|
Toast::Show("cardicon_stop", "Error", "Invalid coordinate specified!", toastDurationMedium);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +254,7 @@ namespace Components
|
|||||||
|
|
||||||
// Logging that will spam the console and screen if people use cinematics
|
// Logging that will spam the console and screen if people use cinematics
|
||||||
//Logger::Print("Successfully teleported player!\n");
|
//Logger::Print("Successfully teleported player!\n");
|
||||||
//Toast::Show("cardicon_abduction", "Success", "You have been teleported!", 3000);
|
//Toast::Show("cardicon_abduction", "Success", "You have been teleported!", toastDurationShort);
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("openLink", [](Command::Params* params)
|
Command::Add("openLink", [](Command::Params* params)
|
||||||
|
Loading…
Reference in New Issue
Block a user