mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2026-10-11 09:48:03 +08:00
refactor!: globals (#717)
* refactor(globals): use macro's for to_json/from_json * refactor(globals): switch from global pointer to global instance
This commit is contained in:
1 parent
b74dd7516c
commit
ddddbd4efd
146 files changed
+1279
-1901
No files matched your search
@@ -24,7 +24,7 @@ namespace big
|
||||
const auto hash = static_cast<eRemoteEvent>(args[0]);
|
||||
const auto player_name = player->get_name();
|
||||
|
||||
const auto& notify = g->notifications.script_event_handler;
|
||||
const auto& notify = g.notifications.script_event_handler;
|
||||
|
||||
// detect pasted menus setting args[1] to something other than PLAYER_ID()
|
||||
if (*(int*)&args[1] != player->m_player_id && player->m_player_id != -1)
|
||||
@@ -37,7 +37,7 @@ namespace big
|
||||
switch (hash)
|
||||
{
|
||||
case eRemoteEvent::Bounty:
|
||||
if (g->protections.script_events.bounty)
|
||||
if (g.protections.script_events.bounty)
|
||||
{
|
||||
format_string(player_name, "Bounty", notify.bounty.log, notify.bounty.notify);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::CeoBan:
|
||||
if (g->protections.script_events.ceo_ban)
|
||||
if (g.protections.script_events.ceo_ban)
|
||||
{
|
||||
format_string(player_name, "Ceo Ban", notify.ceo_ban.log, notify.ceo_ban.notify);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::CeoKick:
|
||||
if (g->protections.script_events.ceo_kick)
|
||||
if (g.protections.script_events.ceo_kick)
|
||||
{
|
||||
format_string(player_name, "Ceo Kick", notify.ceo_kick.log, notify.ceo_kick.notify);
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::CeoMoney:
|
||||
if (g->protections.script_events.ceo_money)
|
||||
if (g.protections.script_events.ceo_money)
|
||||
{
|
||||
format_string(player_name, "Ceo Money", notify.ceo_money.log, notify.ceo_money.notify);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::ClearWantedLevel:
|
||||
if (g->protections.script_events.clear_wanted_level)
|
||||
if (g.protections.script_events.clear_wanted_level)
|
||||
{
|
||||
format_string(player_name, "Clear Wanted Level", notify.clear_wanted_level.log, notify.clear_wanted_level.notify);
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace big
|
||||
break;
|
||||
case eRemoteEvent::Crash:
|
||||
case eRemoteEvent::Crash2:
|
||||
if (g->protections.script_events.crash)
|
||||
if (g.protections.script_events.crash)
|
||||
{
|
||||
format_string(player_name, "TSE Crash", notify.crash.log, notify.crash.notify);
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace big
|
||||
case eRemoteEvent::NotificationMoneyBanked:
|
||||
case eRemoteEvent::NotificationMoneyRemoved:
|
||||
case eRemoteEvent::NotificationMoneyStolen:
|
||||
if (g->protections.script_events.fake_deposit)
|
||||
if (g.protections.script_events.fake_deposit)
|
||||
{
|
||||
format_string(player_name, "Fake Deposit", notify.fake_deposit.log, notify.fake_deposit.notify);
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::ForceMission:
|
||||
if (g->protections.script_events.force_mission)
|
||||
if (g.protections.script_events.force_mission)
|
||||
{
|
||||
format_string(player_name, "Force Mission", notify.force_mission.log, notify.force_mission.notify);
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::GiveCollectible:
|
||||
if (g->protections.script_events.switch_player_model)
|
||||
if (g.protections.script_events.switch_player_model)
|
||||
{
|
||||
if (args[2] == 8)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::GtaBanner:
|
||||
if (g->protections.script_events.gta_banner)
|
||||
if (g.protections.script_events.gta_banner)
|
||||
{
|
||||
format_string(player_name, "GTA Banner", notify.gta_banner.log, notify.gta_banner.notify);
|
||||
|
||||
@@ -128,13 +128,13 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::MCTeleport:
|
||||
if (g->protections.script_events.mc_teleport && args[3] <= 32)
|
||||
if (g.protections.script_events.mc_teleport && args[3] <= 32)
|
||||
{
|
||||
format_string(player_name, "Remote Teleport", notify.mc_teleport.log, notify.mc_teleport.notify);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (g->protections.script_events.crash && args[3] > 32)
|
||||
else if (g.protections.script_events.crash && args[3] > 32)
|
||||
{
|
||||
format_string(player_name, "TSE Crash", notify.crash.log, notify.crash.notify);
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::PersonalVehicleDestroyed:
|
||||
if (g->protections.script_events.personal_vehicle_destroyed)
|
||||
if (g.protections.script_events.personal_vehicle_destroyed)
|
||||
{
|
||||
format_string(player_name, "Personal Vehicle Destroyed", notify.personal_vehicle_destroyed.log, notify.personal_vehicle_destroyed.notify);
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::RemoteOffradar:
|
||||
if (g->protections.script_events.remote_off_radar)
|
||||
if (g.protections.script_events.remote_off_radar)
|
||||
{
|
||||
format_string(player_name, "Off Radar", notify.remote_off_radar.log, notify.remote_off_radar.notify);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::TSECommand:
|
||||
if (g->protections.script_events.rotate_cam && static_cast<eRemoteEvent>(args[2]) == eRemoteEvent::TSECommandRotateCam)
|
||||
if (g.protections.script_events.rotate_cam && static_cast<eRemoteEvent>(args[2]) == eRemoteEvent::TSECommandRotateCam)
|
||||
{
|
||||
format_string(player_name, "Rotate Cam", notify.rotate_cam.log, notify.rotate_cam.notify);
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::SendToCayoPerico:
|
||||
if (g->protections.script_events.send_to_location)
|
||||
if (g.protections.script_events.send_to_location)
|
||||
{
|
||||
format_string(player_name, "Send to Cayo Perico", notify.send_to_location.log, notify.send_to_location.notify);
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::SendToCutscene:
|
||||
if (g->protections.script_events.send_to_cutscene)
|
||||
if (g.protections.script_events.send_to_cutscene)
|
||||
{
|
||||
format_string(player_name, "Send to Cutscene", notify.send_to_cutscene.log, notify.send_to_cutscene.notify);
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace big
|
||||
{
|
||||
known_location = true;
|
||||
|
||||
if (g->protections.script_events.send_to_location)
|
||||
if (g.protections.script_events.send_to_location)
|
||||
{
|
||||
format_string(player_name, "Send to Beach", notify.send_to_location.log, notify.send_to_location.notify);
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace big
|
||||
{
|
||||
known_location = true;
|
||||
|
||||
if (g->protections.script_events.send_to_location)
|
||||
if (g.protections.script_events.send_to_location)
|
||||
{
|
||||
format_string(player_name, "Send to Cayo Perico", notify.send_to_location.log, notify.send_to_location.notify);
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace big
|
||||
break;
|
||||
}
|
||||
case eRemoteEvent::SoundSpam:
|
||||
if (g->protections.script_events.sound_spam)
|
||||
if (g.protections.script_events.sound_spam)
|
||||
{
|
||||
format_string(player_name, "Sound Spamn", notify.sound_spam.log, notify.sound_spam.notify);
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::Spectate:
|
||||
if (g->protections.script_events.spectate)
|
||||
if (g.protections.script_events.spectate)
|
||||
{
|
||||
format_string(player_name, "Spectate", notify.spectate.log, notify.spectate.notify);
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::Teleport:
|
||||
if (g->protections.script_events.force_teleport)
|
||||
if (g.protections.script_events.force_teleport)
|
||||
{
|
||||
format_string(player_name, "Apartment Invite", notify.force_teleport.log, notify.force_teleport.notify);
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::TransactionError:
|
||||
if (g->protections.script_events.transaction_error)
|
||||
if (g.protections.script_events.transaction_error)
|
||||
{
|
||||
format_string(player_name, "Transaction Error", notify.transaction_error.log, notify.transaction_error.notify);
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::VehicleKick:
|
||||
if (g->protections.script_events.vehicle_kick)
|
||||
if (g.protections.script_events.vehicle_kick)
|
||||
{
|
||||
format_string(player_name, "Vehicle Kick", notify.vehicle_kick.log, notify.vehicle_kick.notify);
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::ForceMission2:
|
||||
if (g->protections.script_events.force_mission)
|
||||
if (g.protections.script_events.force_mission)
|
||||
{
|
||||
format_string(player_name, "Force Mission", notify.force_mission.log, notify.force_mission.notify);
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::NetworkBail:
|
||||
if (g->protections.script_events.network_bail)
|
||||
if (g.protections.script_events.network_bail)
|
||||
{
|
||||
if (auto plyr = g_player_service->get_by_id(player->m_player_id))
|
||||
session::add_infraction(plyr, Infraction::TRIED_KICK_PLAYER);
|
||||
@@ -277,7 +277,7 @@ namespace big
|
||||
}
|
||||
break;
|
||||
case eRemoteEvent::TeleportToWarehouse:
|
||||
if (g->protections.script_events.teleport_to_warehouse)
|
||||
if (g.protections.script_events.teleport_to_warehouse)
|
||||
{
|
||||
format_string(player_name, "Teleport To Warehouse", notify.teleport_to_warehouse.log, notify.teleport_to_warehouse.notify);
|
||||
|
||||
@@ -287,7 +287,7 @@ namespace big
|
||||
case eRemoteEvent::StartActivity:
|
||||
{
|
||||
eActivityType activity = static_cast<eActivityType>(args[2]);
|
||||
if (g->protections.script_events.start_activity)
|
||||
if (g.protections.script_events.start_activity)
|
||||
{
|
||||
if (activity == eActivityType::Survival || activity == eActivityType::Mission || activity == eActivityType::Deathmatch || activity == eActivityType::BaseJump || activity == eActivityType::Race)
|
||||
{
|
||||
@@ -321,7 +321,7 @@ namespace big
|
||||
}
|
||||
// there are MANY more
|
||||
}
|
||||
else if (g->protections.script_events.crash && activity == eActivityType::Tennis)
|
||||
else if (g.protections.script_events.crash && activity == eActivityType::Tennis)
|
||||
{
|
||||
format_string(player_name, "TSE Crash (Start Tennis)", notify.crash.log, notify.crash.notify);
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace big
|
||||
break;
|
||||
}
|
||||
|
||||
if (g->debug.logs.script_event.logs && (!g->debug.logs.script_event.filter_player || g->debug.logs.script_event.player_id == player->m_player_id))
|
||||
if (g.debug.logs.script_event.logs && (!g.debug.logs.script_event.filter_player || g.debug.logs.script_event.player_id == player->m_player_id))
|
||||
{
|
||||
std::string script_args = "{ ";
|
||||
for (std::size_t i = 0; i < scripted_game_event->m_args_size; i++)
|
||||
|
||||
Reference in new issue
Block a user