Discussion on [Release] Extremely basic (but working/bugless) C# Source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
Switches are quicker and less resource using since they don't carry out each argument, they go straight to the case.
That's not strictly true. The code needs to fall through each case and check its value before deciding whether or not to execute it's contents. It will though, stop falling through each after executing your code when you put a break in there. To the machine though, the difference between using a switch and if/else statements is negligible
The real difference between the two is from the programmers point of view. swicthes are more self-descriptive when used properly. It's easier to read and follow through compared with if/elses. It's easier to write the code as a switch, and mainly, it's much easier to maintain (ie, by changing values, adding additional cases etc).
The real difference between the two is from the programmers point of view. swicthes are more self-descriptive when used properly. It's easier to read and follow through compared with if/elses. It's easier to write the code as a switch, and mainly, it's much easier to maintain (ie, by changing values, adding additional cases etc).
I agree with the fact that switches are more cleaner in a script. I allways use switches in my scripts, and only use if/else statements if the varible's im using are say 2 or below.
Also theres another point about switches. If you do use switches the compiler will optimize it to a look up table, and with if/else statements cannot. The only downside to switches is the fact that you can't use a single varible to define as the case. You have to use the constant value.
Yo can someone help me?
I'm trying to add prof's i saw Alex's Prof class and I downloaded Tao's 3.1 Rev.
I see that Alex's prof class looks like the ProfPacket class from Tao's 3.1 Rev.
But I don't really know how to use Tao's class I think its sorta same as Alex's
I guess: ProfPacket club = new ProfPacket(); club.ID = 480; club.Level = 19; club.Experience = 192321; Client.Send(club.Serialize());
Thats how I think its used, but I need a bit more info :P
Where do I need to code something that will add the prof to the client?
Like when i use @prof 480 20 it has to give me prof level 20 of Club :P
I have a feeling its done with Client.Send(club.Serialize()); but I dont really know.
Uhm about saving in in the database I think I need to make an Array of Prof's
like its done with Items and then make a folder like Inventory but then I name it Profiency. And loading it from the database is sorta same as loading Inventory I think?
Thnx very much for responding and for ur information both Alex and tao.
I got another question :P If i use the command @prof 480 2 or any numer :P it doesn't show anything in the prof list in the client. I think its because there isn't coded which Prof ID is which Prof like Prof 480 is club and it doesn't do anything I think. If its true what I say can you tell me where to code that and maybe give me 1 example how you coded 1 prof? I learned Java and thats very similar to C++ so its not hard to understand code for me :P
[Huge-Release] All-In-One Basic NPC Scripts For The 5165 Source! 02/19/2010 - CO2 PServer Guides & Releases - 30 Replies Well I'm sorry that I spammed the whole forum full of my posts So pro4never and .Ryu gave me the idea of making this All-In-One thread about all my NPC's! THESE ARE UPDATED DAILY!
NOTE: TO PEOPLE... SOME OF THE CODES ARE NOT MADE BY ME! I USUALLY JUST FIXED/UPDATED THE BASIC ONES! SORRY I'M LEARNING ON HOW TO CODE!
1. Birth-Island-NPC's(The NPC text is not from "REAL CONQUER" SORRY!...)
#region BirthOldGeneralYang
case 425:
{
[RELEASE] Basic LOTF Source 09/03/2009 - CO2 PServer Guides & Releases - 17 Replies hey this is a basic lotf source edited based off shadowco, if you dont like it then dont post here... flames will be told on!!! :D i will tell on you to the mods if you flame
What it has...
- LuckyTime
- Guard
- 24/7 GW