Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // MESSAGE CONSTANTE :
  3.     global MSG_EnDanger = "MSG_EnDanger";
  4.     global MSG_EnemyToFocus = "MSG_EnemyToFocus";
  5.     global MSG_SpecialAction = "MSG_SpecialAction";
  6.  
  7. // NE PAS TOUCHER !
  8.     global _PROTECTION  = false;
  9. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. function SendMessage (MSG, target)
  12. {
  13.     var _OK = false;
  14.    
  15.     if (MSG === MSG_EnDanger && isAlive(target)) _OK = true;
  16.     if (MSG === MSG_EnemyToFocus && isAlive(target)) _OK = true;
  17.     if (MSG === MSG_SpecialAction /*&& A DEFINIR */) _OK = true;
  18.  
  19.     if (_OK) sendAll(MESSAGE_CUSTOM, [MSG,target]);
  20.     return _OK;
  21. }
  22.  
  23. function getMessageOfType (MSG) //Ne pas appeler cette fonction...
  24. {
  25.     if (_PROTECTION !== true) {debugE("Cette fonction ne dois pas être appelé directement, utiliser getLeeksInDanger / getEnemiesToFocus / getSpecialsActions à la place."); return null;}
  26.     else _PROTECTION = false;
  27.    
  28.     var List = [];
  29.     for (var msg in getMessages())
  30.     {
  31.         if (msg[2][0] == MSG) push(List, msg[2][1]);
  32.     }
  33.     return List;
  34. }
  35.  
  36. function getLeeksInDanger () {_PROTECTION = true; return getMessageOfType (MSG_EnDanger); }
  37. function getEnemiesToFocus () {_PROTECTION = true; return getMessageOfType (MSG_EnemyToFocus); }
  38. function getSpecialsActions () {_PROTECTION = true; return getMessageOfType (MSG_SpecialAction); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement