New command [UBEREMU] :givedrink and fix :online

Results 1 to 7 of 7
  1. #1
    Enthusiast dimitri54480 is offline
    MemberRank
    Feb 2011 Join Date
    44Posts

    New command [UBEREMU] :givedrink and fix :online

    Hi,
    I find a code in iEmulator by jmmc v2

    Go to Misc/ChatCommandHandler.cs

    before case "pickall":

    ADD

    Code:
    case "givedrink":
                            if (Session.GetHabbo().HasFuse("fuse_admin"))
                            {
                                TargetRoom = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                                TargetClient = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Params[1]);
    
                                if (TargetRoom == null)
                                {
                                    return false;
                                }
    
                                TargetRoomUser = TargetRoom.GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
    
                                if (TargetRoomUser == null)
                                {
                                    return false;
                                }
    
                                try
                                {
                                    TargetRoomUser.CarryItem(int.Parse(Params[2]));
                                }
                                catch (Exception) { }
    
                                return true;
                            }
    
                            return false;
    Add command in allowedCommands +=

    Fix Online

    Find
    Code:
    case "online":
    Replace function by

    Code:
    case "whoson":
                        case "whosonline":
                        case "online":
                            {
                                DataTable onlineData = new DataTable("online");
                                int count = onlineData.Columns.Count;
                                int Conter = UberEnvironment.GetGame().GetClientManager().ClientCount;
                                string message = "Utilisateurs connectés (" + Conter + "):\r";
                                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                                {
                                    onlineData = dbClient.ReadDataTable("SELECT SQL_NO_CACHE username FROM users WHERE online = '1';");
                                }
                                foreach (DataRow user in onlineData.Rows)
                                {
                                    message = message + user["username"] + "\r";
                                }
                                Session.SendNotif(message);
                                return true;
                            }
    This code is extract to Iemulator by itachi v2.5.2

    I have replace function

    Code:
    int Conter = onlineData.Rows.Count;
    by
    Code:
    int Conter = UberEnvironment.GetGame().GetClientManager().ClientCount;
    Last edited by dimitri54480; 10-03-11 at 09:34 AM. Reason: error in my english --'


  2. #2
    Account Upgraded | Title Enabled! Muscab is offline
    MemberRank
    Oct 2009 Join Date
    264Posts

    Re: New command [UBEREMU] :givedrink and fix :online

    Most servers have these commands working already...

    I'll give it a go later

  3. #3
    HTML,CSS and a bit C# Richardjuhh is offline
    MemberRank
    Dec 2010 Join Date
    NetherlandsLocation
    351Posts

    Re: New command [UBEREMU] :givedrink and fix :online

    I have it already, but nice for people who don't have....

  4. #4
    Banned PEjump2 is offline
    BannedRank
    Jan 2010 Join Date
    The NetherlandsLocation
    2,838Posts

    Re: New command [UBEREMU] :givedrink and fix :online

    Doing a query everytime the :whoson / :whosonline / :online command is requested? Ugh..
    Last edited by PEjump2; 09-03-11 at 05:27 PM.

  5. #5
    Account Upgraded | Title Enabled! FlyCoder is offline
    MemberRank
    Jan 2011 Join Date
    United KingdomLocation
    469Posts

    Re: New command [UBEREMU] :givedrink and fix :online

    Doing a query every time that command is used will use more SQL, 1/10.

  6. #6
    Account Upgraded | Title Enabled! wichard is offline
    MemberRank
    Jul 2009 Join Date
    The NetherlandsLocation
    649Posts

    Re: New command [UBEREMU] :givedrink and fix :online

    /facepalm
    cache it bro dont overload

  7. #7
    Valued Member anthony93260 is offline
    MemberRank
    Dec 2009 Join Date
    ParisLocation
    133Posts

    Re: New command [UBEREMU] :givedrink and fix :online

    Quote Originally Posted by FlyCoder View Post
    Doing a query every time that command is used will use more SQL, 1/10.
    Yeah... Dimitri, could you stop sharing useless things?



Advertisement