[RP] 911 CFH System [SLEDMORE]

Status
Not open for further replies.

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,195
3,906
Hey,

Well, I was due to release this, But Harsh said not to, then he goes to release his? Wdf?

Credits:
Me: 50%
Swimo: 50%

Anyways, here is the release;

911 command:
Code:
#region :911 <message>
                    case "911":
                        {
                            if (copCdLooper != null)
                            {
                                sendData("BK" + "Sorry, but you have to wait to send another 911 call.");
                            }
                            else
                            {
                                int isArrested;
                                int isDead;
                                int copID;
                                using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                {
                                    isArrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + _Username + "'");
                                    isDead = dbClient.getInt("SELECT dead FROM users WHERE name = '" + _Username + "'");
                                    copID = dbClient.getInt("SELECT id FROM police_call");
                                }
                                if (isArrested == 0 && isDead == 0)
                                {
                                    string Message = Text.Substring(3);
                                    Room.sendSaying(roomUser, "*calls the police for help*");
                                    using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                    {
                                        dbClient.runQuery("UPDATE policecall SET message = '[911]" + Message + "' WHERE id = '1'"); ;
                                        dbClient.runQuery("UPDATE policecall SET room = '" + roomUser.roomID + "' WHERE id = '1'"); ;
                                        dbClient.runQuery("UPDATE policecall SET user = '" + _Username + "' WHERE id = '1'"); ;
                                    }
                                    userManager.sendToCop(1, false, "" + "");

                                    ThreadStart copCdStarter = new ThreadStart(copCoolDown);
                                    copCdLooper = new Thread(copCdStarter);
                                    copCdLooper.Priority = ThreadPriority.Lowest;
                                    copCdLooper.Start();
                                }
                                else
                                {
                                    sendData("You cannot be arrested or dead to ring 911!");
                                }
                            }
                            break;
                        }
                    #endregion

Usermanager.cs send data!
Code:
 public static void sendToCop(int getCorp, bool includeHigher, string Data)
        {
            try
            {
                {
                    foreach (virtualUser User in _Users.Values)
                    {
                        int getWorking;
                        using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                        {
                            getCorp = dbClient.getInt("SELECT corp_id FROM users WHERE name = '" + User._Username + "'");
                            getWorking = dbClient.getInt("SELECT working FROM users WHERE name = '" + User._Username + "'");
                        }
                        if (getCorp == 1 && getWorking == 1)
                        {
                            using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                            {
                                string msg;
                                int room;
                                string user;
                                msg = dbClient.getString("SELECT Message FROM policecall WHERE id = '1'");
                                room = dbClient.getInt("SELECT room FROM policecall WHERE id = '1'");
                                user = dbClient.getString("SELECT user FROM policecall WHERE id = '1'");

                                User.sendData(Data);

                                int cfhID;
                                cfhID = dbClient.getInt("SELECT id FROM policecalldb WHERE username = '" + user + "' AND used = '0'");
                                string roomName;
                                roomName = dbClient.getString("SELECT name FROM rooms WHERE id = '" + room + "'");

                                dbClient.runQuery("UPDATE policecalldb SET used = '1' WHERE username = '" + user + "' AND used = '0' LIMIT 1");
                                dbClient.runQuery("INSERT INTO policecalldb (username,message,date,used,subject,roomid) VALUES ('" + user + "','" + msg + "','" + DateTime.Now + "','0','911','" + room + "')");

                                User.sendData("BT" + Encoding.encodeVL64(cfhID) + Convert.ToChar(2) + "I" + "Sent: " + DateTime.Now + Convert.ToChar(2) + user + Convert.ToChar(2) + msg + Convert.ToChar(2) + Encoding.encodeVL64(room) + Convert.ToChar(2) + roomName + Convert.ToChar(2) + "I" + Convert.ToChar(2) + Encoding.encodeVL64(room));
                            }
                        }
                    }
                }
            }
            catch { }
        }

Database tables:
Policecall:
Code:
CREATE TABLE IF NOT EXISTS `policecall` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `message` varchar(200) NOT NULL,
  `user` varchar(15) NOT NULL,
  `room` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `policecall`
--

INSERT INTO `policecall` (`id`, `message`, `user`, `room`) VALUES
(1, '[911] Keep this here as default!', 'Craig-Martin', 7);

Policecalldb:
Code:
CREATE TABLE IF NOT EXISTS `policecalldb` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `username` varchar(25) NOT NULL,
  `message` mediumtext CHARACTER SET utf8 NOT NULL,
  `date` varchar(50) CHARACTER SET utf8 NOT NULL,
  `used` enum('0','1') CHARACTER SET utf8 NOT NULL,
  `subject` varchar(50) CHARACTER SET utf8 NOT NULL,
  `roomid` int(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

IF YOU LIKE THIS SHOW YOUR APPRECIATION AND CLICK THE THANKS BUTTON!
 

Lindsey

Member
Dec 2, 2010
73
1
can you show us us where to put the second code like where about in user manager becuase i've put it in like anywhere and i do :911 and it records in the database but doesn't send a cfh.
 
Status
Not open for further replies.

Users who are viewing this thread

Top