Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- 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 (i != playerId)
- {
- Ped pedId = PLAYER::GET_PLAYER_PED(i);
- if (ENTITY::DOES_ENTITY_EXIST(pedId))
- {
- std::string name = (char*)PLAYER::GET_PLAYER_NAME(i);
- uint32_t headDisplayId = UI::_0xBFEFE3321A3F5015(pedId, (Any*)"", 0, 0, (Any*)"", 0); // CREATE_PED_HEAD_DISPLAY
- if (featurePlayerHeadDisplay && UI::_0x4E929E7A5796FD26(headDisplayId))
- {
- UI::_0xDEA2B8283BAA3944(headDisplayId, (Any*)name.c_str()); // SET_HEAD_DISPLAY_STRING
- UI::_0x63BB75ABEDC1F6A0(headDisplayId, 0, 1); // SET_HEAD_DISPLAY_FLAG
- playerdb[i].head = headDisplayId;
- }
- 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);
- }
- 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>~s~ joined.";
- show_notification((char*)msg.c_str());
- }
- PED::SET_CAN_ATTACK_FRIENDLY(i, 1, 1);
- playerdb[i].name = name;
- playerCount++;
- }
- playerdb[i].ped = pedId;
- }
- }
- else if (playerdb[i].name != "")
- {
- if (featurePlayerNotifications)
- {
- std::string msg = "<C>" + playerdb[i].name + "</C>~s~ 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((Any*)&playerdb[i].blip);
- playerdb[i].name = "";
- playerCount--;
- }
- }
- }
- playerWasDisconnected = false;
- }
- else
- {
- playerWasDisconnected = true;
- playerCount = 0;
- if (trainer_switch_pressed())
- set_menu_showing(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement