Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.42 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Collections.Generic;
  5.  
  6. using Plus.HabboHotel.GameClients;
  7. using Plus.Communication.Packets.Outgoing.Inventory.Purse;
  8.  
  9. namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator
  10. {
  11. class GiveCommand : IChatCommand
  12. {
  13. public string PermissionRequired
  14. {
  15. get { return "command_give"; }
  16. }
  17.  
  18. public string Parameters
  19. {
  20. get { return "%username% %type% %amount%\n--------------------------------------------------------------"; }
  21. }
  22.  
  23. public string Description
  24. {
  25. get { return ""; }
  26. }
  27.  
  28. public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
  29. {
  30. if (Params.Length == 1)
  31. {
  32. Session.SendWhisper("Entrer un type de monnaie! (coins, duckets, diamonds, gotw)");
  33. return;
  34. }
  35.  
  36. GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
  37. if (Target == null)
  38. {
  39. Session.SendWhisper("Désolé, cet utilisateur n'existe pas");
  40. return;
  41. }
  42.  
  43. string UpdateVal = Params[2];
  44. switch (UpdateVal.ToLower())
  45. {
  46. case "coins":
  47. case "credits":
  48. {
  49. if (!Session.GetHabbo().GetPermissions().HasCommand("command_give_coins"))
  50. {
  51. Session.SendWhisper("Mince! tu n'as pas les droits pour utilisé cette commande!");
  52. break;
  53. }
  54. else
  55. {
  56. int Amount;
  57. if (int.TryParse(Params[3], out Amount))
  58. {
  59. Target.GetHabbo().Credits = Target.GetHabbo().Credits += Amount;
  60. Target.SendMessage(new CreditBalanceComposer(Target.GetHabbo().Credits));
  61.  
  62. if (Target.GetHabbo().Id != Session.GetHabbo().Id)
  63. Target.SendNotification(Session.GetHabbo().Username + " t'as donner " + Amount.ToString() + " crédit(s)!");
  64. Session.SendWhisper("Tu viens de donner " + Amount + " crédit(s) à " + Target.GetHabbo().Username + "!");
  65. break;
  66. }
  67. else
  68. {
  69. Session.SendWhisper("Mince! le montant est invalide!");
  70. break;
  71. }
  72. }
  73. }
  74.  
  75. case "pixels":
  76. case "duckets":
  77. {
  78. if (!Session.GetHabbo().GetPermissions().HasCommand("command_give_pixels"))
  79. {
  80. Session.SendWhisper("Mince! tu n'as pas les droits pour utilisé cette commande!");
  81. break;
  82. }
  83. else
  84. {
  85. int Amount;
  86. if (int.TryParse(Params[3], out Amount))
  87. {
  88. Target.GetHabbo().Duckets += Amount;
  89. Target.SendMessage(new HabboActivityPointNotificationComposer(Target.GetHabbo().Duckets, Amount));
  90.  
  91. if (Target.GetHabbo().Id != Session.GetHabbo().Id)
  92. Target.SendNotification(Session.GetHabbo().Username + " t'as donner " + Amount.ToString() + " ducket(s)!");
  93. Session.SendWhisper("Tu viens de donner " + Amount + " ducket(s) à " + Target.GetHabbo().Username + "!");
  94. break;
  95. }
  96. else
  97. {
  98. Session.SendWhisper("Mince! le montant est invalide!");
  99. break;
  100. }
  101. }
  102. }
  103.  
  104. case "diamonds":
  105. {
  106. if (!Session.GetHabbo().GetPermissions().HasCommand("command_give_diamonds"))
  107. {
  108. Session.SendWhisper("Mince! tu n'as pas les droits pour utilisé cette commande!");
  109. break;
  110. }
  111. else
  112. {
  113. int Amount;
  114. if (int.TryParse(Params[3], out Amount))
  115. {
  116. Target.GetHabbo().Diamonds += Amount;
  117. Target.SendMessage(new HabboActivityPointNotificationComposer(Target.GetHabbo().Diamonds, Amount, 5));
  118.  
  119. if (Target.GetHabbo().Id != Session.GetHabbo().Id)
  120. Target.SendNotification(Session.GetHabbo().Username + " t'as donner " + Amount.ToString() + " diamants!");
  121. Session.SendWhisper("Tu viens de donner " + Amount + " diamants à " + Target.GetHabbo().Username + "!");
  122. break;
  123. }
  124. else
  125. {
  126. Session.SendWhisper("Mince, le montant est invalide!");
  127. break;
  128. }
  129. }
  130. }
  131.  
  132. case "gotw":
  133. case "gotwpoints":
  134. {
  135. if (!Session.GetHabbo().GetPermissions().HasCommand("command_give_gotw"))
  136. {
  137. Session.SendWhisper("Mince! tu n'as pas les droits pour utilisé cette commande!");
  138. break;
  139. }
  140. else
  141. {
  142. int Amount;
  143. if (int.TryParse(Params[3], out Amount))
  144. {
  145. Target.GetHabbo().GOTWPoints = Target.GetHabbo().GOTWPoints + Amount;
  146. Target.SendMessage(new HabboActivityPointNotificationComposer(Target.GetHabbo().GOTWPoints, Amount, 103));
  147.  
  148. if (Target.GetHabbo().Id != Session.GetHabbo().Id)
  149. Target.SendNotification(Session.GetHabbo().Username + " t'as donner " + Amount.ToString() + " GOTW Point(s)!");
  150. Session.SendWhisper("Tu viens de donner " + Amount + " GOTW point(s) à " + Target.GetHabbo().Username + "!");
  151. break;
  152. }
  153. else
  154. {
  155. Session.SendWhisper("Mince, le montant est invalide!");
  156. break;
  157. }
  158. }
  159. }
  160. default:
  161. Session.SendWhisper("'" + UpdateVal + "' n'est pas valide!");
  162. break;
  163. }
  164. }
  165. }
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement