Advertisement
Guest User

Cached & Clean | FactionManager | Snippet

a guest
Oct 31st, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.77 KB | None | 0 0
  1.  
  2.         public static void AcceptFaction(string AvatarName, string FactionName)
  3.         {
  4.             var grabAvatarbyUsername = MercuryEnvironment.GetGame().GetClientManager().GetClientByUsername(AvatarName);
  5.             var grabAvatarsbyClient = MercuryEnvironment.GetGame().GetClientManager().clients.Values;
  6.             var grabFactionbyOwner = Factions[AvatarName];
  7.  
  8.             if (grabAvatarbyUsername.GetHabbo().Minecraft.FactionInvite != "No Invitation")
  9.             {
  10.                 grabAvatarbyUsername.GetHabbo().Minecraft.FactionName = FactionName;
  11.                 grabAvatarbyUsername.SendWhisper("You have accepted the invite to the faction `" + FactionName + "`");
  12.  
  13.                 foreach (GameClient Client in grabAvatarsbyClient)
  14.                 {
  15.                     if (Client.GetHabbo().Minecraft.FactionName == FactionName)
  16.                     {
  17.                         if (!Factions.TryGetValue(FactionName.ToLower(), out grabFactionbyOwner))
  18.                         {
  19.                             Client.SendNotif(grabAvatarbyUsername.GetHabbo().Username + " has joined your faction! \n Be sure to give them a warm welcome!");
  20.                         }
  21.                         else
  22.                         {
  23.                             Client.SendNotif(grabAvatarbyUsername.GetHabbo().Username + " has accepted your invitation to join `" + FactionName + "`");
  24.                             return;
  25.                         }
  26.                     }
  27.  
  28.                 }
  29.             }
  30.         }
  31.  
  32.         public static void DeclineFaction(string AvatarName, string FactionName)
  33.         {
  34.             var grabAvatarbyUsername = MercuryEnvironment.GetGame().GetClientManager().GetClientByUsername(AvatarName);
  35.             var grabAvatarsbyClient = MercuryEnvironment.GetGame().GetClientManager().clients.Values;
  36.             var grabFactionbyOwner = Factions[AvatarName];
  37.  
  38.             if (grabAvatarbyUsername.GetHabbo().Minecraft.FactionInvite != "No Invitation")
  39.             {
  40.                 grabAvatarbyUsername.GetHabbo().Minecraft.FactionName = FactionName;
  41.                 grabAvatarbyUsername.SendWhisper("You have declined the invite to the faction `" + FactionName + "`");
  42.  
  43.                 foreach (GameClient Client in grabAvatarsbyClient)
  44.                 {
  45.                     if (Client.GetHabbo().Minecraft.FactionName == FactionName)
  46.                     {
  47.                         if (Factions.TryGetValue(FactionName.ToLower(), out grabFactionbyOwner))
  48.                         {
  49.                             Client.SendNotif(grabAvatarbyUsername.GetHabbo().Username + " has declined your invitation to join `" + FactionName + "`");
  50.                             return;
  51.                         }
  52.                     }
  53.                 }
  54.             }
  55.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement