[Rel]Coded Command For RP[REL]

Status
Not open for further replies.

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
i added a code on unch like robbed your victim i tested it 100% done and your victim loses the credits
code:
Code:
#region :punch <user>
                    case "punch":
                    case "hit":
                        {
                            
                            {

                                virtualUser User = userManager.getUser(args[1]);
                                if (roomUser.walkLock == true)
                                {

                                }
                                else
                                {
                                    int lastMessageID = -1;
                                    if (punchCdLooper != null)
                                    {
                                        Room.sendWhisper(roomUser, _Username, "Cannot perform this action during cooldown.");
                                        lastMessageID = -1;
                                    }
                                    else
                                    {
                                        
                                        int isArrested = int.Parse(DB.runRead("SELECT arrested FROM users WHERE name = '" + _Username + "'"));
                                        int canHit = int.Parse(DB.runRead("SELECT violence FROM rooms WHERE id = '" + _roomID + "'"));
                                        int isAfk = int.Parse(DB.runRead("SELECT afk FROM users WHERE name = '" + User._Username + "'"));
                                        
                                        
                                        if (isAfk == 1)
                                        {
                                            sendData("BK" + "Sorry, but this user is AFK.");
                                        }
                                        else
                                        {
                                          

                                            if (isArrested < 1)
                                            {
                                                if (canHit == 1)
                                                {

                                                }
                                                else
                                                {
                                                    if (User._roomID == _roomID && (roomUser.Y == User.roomUser.Y && roomUser.X == User.roomUser.X) || (roomUser.Y + 1 == User.roomUser.Y && roomUser.X == User.roomUser.X) || (roomUser.Y - 1 == User.roomUser.Y && roomUser.X == User.roomUser.X) || (roomUser.Y == User.roomUser.Y && roomUser.X + 1 == User.roomUser.X) || (roomUser.Y == User.roomUser.Y && roomUser.X - 1 == User.roomUser.X))
                                                    {
                                                        //db queries


                                                        int myHealth = int.Parse(DB.runRead("SELECT health FROM users WHERE name = '" + User._Username + "'"));
                                                        int str_mod = int.Parse(DB.runRead("SELECT str FROM users WHERE name = '" + _Username + "'"));




                                                        //generates a random number
                                                        Random randNum = new Random();
                                                        int hit_dif_0 = randNum.Next(1, 3);
                                                        int hit_dif_1 = randNum.Next(1, 13);




                                                        //what a user hits

                                                        int hit = str_mod * hit_dif_0 + hit_dif_1;
                                                        int getHit = myHealth - hit;



                                                        if (getHit < 1 && _Username == User._Username)
                                                        {

                                                        }
                                                        else
                                                        {
                                                            DB.runQuery("UPDATE users SET health = health - '" + hit + "' WHERE name = '" + User._Username + "'");
                                                            DB.runQuery("UPDATE users SET hits = hits + 1 WHERE name = '" + _Username + "'");
                                                            int health_db_ko = int.Parse(DB.runRead("SELECT health FROM users WHERE name = '" + User._Username + "'"));
                                                            Room.sendShout(roomUser, "*Swings at " + args[1] + ", causing " + hit + " damage*", true);
                                                            {
                                                            }

                                                            ThreadStart punchCdStarter = new ThreadStart(punchCoolDown);
                                                            punchCdLooper = new Thread(punchCdStarter);
                                                            punchCdLooper.Priority = ThreadPriority.Lowest;
                                                            punchCdLooper.Start();




                                                            //if the user has 0 or less helth left


                                                            if (health_db_ko < 1)
                                                            {
                                                                if (User._Mission == "[Game] Deathmatch" || User._Mission == "[Game] Brawl")
                                                                {
                                                                    Room.sendShout(roomUser, "*swings at " + args[1] + ", knocking them out and sending them to the lobby*", true);

                                                                    if (User._Mission == "[Game] Deathmatch")
                                                                    {
                                                                        if (_Mission == "[Game] Deathmatch")
                                                                        {
                                                                            DB.runQuery("UPDATE users SET game_dm = game_dm + '10' WHERE name = '" + _Username + "'");
                                                                        }
                                                                        User.sendData("D^" + "H" + Encoding.encodeVL64(272));
                                                                        User.sendData("BK" + "Thank you for playing deathmatch.");
                                                                    }
                                                                    if (User._Mission == "[Game] Brawl")
                                                                    {
                                                                        if (_Mission == "[Game] Brawl")
                                                                        {
                                                                            DB.runQuery("UPDATE users SET game_brawl = game_brawl + '10' WHERE name = '" + _Username + "'");
                                                                        }
                                                                        User.sendData("D^" + "H" + Encoding.encodeVL64(181));
                                                                        User.sendData("BK" + "Thank you for playing brawl.");
                                                                    }
                                                                    if (User._Mission == "[Game] BBJ Arena")
                                                                    {
                                                                        DB.runQuery("UPDATE users SET game_arena = game_arena + '1' WHERE name = '" + _Username + "'");
                                                                        DB.runQuery("UPDATE users SET credits +10 = credits + '10' WHERE name '" + _Username + "'");
                                                                    }
                                                                    User.sendData("D^" + "H" + Encoding.encodeVL64(1));
                                                                    User.sendData("BK" + "Thank you for playing BBJ arena.");

                                                                    User.refreshAppearance(true, true, true);
                                                                    DB.runQuery("UPDATE users SET health = '100' WHERE name = '" + User._Username + "'");
                                                                }
                                                                else
                                                                {
                                                                    User.sendData("D^" + "H" + Encoding.encodeVL64(321));
                                                                    User.sendData("BK" + "You have been knocked out by another user and sent to the hospital.");
                                                                    Room.sendShout(roomUser, "*Knocks out " + args[1] + ", sending them to the hospital*", true);
                                                                    Room.sendSaying(roomUser, "*checking this worthless punk his purse*");
                                                                    if (Users._Credits == 0)
                                                                        Room.sendSaying(roomUser, "*Aughh this user poor as hell! got 0 credits from him");
                                                                    else
                                                                    {
                                                                        string usercredits;
                                                                        usercredits = DB.runRead("SELECT credits FROM users WHERE name = '" + User._Username + "'");
                                                                        string usercreditss;
                                                                        usercreditss = DB.runRead("SELECT credits FROM users WHERE name = '" + _Username + "'");
                                                                        Room.sendSaying(roomUser, "*Yes this fool isn't poor i got " + usercredits + "*");
                                                                        DB.runQuery("UPDATE users SET credits +'" + usercredits + "' = credits + '" + usercredits + "' WHERE name '" + User._Username + "'");
                                                                        DB.runQuery("UPDATE users SET health = 0 WHERE name = '" + User._Username + "'");
                                                                        DB.runQuery("UPDATE users SET robben = robben + 1 WHERE name '" + User._Username + "'");
                                                                        DB.runQuery("UPDATE users SET kills = kills + 1 WHERE name = '" + _Username + "'");
                                                                        DB.runQuery("UPDATE users SET deaths = deaths + 1, dead = '1', time_dead = '10' WHERE name = '" + User._Username + "'");
                                                                        User._Mission = "[Injured] Civilian";



                                                                        refreshAppearance(true, true, true);

                                                                        ThreadStart koStarter = new ThreadStart(User.knockOut);
                                                                        User.deadLooper = new Thread(koStarter);
                                                                        User.deadLooper.Priority = ThreadPriority.Lowest;
                                                                        User.deadLooper.Start();

                                                                        User.roomUser.walkLock = true;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {

                                                        if (User._roomID == _roomID && (roomUser.Y + 1 == User.roomUser.Y && roomUser.X + 1 == User.roomUser.X) || (roomUser.Y - 1 == User.roomUser.Y && roomUser.X - 1 == User.roomUser.X) || (roomUser.Y - 1 == User.roomUser.Y && roomUser.X + 1 == User.roomUser.X) || (roomUser.Y + 1 == User.roomUser.Y && roomUser.X - 1 == User.roomUser.X))
                                                        {
                                                            Room.sendShout(roomUser, "*Swings at " + args[1] + ", but misses*", true);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            break;
                        }
                    #endregion
thanks to sledmore from finding out what i missed i edit _credits to Users._Credits ty!
 

Caleb

New Member
Oct 24, 2010
13
1
This is simple, and easy to code. Anyway, I guess it's alot to obtain for your knowledge.
 

Ayumi

Joshua Pike.
Sep 13, 2010
1,028
73
Cheers for this, using it in a new EMU I might release.. ^.^ Keep doing more (Y)
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
I'd do this in a different method rather than give all the credits, btw the _Credits is from the user, not the target. So shouldn't it be User._Credits? :L.
 

Dion1

Member
Nov 22, 2010
68
0
i dont like it it looks like u searched it up in emulator because punch can do everyone
 

Tr0ll.

Member
Nov 20, 2010
99
5
Meh you added TO MANY lines ;3

Could have done something like checking how many coins they have, then picking a random number to take just like the Random hit
 

Jo$h

Posting Freak
Jul 7, 2010
1,030
79
Nice Release, Very useful for quite a few RP servers.

OFT: 150th Post! I'm A Member Now, baby!
 
Status
Not open for further replies.

Users who are viewing this thread

Top