Blockland Forums > Modification Help

Two server.cs *New dificulty*

Pages: (1/5) > >>

slimabob:

In my server.cs I am stating that you need an addon to for the weapon to work, then I realized that two addons are required for this to function correctly. Would I need two server.cs files, or could it all go into one?

Nexus:

you can put as much code as you want into your server.cs, there is no limit.  However, If you want to make a second one, you should name it something other than "server.cs"  .  Instead, name it something like Banana.cs and have this line of code in the serrver.cs

exec('./Banana.cs');

slimabob:

So like this?


--- Code: ---//we need the gun add-on for this, so force it to load
%error = ForceRequiredAddOn("Weapon_Gun");

if(%error == $Error::AddOn_Disabled)
{
   //A bit of a hack:
   //  we just forced the gun to load, but the user had it disabled
   //  so lets make it so they can't select it
   GunItem.uiName = "";
}

if(%error == $Error::AddOn_NotFound)
{
   //we don't have the gun, so we're screwed
   error("ERROR: Weapon_Minishot - required add-on Weapon_Gun not found");
}
else
{
   exec("./Weapon_Minishot.cs");
}
   exec('./secondserver.cs');
{
--- End code ---

Secondserver.cs is just an example of the other server.cs

Nexus:

kinda, but it looks like you have a random { at the end that would cause a syntax error.  Why do you need a second one?

slimabob:

I just find it easier to do it that way for some reason. If I WERE to do it the other way, would it look like this?


--- Code: ---//we need the gun add-on for this, so force it to load
%error = ForceRequiredAddOn("Weapon_Gun");

if(%error == $Error::AddOn_Disabled)
{
   //A bit of a hack:
   //  we just forced the gun to load, but the user had it disabled
   //  so lets make it so they can't select it
   GunItem.uiName = "";
}

if(%error == $Error::AddOn_NotFound)
{
   //we don't have the gun, so we're screwed
   error("ERROR: Weapon_Minishot - required add-on Weapon_Gun not found");
}
else
{
   exec("./Weapon_Minishot.cs");

//we need the shotgun add-on for this, so force it to load
%error = ForceRequiredAddOn("Weapon_Shotgun");

if(%error == $Error::AddOn_Disabled)
{
   //A bit of a hack:
   //  we just forced the shotgun to load, but the user had it disabled
   //  so lets make[/quote] it so they can't select it
   ShotgunItem.uiName = "";
}

if(%error == $Error::AddOn_NotFound)
{
   //we don't have the shotgun, so we're screwed
   error("ERROR: Weapon_Minishot - required add-on Weapon_Shotgun not found");
}
else
{
   exec("./Weapon_Minishot.cs");

exec('./secondserver.cs');
--- End code ---

To just have it in there twice but replace "Gun" with the other required addon? (In this case, "Shotgun")

Pages: (1/5) > >>

Go to full version