void main() { //reset_globals(); setGameInputToEnabled(true, true); setAirbrakeRelatedInputToBlocked(false, true); write_text_to_log_file("Setting up calls"); set_periodic_feature_call(update_features); write_text_to_log_file("Loading settings"); load_settings(); init_vehicle_feature(); write_text_to_log_file("Loaded settings OK"); // this creates a new locale based on the current application default // (which is either the one given on startup, but can be overriden with // std::locale::global) - then extends it with an extra facet that // controls numeric output. std::locale comma_locale(std::locale(), new comma_numpunct()); // tell cout to use our new locale. std::cout.imbue(comma_locale); set_status_text("~HUD_COLOUR_MENU_YELLOW~ENT ~HUD_COLOUR_WHITE~is ready!"); while (true) { if (trainer_switch_pressed()) { menu_beep(); set_menu_showing(true); process_main_menu(); set_menu_showing(false); } else if (airbrake_switch_pressed()) { menu_beep(); process_airbrake_menu(); } update_features(); WAIT(0); } }
void main() { set_periodic_feature_call(updateStuff); featurePlayerBlips = config->get_trainer_config()->setting_player_blips; featurePlayerHeadDisplay = config->get_trainer_config()->setting_player_head_display; featurePlayerBlipCone = config->get_trainer_config()->setting_player_blip_cone; featurePlayerNotifications = config->get_trainer_config()->setting_player_notifications; featureShowVoiceChatSpeaker = config->get_trainer_config()->setting_show_voice_chat_speaker; while (true) { if (is_menu_showing()) { menu_beep(0); process_main_menu(); set_menu_showing(false); } updateStuff(); WAIT(0); } }
void updateStuff() { if (NETWORK::NETWORK_IS_SESSION_STARTED()) { if (playerWasDisconnected) { NETWORK::NETWORK_SET_FRIENDLY_FIRE_OPTION(1); playerId = PLAYER::PLAYER_ID(); PED::SET_CAN_ATTACK_FRIENDLY(playerId, 1, 1); } std::string voice_status_msg = "Currently Talking:"; bool isVoiceChatRunning = false; for (int i = 0; i < MAX_PLAYERS; i++) { if (trainer_switch_pressed()) { // To increase chances of trainer switch key capture, set_menu_showing(true); // since this is a consuming function. return; } if (featureShowVoiceChatSpeaker && isVoiceChatRunning) update_status_text(); if (NETWORK::NETWORK_IS_PLAYER_CONNECTED(i)) { std::string name = (char*)PLAYER::GET_PLAYER_NAME(i); if (featureShowVoiceChatSpeaker && NETWORK::NETWORK_IS_PLAYER_TALKING(i)) { if (!isVoiceChatRunning) isVoiceChatRunning = true; voice_status_msg += "~n~" + name; } if (i != playerId) { Ped pedId = PLAYER::GET_PLAYER_PED(i); unsigned int headDisplayId = UI::_0xBFEFE3321A3F5015(pedId, (Any*)"", 0, 0, (Any*)"", 0); // CREATE_PED_HEAD_DISPLAY if (UI::_0x4E929E7A5796FD26(headDisplayId)) { playerdb[i].head = headDisplayId; if (featurePlayerHeadDisplay) UI::_0xDEA2B8283BAA3944(headDisplayId, (Any*)name.c_str()); // SET_HEAD_DISPLAY_STRING UI::_0x63BB75ABEDC1F6A0(headDisplayId, 0, 1); // SET_HEAD_DISPLAY_FLAG } if (playerWasDisconnected || !UI::DOES_BLIP_EXIST(playerdb[i].blip)) { if (featurePlayerBlips) { playerdb[i].blip = UI::ADD_BLIP_FOR_ENTITY(pedId); UI::SET_BLIP_COLOUR(playerdb[i].blip, 0); UI::SET_BLIP_SCALE(playerdb[i].blip, 0.8); if (featurePlayerBlipCone) UI::SET_BLIP_SHOW_CONE(playerdb[i].blip, 1); UI::SET_BLIP_NAME_TO_PLAYER_NAME(playerdb[i].blip, i); UI::SET_BLIP_CATEGORY(playerdb[i].blip, 7); } if (playerWasDisconnected || playerdb[i].name != name) // Making sure the player wasn't already here and only changed his ped (ex. skin change) { if (featurePlayerNotifications) { std::string msg = "<C>" + name + "</C> joined."; show_notification((char*)msg.c_str()); } PED::SET_CAN_ATTACK_FRIENDLY(i, 1, 1); playerdb[i].name = name; } playerdb[i].ped = pedId; } if (featurePlayerBlips) { Vehicle v = PED::GET_VEHICLE_PED_IS_IN(playerdb[i].ped, false); switch (VEHICLE::GET_VEHICLE_CLASS(v)) { case 14: UI::SET_BLIP_SPRITE(playerdb[i].blip, 410); break; //Boat case 15: UI::SET_BLIP_SPRITE(playerdb[i].blip, 422); break; //Helicopter case 16: UI::SET_BLIP_SPRITE(playerdb[i].blip, 423); break; //Airplane case 19: UI::SET_BLIP_SPRITE(playerdb[i].blip, 421); break; //Military } } } } else if (playerdb[i].name != "") { if (featurePlayerNotifications) { std::string msg = "<C>" + playerdb[i].name + "</C> left."; show_notification((char*)msg.c_str()); } if (UI::_0x4E929E7A5796FD26(playerdb[i].head)) UI::_0xDEA2B8283BAA3944(playerdb[i].head, (Any*)""); if (UI::DOES_BLIP_EXIST(playerdb[i].blip)) UI::REMOVE_BLIP(&playerdb[i].blip); playerdb[i].name = ""; } } playerWasDisconnected = false; if(isVoiceChatRunning) set_status_text(voice_status_msg); } else { playerWasDisconnected = true; if (trainer_switch_pressed()) set_menu_showing(true); } }