Advertisement
Guest User

minigameCanDamage

a guest
Jun 25th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.35 KB | None | 0 0
  1.     function minigameCanDamage(%client, %victimObject)
  2.     {  
  3.         %minigame1 = getMinigameFromObject(%client);
  4.         %minigame2 = getMinigameFromObject(%victimObject);
  5.        
  6.         if(%client.isBot)
  7.         {
  8.             if(isObject(%client.spawnBrick))
  9.             {
  10.                 %minigameHost1 = %minigame1.owner;
  11.                
  12.                 if((%isHost1 = %client.spawnbrick.getGroup().client == %minigameHost1))
  13.                 {
  14.                     %isIncluded1 = %minigame1.useAllPlayersBricks;
  15.                     %botNum1 = 1;
  16.                     %botcount++;
  17.                 }
  18.             }
  19.    
  20.             %otherBotCount++;
  21.         }
  22.    
  23.         if(%victimObject.isBot)
  24.         {
  25.             if(isObject(%victimObject.spawnbrick))
  26.             {
  27.                 %minigameHost2 = %minigame2.owner;
  28.                
  29.                 if((%isHost2 = %victimObject.spawnbrick.getGroup().client == %minigameHost2))
  30.                 {
  31.                     %isIncluded2 = %minigame2.useAllPlayersBricks;
  32.                     %botnum2 = 1;
  33.                     %botcount++;
  34.                 }
  35.             }
  36.            
  37.             %otherBotCount++;      
  38.         }
  39.    
  40.         %type = %victimObject.getType();
  41.    
  42.         if(%miniGame2 != %minigame1 && getBL_IDFromObject(%victimObject) == getBL_IDFromObject(%client))
  43.         {
  44.             %doHack = 1;
  45.    
  46.             if(%victimObject.getType() & $TypeMasks::PlayerObjectType)
  47.                 if(%victimObject.getControllingClient() > 0)
  48.                     %doHack = 0;
  49.    
  50.             if(%doHack)
  51.                 %minigame2 = %minigame1;
  52.         }
  53.    
  54.         if($Server::LAN)
  55.         {
  56.             if(!isObject(%minigame1))
  57.                 return true;
  58.    
  59.             if(%type & $TypeMasks::PlayerObjectType)
  60.             {
  61.                 if(%victimObject.isBot || %client.isBot)
  62.                 {
  63.                     if(%minigame1 != %minigame2)
  64.                         return false;
  65.    
  66.                     if(%botCount == 2)
  67.                     {
  68.                         if((%isHost1 && %isHost2) || %isIncluded1 || %isIncluded2)
  69.                             return true;
  70.                        
  71.                         return false;
  72.                     }
  73.    
  74.                     if(%minigame1.botDamage)
  75.                     {
  76.                         if(%client.getClassName() $= "AIPlayer" && !%client.isBot)
  77.                         {
  78.                             %cIsPlayerVehicle = !%client.isBot;
  79.    
  80.                             if(%cIsPlayerVehicle && !%minigame1.vehicleDamage)
  81.                                 return false;
  82.                         }
  83.    
  84.                         if(!%otherBotCount)
  85.                             return true;
  86.    
  87.                         if(%botcount == 2)
  88.                         {
  89.                             if((%isHost1 || %isIncluded1) && (%isHost2 || %isIncluded2))
  90.                                 return true;
  91.                        
  92.                             return false;
  93.                         }
  94.    
  95.                         if(%botNum1)
  96.                         {
  97.                             %a = 1;
  98.                                
  99.                             if(%isHost[%a] || %isIncluded[%a])
  100.                                 return true;
  101.                             else
  102.                                 return false;
  103.                         }
  104.    
  105.                         if(%botNum2)
  106.                         {
  107.                             %a = 2;
  108.                                
  109.                             if(%isHost[%a] || %isIncluded[%a])
  110.                                 return true;
  111.                             else
  112.                                 return false;
  113.                         }
  114.    
  115.                         return true;                       
  116.                     }
  117.                     else
  118.                         return false;
  119.                 }
  120.                 else
  121.                 {
  122.                     if(isObject(%victimObject.client))
  123.                     {
  124.                         if(%minigame1 != %minigame2)
  125.                             return false;
  126.    
  127.                         if(%minigame1.weaponDamage)
  128.                             return true;
  129.                     }
  130.                     else
  131.                     {
  132.                         if(%minigame1.vehicleDamage)
  133.                             return true;
  134.                     }
  135.    
  136.                     return true;
  137.                 }
  138.             }
  139.             else if(%type & $TypeMasks::VehicleObjectType)
  140.             {
  141.                 if(%minigame1.vehicleDamage)
  142.                     return true;
  143.             }
  144.             else if(%type & $TypeMasks::fxbrickalwaysobjecttype)
  145.             {
  146.                 if(%minigame1.brickDamage)
  147.                     return true;
  148.             }
  149.             else
  150.             {
  151.                 if(%minigame1.weaponDamage)
  152.                     return true;
  153.             }
  154.    
  155.             return false;
  156.         }
  157.    
  158.         if(!isObject(%minigame1) && !isObject(%minigame2))
  159.             return -1;
  160.    
  161.         if(%minigame1 != %minigame2)
  162.             return false;
  163.    
  164.         if(!isObject(%minigame1))
  165.             return false;
  166.    
  167.         %ruleDamage = 0;
  168.        
  169.         if(%type & $TypeMasks::PlayerObjectType)
  170.         {
  171.             if(%victimObject.isBot || %client.isBot)
  172.             {
  173.                 if(%minigame1 != %minigame2)
  174.                     return false;
  175.    
  176.                 if(%botCount == 2)
  177.                 {
  178.                     if((%isHost1 && %isHost2) || %isIncluded1 || %isIncluded2)
  179.                         return true;
  180.                    
  181.                     return false;
  182.                 }
  183.    
  184.                 if(%minigame1.botDamage)
  185.                 {
  186.                     if(%client.getClassName() $= "AIPlayer" && !%client.isBot)
  187.                     {
  188.                         %cIsPlayerVehicle = !%client.isBot;
  189.    
  190.                         if(%cIsPlayerVehicle && !%minigame1.vehicleDamage)
  191.                             return false;
  192.                     }
  193.    
  194.                     if(!%otherBotCount)
  195.                         return true;
  196.    
  197.                     if(%botcount == 2)
  198.                     {
  199.                         if((%isHost1 || %isIncluded1) && (%isHost2 || %isIncluded2))
  200.                             return true;
  201.                    
  202.                         return false;
  203.                     }
  204.    
  205.                     if(%botNum1)
  206.                     {
  207.                         %a = 1;
  208.                            
  209.                         if(%isHost[%a] || %isIncluded[%a])
  210.                             return true;
  211.                         else
  212.                             return false;
  213.                     }
  214.    
  215.                     if(%botNum2)
  216.                     {
  217.                         %a = 2;
  218.                            
  219.                         if(%isHost[%a] || %isIncluded[%a])
  220.                             return true;
  221.                         else
  222.                             return false;
  223.                     }
  224.    
  225.                     return true;                       
  226.                 }
  227.                 else
  228.                     return false;
  229.             }
  230.             else
  231.             {
  232.                 if(isObject(%victimObject.client))
  233.                 {
  234.                     if(%minigame1.weaponDamage)
  235.                         if(%victimObject.client == %client)
  236.                             if(%minigame1.selfdamage)
  237.                                 return true;
  238.                             else
  239.                                 return false;
  240.                         else
  241.                             return true;
  242.                     else
  243.                         return false;
  244.                 }
  245.                 else
  246.                     if(%minigame1.vehicleDamage)
  247.                         %ruleDamage = 1;
  248.    
  249.                 return true;
  250.             }
  251.         }
  252.         else if(%type & $TypeMasks::VehicleObjectType)
  253.         {
  254.             if(%minigame1.vehicleDamage)
  255.                 %ruleDamage = 1;
  256.         }
  257.         else if(%type & $TypeMasks::fxbrickalwaysobjecttype)
  258.         {
  259.             if(%minigame1.brickDamage)
  260.                 %ruleDamage = 1;
  261.         }
  262.         else
  263.         {
  264.             if(%minigame1.weaponDamage)
  265.                 %ruleDamage = 1;
  266.         }
  267.    
  268.         if(%ruleDamage == 0)
  269.             return false;
  270.    
  271.         if(%minigame1.useallplayersbricks)
  272.             return true;
  273.         else
  274.         {
  275.             %victimBL_ID = getBL_IDFromObject(%victimObject);
  276.            
  277.             if(%victimBL_ID == %minigame1.owner.getBLID())
  278.                 return true;
  279.         }
  280.            
  281.         return false;
  282.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement