Hi, I'm not really good at C# yet, but I'll release it just for others.
Search for:
Put BOFORE this command:Code:case "update_catalog":
And after this: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; }
I hope you guys like it :)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; }
Regards,
BetterWay
EDIT:
For the GiveBadge command, you NEED to add all badge codes (likes JKR/SG4 etc.) into your database table badge_definitions..






