[RP] Team Deathmatch [Sledmore]

Status
Not open for further replies.

Sledmore

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

Well this isn't a really good release, But still, It's a simple event game for RP servers.

Right, I'm going to release different parts of it. The game is 'Team Deathmatch' :).

Right, firstly, search for this;


Code:
                                    //gets information from the database

under it add this;

Code:
 int blacktdm = dbClient.getInt("SELECT yellow_team FROM users WHERE name = '" + _Username + "'");
                                    int yellowtdm = dbClient.getInt("SELECT black_team FROM users WHERE name = '" + _Username + "'");

Right, Search for this;

Code:
                                            if (dead == 1)
                                            {
                                                //sends user back to the hospital
                                                sendData("D^" + "H" + Encoding.encodeVL64(2));
                                                sendData("BK" + "You logged out while you were dead.\r\rTherefore you MUST reset your dead timer by using the folowing command:\r:deadtimer\r\rThis will restart your dead timer to where you left off last login.");
                                                _Mission = "Dead";
                                                refreshAppearance(false, true, true);
                                            }
                                        }
                                    }

And under it add this;

Code:
                                    else
                                    {
                                        if (blacktdm == 1)
                                        {
                                            _Mission = "Black Team - Team Death Match!";
                                            _Figure = _Uni + "ch-210-110.lg-281-110.sh-290-110";
                                            refreshAppearance(false, true, true);

                                            sendData("D^" + "H" + Encoding.encodeVL64(onloadroom));
                                            dbClient.runQuery("UPDATE users SET black_team = '1' WHERE name = '" + _Username + "'");
                                        }
                                        else if (yellowtdm == 1)
                                        {
                                            _Mission = "Yellow Team - Team Death Match!";
                                            _Figure = _Uni + "ch-210-93.lg-281-93.sh-290-93";
                                            refreshAppearance(false, true, true);

                                            sendData("D^" + "H" + Encoding.encodeVL64(onloadroom));
                                            dbClient.runQuery("UPDATE users SET yellow_team = '1' WHERE name = '" + _Username + "'");
                                        }
                                        else if (yellowtdm == 0 || blacktdm == 0)
                                        {
                                            sendData("D^" + "H" + Encoding.encodeVL64(onloadroom));
                                        }
                                    }
                                }
                                break;
                            }

Then, on punch, on the default events, add this;

Code:
                        if (User._Mission == "Yellow Team - Team Death Match!")
                        {
                            if (_Mission == "Black Team - Team Death Match!" || User._Mission == "Yellow Team - Team Death Match!")
                            {
                                dbClient.runQuery("UPDATE users SET game_dm = game_dm + '10' WHERE name = '" + _Username + "'");
                            }
                            User.sendData("D^" + "H" + Encoding.encodeVL64(21));
                            User.sendData("BK" + "Thank you for playing team deathmatch.");
                            dbClient.runQuery("UPDATE users SET yellow_team = '0' WHERE name = '" + User._Username + "'");
                            dbClient.runQuery("UPDATE users SET black_team = '0' WHERE name = '" + User._Username + "'");
                            Room.sendShout(roomUser, "*Knocks out " + args[1] + ", sending them to the lobby*");
                        }
                        if (User._Mission == "Black Team - Team Death Match!")
                        {
                            if (_Mission == "Yellow Team - Team Death Match!" || User._Mission == "Black Team - Team Death Match!")
                            {
                                dbClient.runQuery("UPDATE users SET game_dm = game_dm + '10' WHERE name = '" + _Username + "'");
                            }
                            User.sendData("D^" + "H" + Encoding.encodeVL64(21));
                            User.sendData("BK" + "Thank you for playing team deathmatch.");
                            dbClient.runQuery("UPDATE users SET yellow_team = '0' WHERE name = '" + User._Username + "'");
                            dbClient.runQuery("UPDATE users SET black_team = '0' WHERE name = '" + User._Username + "'");

                            Room.sendShout(roomUser, "*Knocks out " + args[1] + ", sending them to the lobby*");
                        }

