Welcome to the RaGEZONE - MMORPG development forums.

Snowlight Coins & GiveBadge Command

This is a discussion on Snowlight Coins & GiveBadge Command within the Habbo Releases forums, part of the Habbo Hotel category; Hi, I'm not really good at C# yet, but I'll release it just for others. Search for: Code: case "update_catalog": ...

LyncusMU
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Alpha
    Rank
    Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    139
    Liked
    56

    Snowlight Coins & GiveBadge Command

    Tabo Hotel
    Hi, I'm not really good at C# yet, but I'll release it just for others.

    Search for:
    Code:
    case "update_catalog":
    Put BOFORE this command:
    Code:
                    case "givebadge":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            if (TargetSession == null)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a valid user."));
                                return false;
                            }
    
                            if (Bits[2].Trim() == "")
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a badge ID"));
                            }
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                DataRow row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                MysqlClient.ExecuteScalar("INSERT INTO badges (user_id, badge_id, source_type) VALUES('" + CharacterResolverCache.GetUidFromName(Username) + "', '" + row["id"] + "', 'static')");
                            }
                            TargetSession.SendData(RoomUserBadgesComposer.Compose(TargetSession.CharacterId, TargetSession.BadgeCache.EquippedBadges));
                            TargetSession.SendData(UserAlertModernComposer.Compose("Badges", "You just got a new badge, relog for showing off with it!"));
                            return true;
                        }
    And after this:
    Code:
                    case "coins":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
    
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            int coins = -1;
                            string trimmer = Bits[2];
                            if (!int.TryParse(MergeInputs(Bits, 2), out coins))
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Credits", "Not an int value"));
                                return false;
                            }
                            if (coins <= 0)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Credits", "Not an int value"));
                                return false;
                            }
                            if (coins >= 1000000)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Credits", "Please fill an normal value."));
                                return false;
                            }
                            int oldcoins = TargetSession.CharacterInfo.CreditsBalance;
                            TargetSession.CharacterInfo.CreditsBalance = oldcoins + coins;
                            TargetSession.SendData(CreditsBalanceComposer.Compose(oldcoins+coins));
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                int newcoins = oldcoins + coins;
                                MysqlClient.ExecuteQuerySet("UPDATE characters SET credits_balance = '" + newcoins + "' WHERE id = '" + CharacterResolverCache.GetUidFromName(Username) + "' LIMIT 1");
                            }
                            TargetSession.SendData(UserAlertModernComposer.Compose("Credit","Your credit balance is updated, check it!"));
                            return true;
                        }
    I hope you guys like it :)

    Regards,
    BetterWay

    EDIT:
    For the GiveBadge command, you NEED to add all badge codes (likes JKR/SG4 etc.) into your database table badge_definitions..

  2. HostKey.com: Unmetered Dedicated servers in the Netherlands
  3. #2
    Alpha
    Rank
    Member
    Join Date
    Nov 2011
    Posts
    136
    Liked
    6

    Re: Snowlight Coins & GiveBadge Command

    Are this for uber?

  4. #3
    Alpha
    Rank
    Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    139
    Liked
    56

    Re: Snowlight Coins & GiveBadge Command

    Like the title says, SnowLight Emulator.
    So no it isn't for Uber, sorry.

    Fix for Givebadge command (U dont need to add badge_definitions now):

    Code:
                    case "givebadge":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            if (TargetSession == null)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a valid user."));
                                return false;
                            }
    
                            if (Bits[2].Trim() == "")
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a badge ID"));
                            }
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                DataRow row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");;
                                if (row == null)
                                {
                                    MysqlClient.ExecuteScalar("INSERT INTO badge_definitions (code) VALUES('" + Bits[2].Trim() + "')");
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                else
                                {
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                MysqlClient.ExecuteScalar("INSERT INTO badges (user_id, badge_id, source_type) VALUES('" + CharacterResolverCache.GetUidFromName(Username) + "', '" + row["id"] + "', 'static')");
                            }
                            TargetSession.SendData(RoomUserBadgesComposer.Compose(TargetSession.CharacterId, TargetSession.BadgeCache.EquippedBadges));
                            TargetSession.SendData(UserAlertModernComposer.Compose("Badges", "You just got a new badge, relog for showing off with it!"));
                            return true;
                        }

  5. #4
    Alpha
    Rank
    Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    139
    Liked
    56

    Re: Snowlight Coins & GiveBadge Command

    Fix for Givebadge command (U dont need to add badge_definitions now):

    Code:
                    case "givebadge":
                        {
                            if (!Session.HasRight("hotel_admin"))
                            {
                                return false;
                            }
                            string Username = UserInputFilter.FilterString(Bits[1].Trim());
                            Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));
                            if (TargetSession == null)
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a valid user."));
                                return false;
                            }
    
                            if (Bits[2].Trim() == "")
                            {
                                Session.SendData(UserAlertModernComposer.Compose("Badges", "You need to give a badge ID"));
                            }
                            using (SqlDatabaseClient MysqlClient = SqlDatabaseManager.GetClient())
                            {
                                DataRow row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");;
                                if (row == null)
                                {
                                    MysqlClient.ExecuteScalar("INSERT INTO badge_definitions (code) VALUES('" + Bits[2].Trim() + "')");
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                else
                                {
                                    row = MysqlClient.ExecuteQueryRow("SELECT * FROM badge_definitions WHERE code = '" + Bits[2].Trim() + "'");
                                }
                                MysqlClient.ExecuteScalar("INSERT INTO badges (user_id, badge_id, source_type) VALUES('" + CharacterResolverCache.GetUidFromName(Username) + "', '" + row["id"] + "', 'static')");
                            }
                            TargetSession.SendData(RoomUserBadgesComposer.Compose(TargetSession.CharacterId, TargetSession.BadgeCache.EquippedBadges));
                            TargetSession.SendData(UserAlertModernComposer.Compose("Badges", "You just got a new badge, relog for showing off with it!"));
                            return true;
                        }

  6. #5
    TopHabbo.com Best Topsite
    Rank
    Alpha Member
    Join Date
    Oct 2007
    Posts
    2,423
    Liked
    497

    Re: Snowlight Coins & GiveBadge Command

    Snowlight is not even complete.

    And you are making commands for it.

    Why not completes it instead.

  7. #6
    No, Just no.
    Rank
    Subscriber
    Join Date
    Jul 2008
    Location
    United Kingdom
    Posts
    1,182
    Liked
    429

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by Zak© View Post
    Snowlight is not even complete.

    And you are making commands for it.

    Why not completes it instead.
    Hi, I'm not really good at C# yet, but I'll release it just for others.
    At least he's trying.

  8. #7
    /title
    Rank
    Member +
    Join Date
    Mar 2011
    Posts
    1,034
    Liked
    146

    Re: Snowlight Coins & GiveBadge Command

    Thanks.

  9. #8
    Alpha
    Rank
    Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    139
    Liked
    56

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by Zak© View Post
    Snowlight is not even complete.

    And you are making commands for it.

    Why not completes it instead.
    Yes it isn't completed, but when I have more experience I'll do more..

    For now this 2 commands, and next I'll try make more updates for it :)

    Regards,
    BetterWay

  10. #9
    Azure subscription
    Rank
    Subscriber
    Join Date
    Dec 2011
    Location
    єαятн
    Posts
    1,738
    Liked
    263

    Re: Snowlight Coins & GiveBadge Command

    Nice release I guess :D Really coded by you? Because you said you're not really good at C#, yet, how did you code this? Possibly a Ctrl+C & Ctrl+V ?

  11. #10
    Alpha
    Rank
    Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    139
    Liked
    56

    Re: Snowlight Coins & GiveBadge Command

    It's totally coded by me, and meth0d for Snowlight..

    And no possibility of C&P because there are no other releases for givebadge/coins commands :)

    And I'm coding for 2 years C++ and that because I said I'm not really good at it yet..

  12. #11
    Azure subscription
    Rank
    Subscriber
    Join Date
    Dec 2011
    Location
    єαятн
    Posts
    1,738
    Liked
    263

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by BetterWay View Post
    It's totally coded by me, and meth0d for Snowlight..

    And no possibility of C&P because there are no other releases for givebadge/coins commands :)

    And I'm coding for 2 years C++ and that because I said I'm not really good at it yet..
    You've been coding C++ for 2 years, and you're not really got at it?

    Anyways, I saw this release on Snowlights forum

  13. #12
    Alpha
    Rank
    Member
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    139
    Liked
    56

    Re: Snowlight Coins & GiveBadge Command

    Lol'd show the GiveBadge, if it is released? or the coins? it needs to be totally different ;)

  14. #13
    Member
    Rank
    Newbie
    Join Date
    Mar 2011
    Location
    Austria
    Posts
    33
    Liked
    1

    Re: Snowlight Coins & GiveBadge Command

    Snowlight is ****

  15. #14
    Epic Member ;)
    Rank
    Member +
    Join Date
    Aug 2011
    Location
    England
    Posts
    572
    Liked
    113

    Re: Snowlight Coins & GiveBadge Command

    Snowlight would of been the best EMU available IMO .. Roy is an amazing coder. Why do you think Phoenix is so popular....Only Aaron is even more lazy than Roy .. which sucks balls

  16. #15
    What about no.
    Rank
    Subscriber
    Join Date
    Nov 2009
    Location
    The Nederlands
    Posts
    900
    Liked
    303

    Re: Snowlight Coins & GiveBadge Command

    Quote Originally Posted by PoyzenCookie View Post
    Snowlight would of been the best EMU available IMO .. Roy is an amazing coder. Why do you think Phoenix is so popular....Only Aaron is even more lazy than Roy .. which sucks balls
    Lol no just no.

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •