Advertisement
Golden_Rus

Untitled

Jul 15th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.54 KB | None | 0 0
  1. void updateStuff()
  2. {
  3.     if (NETWORK::NETWORK_IS_SESSION_STARTED())
  4.     {
  5.         if (playerWasDisconnected) {
  6.             NETWORK::NETWORK_SET_FRIENDLY_FIRE_OPTION(1);
  7.             playerId = PLAYER::PLAYER_ID();
  8.             PED::SET_CAN_ATTACK_FRIENDLY(playerId, 1, 1);
  9.         }
  10.  
  11.         for (int i = 0; i < MAX_PLAYERS; i++)
  12.         {
  13.             if (trainer_switch_pressed()) { // To increase chances of trainer switch key capture,
  14.                 set_menu_showing(true);     // since this is a consuming function.
  15.                 return;
  16.             }
  17.  
  18.             if (i != playerId)
  19.             {
  20.                 Ped pedId = PLAYER::GET_PLAYER_PED(i);
  21.                 if (ENTITY::DOES_ENTITY_EXIST(pedId))
  22.                 {
  23.                     std::string name = (char*)PLAYER::GET_PLAYER_NAME(i);
  24.                     uint32_t headDisplayId = UI::_0xBFEFE3321A3F5015(pedId, (Any*)"", 0, 0, (Any*)"", 0); // CREATE_PED_HEAD_DISPLAY
  25.  
  26.                     if (featurePlayerHeadDisplay && UI::_0x4E929E7A5796FD26(headDisplayId))
  27.                     {
  28.                         UI::_0xDEA2B8283BAA3944(headDisplayId, (Any*)name.c_str()); // SET_HEAD_DISPLAY_STRING
  29.                         UI::_0x63BB75ABEDC1F6A0(headDisplayId, 0, 1); // SET_HEAD_DISPLAY_FLAG
  30.                         playerdb[i].head = headDisplayId;
  31.                     }
  32.  
  33.                     if (playerWasDisconnected || !UI::DOES_BLIP_EXIST(playerdb[i].blip))
  34.                     {
  35.                         if (featurePlayerBlips)
  36.                         {
  37.                             playerdb[i].blip = UI::ADD_BLIP_FOR_ENTITY(pedId);
  38.                             UI::SET_BLIP_COLOUR(playerdb[i].blip, 0);
  39.                             UI::SET_BLIP_SCALE(playerdb[i].blip, 0.8);
  40.                             if (featurePlayerBlipCone)
  41.                                 UI::SET_BLIP_SHOW_CONE(playerdb[i].blip, 1);
  42.                             UI::SET_BLIP_NAME_TO_PLAYER_NAME(playerdb[i].blip, i);
  43.                         }
  44.  
  45.                         if (playerWasDisconnected || playerdb[i].name != name) // Making sure the player wasn't already here and only changed his ped (ex. skin change)
  46.                         {
  47.                             if (featurePlayerNotifications)
  48.                             {
  49.                                 std::string msg = "<C>" + name + "</C>~s~ joined.";
  50.                                 show_notification((char*)msg.c_str());
  51.                             }
  52.  
  53.                             PED::SET_CAN_ATTACK_FRIENDLY(i, 1, 1);
  54.                             playerdb[i].name = name;
  55.                             playerCount++;
  56.                         }
  57.                         playerdb[i].ped = pedId;
  58.                     }
  59.                 }
  60.                 else if (playerdb[i].name != "")
  61.                 {
  62.                     if (featurePlayerNotifications)
  63.                     {
  64.                         std::string msg = "<C>" + playerdb[i].name + "</C>~s~ left.";
  65.                         show_notification((char*)msg.c_str());
  66.                     }
  67.  
  68.                     if (UI::_0x4E929E7A5796FD26(playerdb[i].head))
  69.                         UI::_0xDEA2B8283BAA3944(playerdb[i].head, (Any*)"");
  70.                     if (UI::DOES_BLIP_EXIST(playerdb[i].blip))
  71.                         UI::REMOVE_BLIP((Any*)&playerdb[i].blip);
  72.  
  73.                     playerdb[i].name = "";
  74.                     playerCount--;
  75.                 }
  76.             }
  77.         }
  78.         playerWasDisconnected = false;
  79.     }
  80.     else
  81.     {
  82.         playerWasDisconnected = true;
  83.         playerCount = 0;
  84.  
  85.         if (trainer_switch_pressed())
  86.             set_menu_showing(true);
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement