centerPrint.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. function centerPrintAll( %message, %time, %lines )
  23. {
  24. if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
  25. %lines = 1;
  26. %count = ClientGroup.getCount();
  27. for (%i = 0; %i < %count; %i++)
  28. {
  29. %cl = ClientGroup.getObject(%i);
  30. if( !%cl.isAIControlled() )
  31. commandToClient( %cl, 'centerPrint', %message, %time, %lines );
  32. }
  33. }
  34. function bottomPrintAll( %message, %time, %lines )
  35. {
  36. if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
  37. %lines = 1;
  38. %count = ClientGroup.getCount();
  39. for (%i = 0; %i < %count; %i++)
  40. {
  41. %cl = ClientGroup.getObject(%i);
  42. if( !%cl.isAIControlled() )
  43. commandToClient( %cl, 'bottomPrint', %message, %time, %lines );
  44. }
  45. }
  46. //-------------------------------------------------------------------------------------------------------
  47. function centerPrint( %client, %message, %time, %lines )
  48. {
  49. if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
  50. %lines = 1;
  51. commandToClient( %client, 'CenterPrint', %message, %time, %lines );
  52. }
  53. function bottomPrint( %client, %message, %time, %lines )
  54. {
  55. if( %lines $= "" || ((%lines > 3) || (%lines < 1)) )
  56. %lines = 1;
  57. commandToClient( %client, 'BottomPrint', %message, %time, %lines );
  58. }
  59. //-------------------------------------------------------------------------------------------------------
  60. function clearCenterPrint( %client )
  61. {
  62. commandToClient( %client, 'ClearCenterPrint');
  63. }
  64. function clearBottomPrint( %client )
  65. {
  66. commandToClient( %client, 'ClearBottomPrint');
  67. }
  68. //-------------------------------------------------------------------------------------------------------
  69. function clearCenterPrintAll()
  70. {
  71. %count = ClientGroup.getCount();
  72. for (%i = 0; %i < %count; %i++)
  73. {
  74. %cl = ClientGroup.getObject(%i);
  75. if( !%cl.isAIControlled() )
  76. commandToClient( %cl, 'ClearCenterPrint');
  77. }
  78. }
  79. function clearBottomPrintAll()
  80. {
  81. %count = ClientGroup.getCount();
  82. for (%i = 0; %i < %count; %i++)
  83. {
  84. %cl = ClientGroup.getObject(%i);
  85. if( !%cl.isAIControlled() )
  86. commandToClient( %cl, 'ClearBottomPrint');
  87. }
  88. }