[RP] Staff One-Way-Gates

Results 1 to 25 of 25
  1. #1
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    [RP] Staff One-Way-Gates

    This is my first ever work in C#. It's not exactly advanced geophysics, but it's pretty handy. There are two gates in this, MOD and ADM. Your white gate will be for Moderators, and your yellow will be for Administrators. The MOD gate will only allow Rank 6 or above. The ADM gate will only allow Rank 7 or above. This was made for RastaLulz's RP Emulator (Based on Dissi's Edit of Holo).

    Instructions:

    1. Open virtualUser.cs (.../Virtual/Users/virutalUser.cs)

    2. Search "#region one way gate" without quotation marks.

    3. Select the whole region and delete it.

    4. Then add this region:

    Code:
                            #region one way gate
                            case "Ch": // Ch + ONE-WAY-DOOR-FURNI-ID (answer: Dx + WIRE(FURNI-ID) + I + WIRE(ROOM-UID-OF-CLICKER)) (sprite: 'one_way_door*#)
                                {
                                    if (Room == null || roomUser == null || _inPublicroom)
                                        return;
    
                                    int itemID = Encoding.decodeVL64(currentPacket.Substring(2));
                                    Rooms.Items.floorItem Item = Room.floorItemManager.getItem(itemID); // Find the item.
                                    try
                                    {
                                        if (Room.floorItemManager.containsItem(itemID) && stringManager.getStringPart(Item.Sprite, 0, 12) == "one_way_door")
                                        {
                                            if (Item.Sprite == "one_way_door*5")
                                            {
                                                int corp_id;
                                                int secure_id;
                                                int corphq;
                                                int userisarrested;
                                                int isworking;
                                                int global_job;
                                                using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                                {
                                                    corp_id = dbClient.getInt("SELECT corp_id FROM users WHERE name = '" + _Username + "'");
                                                    secure_id = dbClient.getInt("SELECT secure_id FROM users WHERE name = '" + _Username + "'");
                                                    isworking = dbClient.getInt("SELECT working FROM users WHERE name = '" + _Username + "'");
                                                    corphq = dbClient.getInt("SELECT room_id FROM jobs_rooms WHERE rank_id = '" + secure_id + "' && room_id = '" + _roomID + "'");
                                                    userisarrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + _Username + "'");
                                                    global_job = dbClient.getInt("SELECT global FROM jobs_ranks WHERE id = '" + secure_id + "'");
                                                }
                                                if (corphq != _roomID && corp_id != 1)
                                                {
                                                    sendData("BK" + "Sorry, but you must work here to enter this area.");
                                                    return;
                                                }
    
                                                if (isworking == 0)
                                                {
                                                    sendData("BK" + "You must have started work to enter.");
                                                    return;
                                                }
                                            }
    
                                            if (Item.Sprite == "one_way_door*3")
                                            {
                                                if (_Credits < 5)
                                                {
                                                    sendData("BK" + "You must have atleast five credits on you to go through this gate.");
                                                    return;
                                                }
                                                string roomOwner;
                                                using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                                {
                                                    roomOwner = dbClient.getString("SELECT owner FROM rooms WHERE id = '" + _roomID + "'");
                                                    dbClient.runQuery("UPDATE users SET credits = credits + '5' WHERE name = '" + roomOwner + "'");
                                                    dbClient.runQuery("UPDATE users SET credits = credits - '5' WHERE name = '" + _Username + "'");
                                                }
                                                refreshValueables(true, false);
                                                sendData("BK" + "You have been charged 5 credits for your toll.");
                                            }
    
                                            if (Item.Sprite == "one_way_door*1")
                                            {
                                                int userisarrested;
                                                using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
                                                {
                                                    userisarrested = dbClient.getInt("SELECT arrested FROM users WHERE name = '" + _Username + "'");
                                                }
                                                if (userisarrested == 1)
                                                {
                                                    return;
                                                }
                                            }
    
                                            if (Item.Sprite == "one_way_door*9")
                                            {
                                                if (_Rank < 2)
                                                {
                                                    sendData("BK" + "Sorry, but you must purchase VIP to use this gate.");
                                                    return;
                                                }
                                            }
    
                                            if (Item.Sprite == "one_way_door*8")
                                            {
                                                if (_Rank < 7)
                                                {
                                                    sendData("BK" + "Sorry, but you must be an Administrator to use this gate.");
                                                    return;
                                                }
                                            }
    
                                            if (Item.Sprite == "one_way_door*4")
                                            {
                                                if (_Rank < 6)
                                                {
                                                    sendData("BK" + "Sorry, but you must be a Moderator to use this gate.");
                                                    return;
                                                }
                                            }
    
                                            Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "I" + Encoding.encodeVL64(Room.roomID)); // Opens the gate, with green light
                                            Room.setSquareState(Item.X, Item.Y, 1, 1, virtualRoom.squareState.Open);
    
                                            roomUser.walkLock = true;
                                            switch (Item.Z) // Walk into the item
                                            {
                                                case 0: roomUser.goalY = Room.sqSTATE[Item.X, Item.Y + 1] == virtualRoom.squareState.Blocked ? Item.Y : Item.Y + 1; roomUser.goalX = Item.X; break;
                                                case 2: roomUser.goalX = Room.sqSTATE[Item.X - 1, Item.Y] == virtualRoom.squareState.Blocked ? Item.X : Item.X - 1; roomUser.goalY = Item.Y; break;
                                                case 4: roomUser.goalY = Room.sqSTATE[Item.X, Item.Y - 1] == virtualRoom.squareState.Blocked ? Item.Y : Item.Y - 1; roomUser.goalX = Item.X; break;
                                                case 6: roomUser.goalX = Room.sqSTATE[Item.X + 1, Item.Y] == virtualRoom.squareState.Blocked ? Item.X : Item.X + 1; roomUser.goalY = Item.Y; break;
                                                case 8: roomUser.goalY = Room.sqSTATE[Item.X, Item.Y - 1] == virtualRoom.squareState.Blocked ? Item.Y : Item.Y - 1; roomUser.goalX = Item.X; break;
                                                case 10: roomUser.goalX = Room.sqSTATE[Item.X + 1, Item.Y] == virtualRoom.squareState.Blocked ? Item.X : Item.X + 1; roomUser.goalY = Item.Y; break;
                                            }
                                            roomUser.walkLock = false;
    
                                            while (true)
                                                if (roomUser.statusManager.containsStatus("mv"))
                                                    break;
    
                                            Room.sendData("Dx" + Encoding.encodeVL64(itemID) + "H" + Encoding.encodeVL64(Room.roomID), 1000);
                                            Room.setSquareState(Item.X, Item.Y, 1, 1, virtualRoom.squareState.Blocked);
                                            break;
                                        }
                                    }
                                    catch { }
                                    break;
                                }
                            #endregion
    
                            #endregion
                    }
                    #endregion
                }
            }
            #endregion
    And you're done!


    Also if you want the External_Texts for these gates they're below. (You might have to find the original External_Texts for the Yellow and White gates because they already exist!)

    Code:
    furni_one_way_door*4_name=Moderator Entrance
    furni_one_way_door*4_desc=This gate only allows Moderators through.
    furni_one_way_door*8_name=Administrator Entrance
    furni_one_way_door*8_desc=This gate only allows Administrators through.

    Comments?


  2. #2
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: [RP] Staff One-Way-Gates

    Nice

  3. #3
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by cooldude159 View Post
    Nice
    Cheers :D

  4. #4
    Enthusiast Haxxo is offline
    MemberRank
    Dec 2010 Join Date
    40Posts

    Re: [RP] Staff One-Way-Gates

    nice :)

  5. #5
    Proficient Member swimoTheBig is offline
    MemberRank
    Aug 2008 Join Date
    Essex, UKLocation
    194Posts

    Re: [RP] Staff One-Way-Gates

    easy to code but thanks. Also, I wouldn't reccomend using this as thepacket for movign the user is buggy. if someone is on the over side, they will dc.

  6. #6
    Proficient Member superkulao is offline
    MemberRank
    Mar 2010 Join Date
    NorwayLocation
    166Posts

    Re: [RP] Staff One-Way-Gates

    Nice, can you add a VIP too?

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

    Re: [RP] Staff One-Way-Gates

    Nice work :]!

  8. #8
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by superkulao View Post
    Nice, can you add a VIP too?
    It's already there LOL.

    ---------- Post added at 05:06 PM ---------- Previous post was at 05:05 PM ----------

    Quote Originally Posted by Haxxo View Post
    nice :)
    cheers :D

    ---------- Post added at 05:24 PM ---------- Previous post was at 05:06 PM ----------

    Quote Originally Posted by swimoTheBig View Post
    easy to code but thanks. Also, I wouldn't reccomend using this as thepacket for movign the user is buggy. if someone is on the over side, they will dc.
    you couldnt get a fix for that could you?

    ---------- Post added at 05:25 PM ---------- Previous post was at 05:24 PM ----------

    Quote Originally Posted by habmoon View Post
    Nice work :]!
    cheers habmoon

  9. #9
    Account Upgraded | Title Enabled! Miggs is offline
    MemberRank
    Oct 2010 Join Date
    711Posts

    Re: [RP] Staff One-Way-Gates

    Nice.

  10. #10
    Account Upgraded | Title Enabled! salah-salah is offline
    MemberRank
    Jan 2009 Join Date
    UndergroundLocation
    716Posts

    Re: [RP] Staff One-Way-Gates

    Love it ;) nice work.

  11. #11
    hi i'm robbie Roper is offline
    MemberRank
    Oct 2008 Join Date
    /home/roperLocation
    2,283Posts

    Re: [RP] Staff One-Way-Gates

    Nice, but if I were you then I would of used a "switch" case rather than all those "if's"...

  12. #12
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by Miggs View Post
    Nice.
    haha cheers migz.

    ---------- Post added at 07:28 PM ---------- Previous post was at 07:27 PM ----------

    Quote Originally Posted by salah-salah View Post
    Love it ;) nice work.
    thanks bbz

  13. #13
    Ultra Light Beam Makarov is offline
    MemberRank
    Apr 2010 Join Date
    GothamLocation
    3,622Posts

    Re: [RP] Staff One-Way-Gates

    WARNING THIS IS A TROLL SESSION

    This was not needed period.

    This is why "rights" were coded in the first place.

    You gave us ALOT of extra code.

    And you could have just made a staff gate (y)

    2/10

  14. #14
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by Tr0ll.™ View Post
    WARNING THIS IS A TROLL SESSION

    This was not needed period.
    Actually some people did want this. Look up ^

    This is why "rights" were coded in the first place.
    So? This is just an alternate up for offer. If anyone needs it they'll take it

    You gave us ALOT of extra code.
    I gave the whole region to make it easier. The rest is still the same.

    And you could have just made a staff gate (y)
    Boring, HRP uses loads of one-way-gates for different ranks. Why not ranks 6 and 7?

    2/10
    Edited ^
    Last edited by R-Simmons; 24-02-11 at 09:00 PM.

  15. #15
    Banned c0mma is offline
    BannedRank
    Jan 2011 Join Date
    ^RaGEZONE^Location
    696Posts

    Re: [RP] Staff One-Way-Gates

    This code should be made also for Uber :D

  16. #16
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by iPixelHotel View Post
    This code should be made also for Uber :D
    can't do uber soz D:

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

    Re: [RP] Staff One-Way-Gates

    nice release.

  18. #18
    Banned c0mma is offline
    BannedRank
    Jan 2011 Join Date
    ^RaGEZONE^Location
    696Posts

    Re: [RP] Staff One-Way-Gates

    Mhm, good release tho anyway :)!

  19. #19
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by davidon View Post
    nice release.
    thanks dav.

    ---------- Post added at 04:39 PM ---------- Previous post was at 04:38 PM ----------

    Quote Originally Posted by iPixelHotel View Post
    Mhm, good release tho anyway :)!
    mhm?

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

    Re: [RP] Staff One-Way-Gates

    Good to actually see someone released this, no 1 ever wanted to release this nor working arrows so thanks alot!

  21. #21
    Member Habbi is offline
    MemberRank
    Feb 2011 Join Date
    88Posts

    Re: [RP] Staff One-Way-Gates

    Nicee

  22. #22
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by davidon View Post
    Good to actually see someone released this, no 1 ever wanted to release this nor working arrows so thanks alot!
    aha, yeah. arrows are a tricky one.

    ---------- Post added at 06:16 PM ---------- Previous post was at 06:14 PM ----------

    Quote Originally Posted by Habbi View Post
    Nicee
    thanks ;D

  23. #23
    Apprentice Ruteliux999 is offline
    MemberRank
    Jan 2011 Join Date
    9Posts

    Re: [RP] Staff One-Way-Gates

    I will use for my hotel thanks :}

  24. #24
    Alpha Member Zak© is offline
    MemberRank
    Oct 2007 Join Date
    2,693Posts

    Re: [RP] Staff One-Way-Gates

    keep working hard and all the codes will seeem easy

  25. #25
    Account Upgraded | Title Enabled! R-Simmons is offline
    MemberRank
    Jul 2010 Join Date
    Lancaster, UKLocation
    317Posts

    Re: [RP] Staff One-Way-Gates

    Quote Originally Posted by Ruteliux999 View Post
    I will use for my hotel thanks :}
    haha good to hear

    ---------- Post added at 04:00 PM ---------- Previous post was at 03:35 PM ----------

    Quote Originally Posted by Žak™ View Post
    keep working hard and all the codes will seeem easy
    yup, practice makes perfect.



Advertisement