:bail <user> | V26 RP Command

Magicalz

Member
Aug 4, 2011
141
8
Hey guys. First code I've coded from scratch, however it is not fully completed as it poofs the user twice. (likely as it has the vars and appearance being refreshed)

Anyway, one user who is in the jail room can use :bail <user> to bail that user for 750c. You can remove the roomID & change the amount of credits if you want to. Might not fully work, but first release and that.

Code:
 #region :bail
                    case "bail":
                        {
                            string jailed;
                            using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                            {
                                jailed = dbClient.getString("SELECT arrested FROM users WHERE name = '" + _Username + "'");
                                int myCredits = dbClient.getInt("SELECT credits FROM users WHERE name = '" + _Username + "'");
                                virtualUser User = userManager.getUser(args[1]);
                                {
                                    if (_roomID == 7)
                                    {
                                            if (_Jailed == 1)
                                            {
                                                sendData("BK" + "Sorry, but you are in jail. You cannot bail anyone if you are in jail..");
                                            }
                                            else
                                                if (myCredits < 750)
                                                {
                                                    sendData("BK" + "Sorry, but you need 750 credits to bail this user.");
                                                }
                                                else
                                                {
                                                    dbClient.runQuery("UPDATE users SET credits = credits + '-750' WHERE name = '" + _Username + "'");
                                                    User._JailTime = 0;
                                                    User._Punch = 0;
                                                    User._HitBot = null;
                                                    User._Figure = User._Uni;
                                                    User._Mission = ("Bailed");
                                                    refreshAppearance(true, true, true);
                                                    User.refreshAppearance(true, true, true);
                                                    User.refreshValueables(true, true);
                                                    refreshValueables(true, true);
                                                    User.sendData("BK" + "You just got bailed out of jail by " + _Username + "");
                                                    Room.sendShout(roomUser, "*Bails " + User._Username + " from jail for 750 credits!*");
                                                }
                                    }
                                }
                            }
                        }
                        break;
                    #endregion

(FOR THE NOOBS: Go into your Emu folder -> Source -> Virtual -> Users ->VirtualUser.cs and then paste this under any command in the file. You can always search for stun at the top, then at the end of the #endregion, press an enter and then paste it in)

If it don't work, contact me. Was used especially for Xoa EMU V4 but others should work too.

Thanks alot! :) [Like if you used it, or liked it or whatnot xD]
 

LiveJam

New Member
Jul 2, 2010
6
2
Just to inform you, "string jailed;" should be "int jailed;"(Since you are dealing with integers[1,2,3, etc...] as opposed to Strings). Also, "dbClient.getString" should be "dbClient.getInt".

PS. if you are saying "int Jailed", it must also be "if (Jailed == 1)".. In short, they must be the same. In your case you said "string jailed;"(should be "int jailed;") but then wrote "if (_Jailed == 1)" [they are not obviously the same, so just change it to be the same ^_^ and you will be good sir. Yay!] I didn't look at anything else because these were the first things i noticed.

Hope this command is useful to some of the peeps here.
Cheers. o/
 

Users who are viewing this thread

Top