Here are some one way gates (;
Note: You'll have to add a figure in here, as mine was all splits.


Code:
                                        if (Item.Sprite == "one_way_door*8")
                                        {
                                            int isWorking;
                                            using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                            {
                                                isWorking = dbClient.getInt("SELECT working FROM users WHERE name = '" + _Username + "'");
                                            }

                                            if (isWorking == 1)
                                            {
                                                workLooper.Abort();
                                                workLooper = null;
                                            }

                                            using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                            {

                                                _Mission = "Black Team - Team Death Match!";


                                                refreshAppearance(false, true, true);

                                                dbClient.runQuery("UPDATE users SET black_team = '1' WHERE name = '" + _Username + "'");
                                            }
                                        }

                                        if (Item.Sprite == "one_way_door*9")
                                        {
                                            int isWorking;
                                            using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                            {
                                                isWorking = dbClient.getInt("SELECT working FROM users WHERE name = '" + _Username + "'");
                                            }

                                            if (isWorking == 1)
                                            {
                                                workLooper.Abort();
                                                workLooper = null;
                                            }

                                            using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                            {

                                                _Mission = "Yellow Team - Team Death Match!";
                                                refreshAppearance(false, true, true);

                                                dbClient.runQuery("UPDATE users SET yellow_team = '1' WHERE name = '" + _Username + "'");
                                            }
                                        }

Right, here is the kickfromgame for staff above the rank 4.

Code:
                    #region :kickfromgame (events)
                    case "kickfromgame":
                        {
                            if (_Rank > 4)
                            {
                                virtualUser User = userManager.getUser(args[1]);
                                {
                                    if (User._Mission == "[Game] Deathmatch" || User._Mission == "[Game] Brawl" || User._Mission == "Yellow Team - Team Death Match!" || User._Mission == "Black Team - Team Death Match!" || User._Mission == "Red Fighter - Arena Fight!" || User._Mission == "Blue Fighter - Arena Fight!")
                                    {
                                        using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                        {
                                            User.sendData("BK" + "Thank you for playing, You have been kicked from the game, By an administrator!");
                                            dbClient.runQuery("UPDATE users SET yellow_team = '0' WHERE name = '" + User._Username + "'");
                                            dbClient.runQuery("UPDATE users SET black_team = '0' WHERE name = '" + User._Username + "'");
                                            dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + _Username + "'");
                                            User.sendData("D^" + "H" + Encoding.encodeVL64(21));
                                            User.refreshAppearance(true, true, true);
                                        }
                                    }
                                    else
                                    {
                                        sendData("BK" + "This user is not in a game!");
                                    }
                                }
                            }
                            break;
                        }
                    #endregion

And also, here is the :leavegame command!

Code:
#region :leavegame (events)
                    case "leavegame":
                        {
                            if (this._Mission == "[Game] Deathmatch" || this._Mission == "[Game] Brawl" || this._Mission == "Yellow Team - Team Death Match!" || this._Mission == "Black Team - Team Death Match!" || this._Mission == "Red Fighter - Arena Fight!" || this._Mission == "Blue Fighter - Arena Fight!")
                            {
                                using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                {
                                    sendData("BK" + "Thank you for playing, You have been sent to the events lobby!");
                                    dbClient.runQuery("UPDATE users SET yellow_team = '0' WHERE name = '" + _Username + "'");
                                    dbClient.runQuery("UPDATE users SET black_team = '0' WHERE name = '" + _Username + "'");
                                    dbClient.runQuery("UPDATE users SET health = '100' WHERE name = '" + _Username + "'");
                                    this.sendData("D^" + "H" + Encoding.encodeVL64(21));
                                    this.refreshAppearance(true, true, true);
                                }
                            }
                            else
                            {
                                sendData("BK" + "You are not in a game!");
                            }
                            break;
                        }
                    #endregion

Right, You need to add in some collums in the user table, the two;

yellow_team
black_team


both int 1, as defined = 0 (;

I know this looks messy, But i never thought about releasing this, or improving.. If you would like to go do it!

Thanks, Also, remember to click thanks if you like it. (;

I'm sorry this isnt a really good tutorial to setting it up, but it's easy ;).


Oh, one last thing, You'll need to do an SQL, for the gates :p.

[EDIT]

added SQL;

Code:
INSERT INTO `catalogue_items` (`tid`, `catalogue_name`, `catalogue_description`, `catalogue_cost`, `typeid`, `length`, `width`, `top`, `name_cct`, `colour`, `catalogue_id_page`, `door`, `tradeable`, `recycleable`, `catalogue_id_index`, `cip`, `cid`) VALUES
(342543, 'Black teamdeath match gate', 'this one is used for team deathmatch!!', 5, 1, 1, 1, 0.00, 'one_way_door*8', '#525252,#ffffff,#525252', 100, '0', '1', '1', 20, 0, 0),
(342544, 'Yellow teamdeath match gate', 'this one is used for team deathmatch!!', 5, 1, 1, 1, 0.00, 'one_way_door*9', '#FFD837,#ffffff,#FFD837', 100, '0', '1', '1', 20, 0, 0);
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,195
3,906
Lol, Glad ya like it, The code bits are all simply code. xD.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,195
3,906
Cheers, But I did release this like ages ago, lol.
 

Kieren

The OGz
Aug 4, 2010
2,957
751
It must of been bumped then haha thank you anyways I'll try it with my hotel also is there a similar games with brawl like this because that seems to be a good game.
 
Status
Not open for further replies.

Users who are viewing this thread

Top