[TUTORIAL][CODING] C# Tutorial for HabboRP Basic! [CODING][TUTORIAL]

Al-Santoro

New Member
Jan 20, 2011
29
5
Introduction:
Right, I've never made a little tutorial about "C# Coding" before, but this is a little simple tutorial for the ones who had trouble with C#. Now, let's start?

Finding the Coding Location
Before doing anything, you must first download Microsoft C#.
--- [Link will be posted here, after I found the site]. ---

Now, you'll need to start off with a little basic Emulator, I recommend using Rasta's for a head start. After you've done that, open up the files and click on "Holograph Emulator.csproj."

After you've open that, go to Source >> Virtual >> Users >> virtualuser.cs.

The Basics
Now, if you like being very organized with your codings, I suggest doing this:

Code:
#region :<code name here>
This is used to organize codes, so it won't be too messy..

Now, let's say that we're doing a drunk command, we'll need to first start off doing this:
Code:
#region :drunk // For Organization.
case "drunk": // You need this part in order to name the code, of course.
case "drinking": // You can give it more names if you want.

Right, now if you would like to add some effect into it, such as losing HP & Credits, you'll need to add this:

Code:
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
Add this code right after you've named your code with case "CODEHERE":
Now, it's time for the tricky part. [For all of you, of course]. Since some of you want effects into your command, add this part right under the following snippet I just posted.
Code:
dbClient.runQuery("UPDATE user SET health = health = -'[B]INPUT ANY HP YOU WANT TO BE TAKEN AWAY HERE[/B]' WHERE name = '" + _Username + "'");

So, your outcome should be:

Code:
#region :drunk
case "drunk":
case "drinking":
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.runQuery("UPDATE user SET health = health = '25' WHERE name = 
'" + _Username + "'");

Hold on, you're not finished first, you'll have to add at least some text in it, if you don't then, skip this step.. [Recommended not to, so it wouldn't confuse you].

If you want, you could also make the user lose credits! It's simple, just add this in:

Code:
dbClient.runQuery("UPDATE user SET credits = credits = '[B]THE AMOUNT OF CREDITS YOU WANT THE USER TO LOSE HERE[/B]' WHERE name = '" + _Username + "'");

Now, if you want your user to say something, you may wanna add this..
Code:
Room.sendSaying(roomUser, "TEXT HERE");
If you want the user to shout, you may wanna add this then:
Code:
Room.sendShouting(roomUser, "TEXT HERE");
If you want the user to whisper to themself, add this: [This is different]:
Code:
Room.sendWhisper(roomUser, _Username, "TEXT HERE!");
Now, if you'd like to add a mission to it, then add this:
Code:
_Mission = "YOUR MISSION HERE.";
Now, in order for the mission to be shown, add this:
Code:
refreshAppearance( false, true, true);

It's now time to end the code. Input this:
Code:
}
}
break;
#endregion

Now, let's put this all together.
Code:
#region :drunk
case "drunk":
case "drinking":
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.runQuery("UPDATE user SET health = health = - '25' WHERE name = 
'" + _Username + "'");
dbClient.runQuery("UPDATE user SET credits = credits = - '50' WHERE name = '" + _Username + "'");
Room.sendSaying(roomUser, "*Opens up a can of beer and gets drunk*");
sendData("BK" + "You're now drunk!"); [B]//Forgot to add this, this is for the little popup message that you could add. (Optional).[/B]
_Mission = "[Drunk] This user is drinking to much beer.";
refreshAppearance( false, true, true);
}
}
break;
#endregion

This is the complete tutorial of how to add an easy command such as this. If you want, you could review other commands and learn from that. ;]
 

Giovanni

New Member
Feb 9, 2011
2
0
Like it, hopefully to see more of youre working,

about this i place the

#region :drunk
case "drunk":
case "drinking":
{
using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
{
dbClient.runQuery("UPDATE user SET health = health = - '25' WHERE name =
'" + _Username + "'");
dbClient.runQuery("UPDATE user SET credits = credits = - '50' WHERE name = '" + _Username + "'");
Room.sendSaying(roomUser, "*Opens up a can of beer and gets drunk*");
sendData("BK" + "You're now drunk!"); //Forgot to add this, this is for the little popup message that you could add. (Optional).
_Mission = "[Drunk] This user is drinking to much beer.";
refreshAppeareance( false, true, true);
}
}
break;
#endregion

then its working right?

[MOD]Double posting, posts merged - Sledmore.[/MOD]
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,194
3,901
Wouldn't code the drunk command like this, however, nicely put tutorial I guess.
 

Al-Santoro

New Member
Jan 20, 2011
29
5
@Kieren

Thanks. ;] I'll be working on some more soon. ;D

@Giovanni

Yeah, that code should work, and plus, Live tested it on his RP, so it works. ;]

@Sledmore

Yeh, I'm still trying to learn more about C# and such. ;] And thanks. ;D
 

Jake7282

Believe you can and you're halfway there.
Jan 2, 2012
238
12
Nice. I am hoping some more RP's are coming out soon! Im waiting for HabboRP to come out but, it is taking forever. And Sledmore's is down I believe! StreetRP sucks! no offense! Nice Tutorial man :up:
 

RyanzRetros

Developer of ChakCMS
Jan 14, 2015
978
182
Looks good, would you mind adding my Skype? I am looking for someone to do me a custom edit of Gold Tree emulator.
 

Users who are viewing this thread

Top