[Uber] Infobus questions 100%

Results 1 to 19 of 19
  1. #1
    Account Upgraded | Title Enabled! =dj.matias= is offline
    MemberRank
    Apr 2008 Join Date
    FinlandLocation
    381Posts

    [Uber] Infobus questions 100%

    I've coded infobus questions for uberemu today.

    Add to Chatcommandhandlers.cs:

    Code:
     case "startquestion":
    
                            if (Session.GetHabbo().HasFuse("fuse_sysadmin"))
                            {
                                Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                                DataTable Data = null;
                                int QuestionId = int.Parse(Params[1]);
                                Room.CurrentPollId = QuestionId;
                                string Question;
    
                                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                                {
                                    Question = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionId + "' LIMIT 1");
                                }
    
    
                                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                                {
                                    Data = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id = '" + QuestionId + "'");
    
                                }
    
                                ServerMessage InfobusQuestion = new ServerMessage(79);
                                InfobusQuestion.AppendStringWithBreak(Question);
                                InfobusQuestion.AppendInt32(Data.Rows.Count);
                                if (Data != null)
                                {
                                    foreach (DataRow Row in Data.Rows)
                                    {
                                        InfobusQuestion.AppendInt32((int)Row["id"]);
                                        InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                                    }
                                }
                                Room.SendMessage(InfobusQuestion);
    
    
    
                                Thread Infobus = new Thread(delegate() { Room.ShowResults(Room, QuestionId, Session); });
                                Infobus.Start();
                                Room.HasThread.Add((uint)QuestionId, Infobus);
    
    
                                return true;
                            }
                            return false;
    Add to Rooms.cs:

    Code:
     private void AnswerInfobusPoll()
            {
                Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                int AnswerId = Request.PopWiredInt32();
                int QuestionId = Room.CurrentPollId;
                DataTable Data = null;
    
                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("INSERT INTO `infobus_results` (`question_id`, `answer_id`) VALUES ('" + QuestionId + "', '" + AnswerId + "')");
                }
               
            
            }
    Find:
    Code:
    RequestHandlers[3004] = new RequestHandler(GetTrainerPanel);
    Add after:

    Code:
    RequestHandlers[112] = new RequestHandler(AnswerInfobusPoll);
    Add to Room.cs:

    Code:
     public static void ShowResults(Room Room, int QuestionId, GameClient Session)
            {
                Thread.Sleep(30000);
                string Question;
                DataTable Data = null;
                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    Question = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionId + "' LIMIT 1");
                }
    
    
                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    Data = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id = '" + QuestionId + "'");
    
                }
    
                ServerMessage InfobusQuestion = new ServerMessage(80);
                InfobusQuestion.AppendStringWithBreak(Question);
                InfobusQuestion.AppendInt32(Data.Rows.Count);
                if (Data != null)
                {
                    foreach (DataRow Row in Data.Rows)
                    {
                        int ResultCount;
                        InfobusQuestion.AppendInt32((int)Row["id"]);
                        InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                        using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                        {
                            ResultCount = dbClient.ReadInt32("SELECT COUNT(*) FROM infobus_results WHERE answer_id = '" + (int)Row["id"] + "' AND question_id = '" + QuestionId + "'");
                        }
                        InfobusQuestion.AppendInt32(ResultCount);
                    }
                }
                int AnswerUserCount;
                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    AnswerUserCount = dbClient.ReadInt32("SELECT COUNT(*) FROM infobus_results WHERE question_id = '" + QuestionId + "'");
                }
                InfobusQuestion.AppendInt32(AnswerUserCount);
                Room.SendMessage(InfobusQuestion);
    
                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("DELETE FROM infobus_results WHERE question_id = '" + QuestionId + "'");
                }
            }
    SQL:

    Code:
    /*
    Navicat MySQL Data Transfer
    
    Source Server         : localhost_3306
    Source Server Version : 50516
    Source Host           : localhost:3306
    Source Database       : uberdb2
    
    Target Server Type    : MYSQL
    Target Server Version : 50516
    File Encoding         : 65001
    
    Date: 2012-03-11 10:15:35
    */
    
    SET FOREIGN_KEY_CHECKS=0;
    
    -- ----------------------------
    -- Table structure for `infobus_answers`
    -- ----------------------------
    DROP TABLE IF EXISTS `infobus_answers`;
    CREATE TABLE `infobus_answers` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `question_id` int(11) NOT NULL DEFAULT '0',
      `answer_text` text NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
    
    -- ----------------------------
    -- Records of infobus_answers
    -- ----------------------------
    INSERT INTO `infobus_answers` VALUES ('1', '1', 'Awesome');
    INSERT INTO `infobus_answers` VALUES ('2', '1', 'Nice');
    INSERT INTO `infobus_answers` VALUES ('3', '1', 'Poor');
    
    -- ----------------------------
    -- Table structure for `infobus_questions`
    -- ----------------------------
    DROP TABLE IF EXISTS `infobus_questions`;
    CREATE TABLE `infobus_questions` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `question` text NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
    
    -- ----------------------------
    -- Records of infobus_questions
    -- ----------------------------
    INSERT INTO `infobus_questions` VALUES ('1', 'What do you think about this?');
    Code:
    /*
    Navicat MySQL Data Transfer
    
    Source Server         : localhost_3306
    Source Server Version : 50516
    Source Host           : localhost:3306
    Source Database       : uberdb2
    
    Target Server Type    : MYSQL
    Target Server Version : 50516
    File Encoding         : 65001
    
    Date: 2012-03-11 10:16:23
    */
    
    SET FOREIGN_KEY_CHECKS=0;
    
    -- ----------------------------
    -- Table structure for `infobus_results`
    -- ----------------------------
    DROP TABLE IF EXISTS `infobus_results`;
    CREATE TABLE `infobus_results` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `question_id` int(11) NOT NULL,
      `answer_id` int(11) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
    
    -- ----------------------------
    -- Records of infobus_results
    -- ----------------------------
    Find public List<Trade> ActiveTrades;

    Add after:
    Code:
    public int CurrentPollId;
    You can start infobus question command :startquestion [question id]

    Last edited by =dj.matias=; 11-03-12 at 11:38 AM. Reason: Missing codeline


  2. #2
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: [Uber] Infobus questions 100%

    Woow, its a long time ago when i saw a good uber addon/edit. Good job!
    Posted via Mobile Device

  3. #3
    swagggggg Livar is offline
    MemberRank
    Oct 2008 Join Date
    United KingdomLocation
    2,272Posts

    Re: [Uber] Infobus questions 100%

    Slaxxer had something like this! Amazing though.

  4. #4
    Learning C# - Developer wy479 is offline
    MemberRank
    Nov 2010 Join Date
    :O You PERVERT!Location
    1,132Posts

    Re: [Uber] Infobus questions 100%

    Nice. +rep +like

  5. #5
    Account Upgraded | Title Enabled! DoctorCooper is offline
    MemberRank
    Oct 2011 Join Date
    R:\aGEZONELocation
    317Posts

    Re: [Uber] Infobus questions 100%

    +Rep / +Like, finally back to the basics :D

  6. #6
    C# Programmer Jax is offline
    MemberRank
    Dec 2009 Join Date
    1,030Posts

    Re: [Uber] Infobus questions 100%

    I like it :) +Like

  7. #7
    Habbo section forever TimGlipper is offline
    MemberRank
    Oct 2011 Join Date
    On RaGEZONE.comLocation
    243Posts

    Re: [Uber] Infobus questions 100%

    Nice! Can I please have your UberEMU?

    +Rep

  8. #8
    Fuck You Retro! is offline
    MemberRank
    Jun 2007 Join Date
    4,346Posts

    Re: [Uber] Infobus questions 100%

    Never thought I'd see this again. Well done.

  9. #9

    Nike Air Snacks

    Shoelace is offline

    Super ModRank
    Mar 2012 Join Date
    6,580Posts

    Re: [Uber] Infobus questions 100%

    Omg i love this

  10. #10
    Account Upgraded | Title Enabled! GertJanA is offline
    MemberRank
    Jan 2010 Join Date
    The NetherlandsLocation
    391Posts

    Re: [Uber] Infobus questions 100%

    Would be nice if this was in Phoenix.
    Gianni? Maybe something for you? x)

    Greetz,

  11. #11
    Infraction Banned HabMoon is offline
    MemberRank
    Jun 2007 Join Date
    HM OfficesLocation
    3,068Posts

    Re: [Uber] Infobus questions 100%

    Great job! (:

  12. #12
    Valued Member zer0 141 is offline
    MemberRank
    Jun 2011 Join Date
    RageZoneDOTcomLocation
    133Posts

    Re: [Uber] Infobus questions 100%

    Great Work ;)

    Keep it up!

  13. #13
    What about no. Davidaap is offline
    MemberRank
    Nov 2009 Join Date
    773Posts

    Re: [Uber] Infobus questions 100%

    use tasks instead of threads.

  14. #14
    sexiess is a sin. Subway is offline
    MemberRank
    Jun 2010 Join Date
    2,491Posts

    Re: [Uber] Infobus questions 100%

    Cool release

  15. #15
    Account Upgraded | Title Enabled! =dj.matias= is offline
    MemberRank
    Apr 2008 Join Date
    FinlandLocation
    381Posts

    Re: [Uber] Infobus questions 100%

    I release today might be open/close bus commands and room polls :)

  16. #16
    Account Upgraded | Title Enabled! DoctorCooper is offline
    MemberRank
    Oct 2011 Join Date
    R:\aGEZONELocation
    317Posts

    Re: [Uber] Infobus questions 100%

    Quote Originally Posted by =dj.matias= View Post
    I release today might be open/close bus commands and room polls :)
    Nice idea, keep up to good work sir.

  17. #17
    My title is enabled NeonCrayonz is offline
    MemberRank
    Sep 2010 Join Date
    283Posts

    Re: [Uber] Infobus questions 100%

    I remember in slaxxer's emu, there was something like this. Nice to see it improved on and released. +1 Rep for you!

  18. #18
    Valued Member Huginho98 is offline
    MemberRank
    Jan 2011 Join Date
    SwitzerlandLocation
    128Posts

    Re: [Uber] Infobus questions 100%

    I can't find RequestHandlers[3004] = new RequestHandler(GetTrainerPanel);

  19. #19
    Calm yo tits. TashiaLurvesYou is offline
    MemberRank
    Nov 2011 Join Date
    PhilippinesLocation
    474Posts

    Re: [Uber] Infobus questions 100%

    Awesome(:
    someone code for phoenix too? :D



Advertisement