Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Tutorials
[TUTORIAL][CODING] C# Tutorial for HabboRP Basic! [CODING][TUTORIAL]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Al-Santoro" data-source="post: 22525" data-attributes="member: 2264"><p><strong>Introduction:</strong></p><p>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?</p><p></p><p><strong>Finding the Coding Location</strong></p><p>Before doing anything, you must first download Microsoft C#. </p><p>--- [Link will be posted here, after I found the site]. ---</p><p></p><p>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." </p><p></p><p>After you've open that, go to Source >> Virtual >> Users >> virtualuser.cs.</p><p></p><p><strong>The Basics</strong></p><p>Now, if you like being very organized with your codings, I suggest doing this:</p><p></p><p>[CODE]#region :<code name here>[/CODE]</p><p>This is used to organize codes, so it won't be too messy..</p><p></p><p>Now, let's say that we're doing a drunk command, we'll need to first start off doing this:</p><p>[CODE]#region :drunk // For Organization.</p><p>case "drunk": // You need this part in order to name the code, of course.</p><p>case "drinking": // You can give it more names if you want.[/CODE]</p><p></p><p>Right, now if you would like to add some effect into it, such as losing HP & Credits, you'll need to add this:</p><p></p><p>[CODE]{</p><p>using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())</p><p>{[/CODE]</p><p>Add this code right after you've named your code with case "CODEHERE":</p><p>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.</p><p>[CODE]dbClient.runQuery("UPDATE user SET health = health = -'[B]INPUT ANY HP YOU WANT TO BE TAKEN AWAY HERE[/B]' WHERE name = '" + _Username + "'");[/CODE]</p><p></p><p>So, your outcome should be:</p><p></p><p>[CODE]</p><p>#region :drunk</p><p>case "drunk":</p><p>case "drinking":</p><p>{</p><p>using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())</p><p>{</p><p>dbClient.runQuery("UPDATE user SET health = health = '25' WHERE name = </p><p>'" + _Username + "'");</p><p>[/CODE]</p><p></p><p>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].</p><p></p><p>If you want, you could also make the user lose credits! It's simple, just add this in:</p><p></p><p>[CODE]dbClient.runQuery("UPDATE user SET credits = credits = '[B]THE AMOUNT OF CREDITS YOU WANT THE USER TO LOSE HERE[/B]' WHERE name = '" + _Username + "'");[/CODE]</p><p></p><p>Now, if you want your user to say something, you may wanna add this..</p><p>[CODE]Room.sendSaying(roomUser, "TEXT HERE");[/CODE] </p><p>If you want the user to shout, you may wanna add this then:</p><p>[CODE]Room.sendShouting(roomUser, "TEXT HERE");[/CODE]</p><p>If you want the user to whisper to themself, add this: [This is different]:</p><p>[CODE]Room.sendWhisper(roomUser, _Username, "TEXT HERE!");[/CODE]</p><p>Now, if you'd like to add a mission to it, then add this:</p><p>[CODE]_Mission = "YOUR MISSION HERE.";[/CODE]</p><p>Now, in order for the mission to be shown, add this:</p><p>[CODE]refreshAppearance( false, true, true);[/CODE]</p><p></p><p>It's now time to end the code. Input this:</p><p>[CODE]</p><p>}</p><p>}</p><p>break;</p><p>#endregion</p><p>[/CODE]</p><p></p><p>Now, let's put this all together.</p><p>[CODE]</p><p>#region :drunk</p><p>case "drunk":</p><p>case "drinking":</p><p>{</p><p>using(DatabaseClient dbClient = Eucalypt.dbManager.GetClient())</p><p>{</p><p>dbClient.runQuery("UPDATE user SET health = health = - '25' WHERE name = </p><p>'" + _Username + "'");</p><p>dbClient.runQuery("UPDATE user SET credits = credits = - '50' WHERE name = '" + _Username + "'");</p><p>Room.sendSaying(roomUser, "*Opens up a can of beer and gets drunk*");</p><p>sendData("BK" + "You're now drunk!"); [B]//Forgot to add this, this is for the little popup message that you could add. (Optional).[/B]</p><p>_Mission = "[Drunk] This user is drinking to much beer.";</p><p>refreshAppearance( false, true, true);</p><p>}</p><p>}</p><p>break;</p><p>#endregion</p><p>[/CODE]</p><p></p><p>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. ;]</p></blockquote><p></p>
[QUOTE="Al-Santoro, post: 22525, member: 2264"] [B]Introduction:[/B] 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? [B]Finding the Coding Location[/B] 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. [B]The Basics[/B] Now, if you like being very organized with your codings, I suggest doing this: [CODE]#region :<code name here>[/CODE] 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.[/CODE] 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()) {[/CODE] 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 + "'");[/CODE] 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 + "'"); [/CODE] 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 + "'");[/CODE] Now, if you want your user to say something, you may wanna add this.. [CODE]Room.sendSaying(roomUser, "TEXT HERE");[/CODE] If you want the user to shout, you may wanna add this then: [CODE]Room.sendShouting(roomUser, "TEXT HERE");[/CODE] If you want the user to whisper to themself, add this: [This is different]: [CODE]Room.sendWhisper(roomUser, _Username, "TEXT HERE!");[/CODE] Now, if you'd like to add a mission to it, then add this: [CODE]_Mission = "YOUR MISSION HERE.";[/CODE] Now, in order for the mission to be shown, add this: [CODE]refreshAppearance( false, true, true);[/CODE] It's now time to end the code. Input this: [CODE] } } break; #endregion [/CODE] 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 [/CODE] 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. ;] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Tutorials
[TUTORIAL][CODING] C# Tutorial for HabboRP Basic! [CODING][TUTORIAL]
Top