Advertisement
moses89

mutator block ion nuke

Apr 17th, 2018
833
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. class Rx_blockIonNuke_Controller extends Rx_Controller;
  3.  
  4.  
  5. var PlayerController currentPlayer;
  6.  
  7.  
  8. //Aliex  - this for printing messages
  9.   function SendMessageToAllPlayers(string message, int timeOnScreen = 320)
  10. {
  11.     local Controller c;
  12.     foreach class'WorldInfo'.static.GetWorldInfo().AllControllers(class'Controller', c)
  13.     {
  14.         if ( c != None )
  15.             if ( Rx_Controller(c) != none )
  16.                 Rx_Controller(c).CTextMessage("[Test Server Message]\n" $ message,'LightGreen',timeOnScreen);
  17.     }
  18. }
  19.  
  20.  
  21. function int CheckAmountPlayers()
  22. {
  23.  local int retvalue;
  24.  local playerController c;
  25.   local int index;
  26.   foreach class'WorldInfo'.static.GetWorldInfo().AllControllers(class'playerController',c)
  27.   {
  28.     if(c != None)
  29.       if(Rx_Controller(c)!= none)
  30.       {
  31.         index+=1;
  32.       }
  33.   }
  34.  
  35.     `log("###@@@@@###@@@@ The index was "$index);
  36.     SendMessageToAllPlayers("The index is "$index,200);
  37.  
  38.     if(index < 20)
  39. {
  40.     retvalue=0;//means ion\nuke NOT aviable
  41.    
  42.     `log("index is smaller than 20");
  43.     SendMessageToAllPlayers("smaller than 20");
  44.    
  45. }
  46. else
  47. {
  48.     retvalue=1;//means ion\nuke aviable
  49.     `log("index is bigger than 20");
  50.     SendMessageToAllPlayers("bigger than 20");
  51. }
  52.  
  53.  
  54.     return retvalue;
  55. }
  56.  
  57.  
  58. function EquipNuke()
  59. {
  60.     local int value;
  61.     local string message;
  62.     message="Nope! No Super Weapons Allowed!";
  63.    
  64.     value=CheckAmountPlayers();
  65.  
  66.     if(value==0)
  67.     {//block ion\nuke
  68.        
  69.  
  70.     Rx_Controller(Owner).CTextMessage("[Test Server Message]\n" $ message,'Red',222);
  71.  
  72.     }
  73.  
  74.     else
  75.     {
  76.         super.EquipNuke();
  77.     }
  78.  
  79. }
  80.  
  81. function EquipION()
  82.  {
  83.  
  84. local int value;
  85. local string message;
  86. message="Nope! No Super Weapons Allowed!";
  87.     value=CheckAmountPlayers();
  88.  
  89. if(value==0)
  90.     {//block ion\nuke
  91.        
  92.  
  93.     Rx_Controller(Owner).CTextMessage("[Test Server Message]\n" $ message,'Red',222);
  94.  
  95.     }
  96.  
  97.     else
  98.     {
  99.         super.EquipION();
  100.     }
  101.  
  102. }
  103.  
  104.  
  105. exec function Mutate(string MutateString)
  106. {
  107. //activating in-game.   low number of players will rise the price of ion\nuke to 9999999. this will prevent purchasing.
  108.     CheckAmountPlayers();
  109.     super.Mutate(MutateString);
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement