Advertisement
Guest User

Untitled

a guest
May 26th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.57 KB | None | 0 0
  1. function miniGameCanDamage(%client, %victimObject)
  2. {
  3.     %miniGame1 = getMiniGameFromObject(%client);
  4.     %miniGame2 = getMiniGameFromObject(%victimObject);
  5.     if (%client.isBot)
  6.     {
  7.         if (isObject(%client.spawnBrick))
  8.         {
  9.             %minigameHost1 = %miniGame1.owner;
  10.             %isHost1 = %client.spawnBrick.getGroup().client == %minigameHost1;
  11.             %isIncluded1 = %miniGame1.UseAllPlayersBricks;
  12.             %botNum1 = 1;
  13.             %botCount = %botCount + 1.0;
  14.         }
  15.         else
  16.         {
  17.             %otherBotCount = %otherBotCount + 1.0;
  18.         }
  19.     }
  20.     if (%victimObject.isBot)
  21.     {
  22.         if (isObject(%victimObject.spawnBrick))
  23.         {
  24.             %minigameHost2 = %miniGame2.owner;
  25.             %isHost2 = %victimObject.spawnBrick.getGroup().client == %minigameHost2;
  26.             %isIncluded2 = %miniGame2.UseAllPlayersBricks;
  27.             %botNum2 = 1;
  28.             %botCount = %botCount + 1.0;
  29.         }
  30.         else
  31.         {
  32.             %otherBotCount = %otherBotCount + 1.0;
  33.         }
  34.     }
  35.     %type = %victimObject.getType();
  36.     if (%miniGame2 != %miniGame1 && getBL_IDFromObject(%client) == getBL_IDFromObject(%victimObject))
  37.     {
  38.         %doHack = 1;
  39.         if (%victimObject.getType() & $TypeMasks::PlayerObjectType)
  40.         {
  41.             if (%victimObject.getControllingClient() > 0.0)
  42.             {
  43.                 %doHack = 0;
  44.             }
  45.         }
  46.         if (%doHack)
  47.         {
  48.             %miniGame2 = %miniGame1;
  49.         }
  50.     }
  51.     if ($Server::LAN)
  52.     {
  53.         if (!isObject(%miniGame1))
  54.         {
  55.             return 1;
  56.         }
  57.         if (%type & $TypeMasks::PlayerObjectType)
  58.         {
  59.             if (%victimObject.isBot || %client.isBot)
  60.             {
  61.                 if (%miniGame1 != %miniGame2)
  62.                 {
  63.                     return 0;
  64.                 }
  65.                 if (%botCount == 2.0)
  66.                 {
  67.                     if (%isHost1 && %isHost2 || %isIncluded1 || %isIncluded2)
  68.                     {
  69.                         return 1;
  70.                     }
  71.                     else
  72.                     {
  73.                         return 0;
  74.                     }
  75.                 }
  76.                 if (%miniGame1.BotDamage)
  77.                 {
  78.                     %cIsPlayerVehicle = %client.getClassName() $= "AIPlayer" && !%client.isBot;
  79.                     if (%cIsPlayerVehicle && !%miniGame1.VehicleDamage)
  80.                     {
  81.                         return 0;
  82.                     }
  83.                     if (%otherBotCount)
  84.                     {
  85.                         return 1;
  86.                     }
  87.                     if (%botCount == 2.0)
  88.                     {
  89.                         if (%isHost1 && %isHost2 || %isIncluded1 || %isIncluded2)
  90.                         {
  91.                             return 1;
  92.                         }
  93.                         else
  94.                         {
  95.                             return 0;
  96.                         }
  97.                     }
  98.                     if (%botNum1)
  99.                     {
  100.                         %a = 1;
  101.                         if (%isHost[%a] || %isIncluded[%a])
  102.                         {
  103.                             return 1;
  104.                         }
  105.                         else
  106.                         {
  107.                             return 0;
  108.                         }
  109.                     }
  110.                     if (%botNum2)
  111.                     {
  112.                         %a = 2;
  113.                         if (%isHost[%a] || %isIncluded[%a])
  114.                         {
  115.                             return 1;
  116.                         }
  117.                         else
  118.                         {
  119.                             return 0;
  120.                         }
  121.                     }
  122.                     return 1;
  123.                 }
  124.                 else
  125.                 {
  126.                     return 0;
  127.                 }
  128.             }
  129.             else
  130.             {
  131.                 if (isObject(%victimObject.client))
  132.                 {
  133.                     if (%miniGame1 != %miniGame2)
  134.                     {
  135.                         return 0;
  136.                     }
  137.                     if (%miniGame1.WeaponDamage)
  138.                     {
  139.                         return 1;
  140.                     }
  141.                 }
  142.                 else
  143.                 {
  144.                     if (%miniGame1.VehicleDamage)
  145.                     {
  146.                         return 1;
  147.                     }
  148.                 }
  149.             }
  150.         }
  151.         else
  152.         {
  153.             if (%type & $TypeMasks::VehicleObjectType)
  154.             {
  155.                 if (%miniGame1.VehicleDamage)
  156.                 {
  157.                     return 1;
  158.                 }
  159.             }
  160.             else
  161.             {
  162.                 if (%type & $TypeMasks::FxBrickAlwaysObjectType)
  163.                 {
  164.                     if (%miniGame1.BrickDamage)
  165.                     {
  166.                         return 1;
  167.                     }
  168.                 }
  169.                 else
  170.                 {
  171.                     if (%miniGame1.WeaponDamage)
  172.                     {
  173.                         return 1;
  174.                     }
  175.                 }
  176.             }
  177.         }
  178.         return 0;
  179.     }
  180.     if (!isObject(%miniGame1) && !isObject(%miniGame2))
  181.     {
  182.         return -1.0;
  183.     }
  184.     if (%miniGame1 != %miniGame2)
  185.     {
  186.         return 0;
  187.     }
  188.     if (!isObject(%miniGame1))
  189.     {
  190.         return 0;
  191.     }
  192.     %ruleDamage = 0;
  193.     if (%type & $TypeMasks::PlayerObjectType)
  194.     {
  195.         if (%victimObject.isBot || %client.isBot)
  196.         {
  197.             if (%botCount == 2.0)
  198.             {
  199.                 if (%isHost1 && %isHost2 || %isIncluded1 || %isIncluded2)
  200.                 {
  201.                     return 1;
  202.                 }
  203.                 else
  204.                 {
  205.                     return 0;
  206.                 }
  207.             }
  208.             if (%miniGame1.BotDamage)
  209.             {
  210.                 %cIsPlayerVehicle = %client.getClassName() $= "AIPlayer" && !%client.isBot;
  211.                 if (%cIsPlayerVehicle && !%miniGame1.VehicleDamage)
  212.                 {
  213.                     return 0;
  214.                 }
  215.                 if (%otherBotCount)
  216.                 {
  217.                     return 1;
  218.                 }
  219.                 if (%botCount == 2.0)
  220.                 {
  221.                     if (%isHost1 && %isHost2 || %isIncluded1 || %isIncluded2)
  222.                     {
  223.                         return 1;
  224.                     }
  225.                     else
  226.                     {
  227.                         return 0;
  228.                     }
  229.                 }
  230.                 if (%botNum1)
  231.                 {
  232.                     %a = 1;
  233.                     if (%isHost[%a] || %isIncluded[%a])
  234.                     {
  235.                         return 1;
  236.                     }
  237.                     else
  238.                     {
  239.                         return 0;
  240.                     }
  241.                 }
  242.                 if (%botNum2)
  243.                 {
  244.                     %a = 2;
  245.                     if (%isHost[%a] || %isIncluded[%a])
  246.                     {
  247.                         return 1;
  248.                     }
  249.                     else
  250.                     {
  251.                         return 0;
  252.                     }
  253.                 }
  254.                 return 1;
  255.             }
  256.             else
  257.             {
  258.                 return 0;
  259.             }
  260.         }
  261.         else
  262.         {
  263.             if (isObject(%victimObject.client))
  264.             {
  265.                 if (%miniGame1.WeaponDamage)
  266.                 {
  267.                     if (%victimObject.client == %client)
  268.                     {
  269.                         if (%miniGame1.SelfDamage)
  270.                         {
  271.                             return 1;
  272.                         }
  273.                         else
  274.                         {
  275.                             return 0;
  276.                         }
  277.                     }
  278.                     else
  279.                     {
  280.                         return 1;
  281.                     }
  282.                 }
  283.                 else
  284.                 {
  285.                     return 0;
  286.                 }
  287.             }
  288.             else
  289.             {
  290.                 if (%miniGame1.VehicleDamage)
  291.                 {
  292.                     %ruleDamage = 1;
  293.                 }
  294.             }
  295.         }
  296.     }
  297.     else
  298.     {
  299.         if (%type & $TypeMasks::VehicleObjectType)
  300.         {
  301.             if (%miniGame1.VehicleDamage)
  302.             {
  303.                 %ruleDamage = 1;
  304.             }
  305.         }
  306.         else
  307.         {
  308.             if (%type & $TypeMasks::FxBrickAlwaysObjectType)
  309.             {
  310.                 if (%miniGame1.BrickDamage)
  311.                 {
  312.                     %ruleDamage = 1;
  313.                 }
  314.             }
  315.             else
  316.             {
  317.                 if (%miniGame1.WeaponDamage)
  318.                 {
  319.                     %ruleDamage = 1;
  320.                 }
  321.             }
  322.         }
  323.     }
  324.     if (%ruleDamage == 0.0)
  325.     {
  326.         return 0;
  327.     }
  328.     if (%miniGame1.UseAllPlayersBricks)
  329.     {
  330.         return 1;
  331.     }
  332.     else
  333.     {
  334.         %victimBL_ID = getBL_IDFromObject(%victimObject);
  335.         if (%victimBL_ID == %miniGame1.owner.getBLID())
  336.         {
  337.             return 1;
  338.         }
  339.     }
  340.     return 0;
  341. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement