wip(Stats/Features): Pushing progress for stats & join message

This commit is contained in:
Yimura 2020-12-27 00:47:08 +01:00
parent bd02482ce2
commit b2034df79d
9 changed files with 80 additions and 0 deletions

View File

@ -13,6 +13,7 @@ namespace big
update_screen_sizes();
god_mode();
join_message();
never_wanted();
no_bike_fall();
no_idle_kick();

View File

@ -4,6 +4,7 @@
#include "structs/player.hpp"
#include "structs/temp.hpp"
#include "features/notify.hpp"
#include "features/stats.hpp"
#include "features/teleport.hpp"
namespace big
@ -24,6 +25,7 @@ namespace big
void script_func();
void god_mode();
void join_message();
void never_wanted();
void no_bike_fall();
void no_idle_kick();

View File

@ -0,0 +1,22 @@
#include "features.hpp"
namespace big
{
void features::join_message()
{
bool bJoinMessage = g_settings.options["join_message"].get<bool>();
if (bJoinMessage)
{
for (int i = 0; i < 32; i++) {
if (!g_players[i].is_online && ENTITY::DOES_ENTITY_EXIST(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i))) {
char joinMsg[64];
strcpy(joinMsg, g_players[i].name);
strcat(joinMsg, "is joining");
features::notify::above_map(joinMsg);
}
}
}
}
}

View File

@ -1,7 +1,17 @@
#include "stats.hpp"
#include "script.hpp"
namespace big::features
{
void stats::unlock_achievements()
{
for (int i = 1; i < 100; i++) {
PLAYER::GIVE_ACHIEVEMENT_TO_PLAYER(i);
script::get_current()->yield();
}
}
void stats::unlock_all()
{
QUEUE_JOB_BEGIN_CLAUSE()
@ -228,6 +238,8 @@ namespace big::features
strcat(str, tmp);
Hash hashs = MISC::GET_HASH_KEY(str);
STATS::STAT_SET_INT(hashs, -1, 1);
script::get_current()->yield();
}
for (int i = 0; i < 140; i++)
{
@ -245,6 +257,8 @@ namespace big::features
strcat(str, tmp);
Hash hashs = MISC::GET_HASH_KEY(str);
STATS::STAT_SET_INT(hashs, -1, 1);
script::get_current()->yield();
}
for (int i = 0; i < 26; i++)
{
@ -263,6 +277,8 @@ namespace big::features
strcat(str, tmp);
Hash hashs = MISC::GET_HASH_KEY(str);
STATS::STAT_SET_INT(hashs, -1, 1);
script::get_current()->yield();
}
for (int i = 0; i < 38; i++)
{
@ -280,6 +296,8 @@ namespace big::features
strcat(str, tmp);
Hash hashs = MISC::GET_HASH_KEY(str);
STATS::STAT_SET_INT(hashs, -1, 1);
script::get_current()->yield();
}
STATS::STAT_SET_INT(MISC::GET_HASH_KEY("MP1_SCRIPT_INCREASE_STAM"), 100, 1);
STATS::STAT_SET_INT(MISC::GET_HASH_KEY("MP1_SCRIPT_INCREASE_STRN"), 100, 1);

View File

@ -8,6 +8,7 @@ namespace big::features
class stats
{
public:
static void unlock_achievements();
static void unlock_all();
};
}

View File

@ -15,6 +15,7 @@ namespace big
tabbar::render_teleport();
tabbar::render_vehicle();
tabbar::render_network();
tabbar::render_misc();
tabbar::render_spawn();
ImGui::EndTabBar();
}

View File

@ -18,6 +18,7 @@ namespace big
static void render_teleport();
static void render_vehicle();
static void render_network();
static void render_misc();
static void render_spawn();
};

View File

@ -0,0 +1,33 @@
#include "tab_bar.hpp"
namespace big
{
void tabbar::render_misc()
{
if (ImGui::BeginTabItem("Misc"))
{
if (ImGui::Checkbox("Player Join Message", g_settings.options["join_message"].get<bool*>()))
g_settings.save();
ImGui::Separator();
if (ImGui::Button("Unlock Achievements"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::stats::unlock_achievements();
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Unlock All Stats"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
features::stats::unlock_all();
}QUEUE_JOB_END_CLAUSE
}
ImGui::EndTabItem();
}
}
}

View File

@ -14,6 +14,7 @@ namespace big
nlohmann::json default_options =
R"({
"god_mode": false,
"join_message": false,
"never_wanted": false,
"no_bike_fall": false,
"no_idle_kick": false,