Author Topic: Two server.cs *New dificulty*  (Read 3249 times)

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?
« Last Edit: January 18, 2011, 11:00:32 PM by slimabob »

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');

So like this?

Code: [Select]
//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');
{

Secondserver.cs is just an example of the other server.cs
« Last Edit: January 18, 2011, 02:24:49 AM by slimabob »

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?

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: [Select]
//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');

To just have it in there twice but replace "Gun" with the other required addon? (In this case, "Shotgun")
« Last Edit: January 18, 2011, 02:39:12 AM by slimabob »

Code: [Select]
%error = ForceRequiredAddOn("Weapon_Gun");
if(%error == $Error::AddOn_Disabled)
{
GunItem.uiName = "";
}
if(%error == $Error::AddOn_NotFound)
{
error("ERROR: Weapon_Minishot - required add-on Weapon_Gun not found");
return;
}
%error = ForceRequiredAddOn("Weapon_Shotgun");
if(%error == $Error::AddOn_Disabled)
{
ShotgunItem.uiName = "";
}
if(%error == $Error::AddOn_NotFound)
{
error("ERROR: Weapon_Minishot - required add-on Weapon_Shotgun not found");
return;
}
exec('./secondserver.cs');
Do it like that. Put your weapon in secondserver.cs.

Alright, thanks. Ill try it out to see if it works.

I still don't understand why you need a second file though.

Because I wasn't sure if I needed two files, since they contained the same information just with slightly modified text. I thought that maybe that it would confuse the system.

Also: New problem. The addon won't show up in my addons menu. I am posting a link in about an hour, seeing as I have to go somewhere.

I still don't understand why you need a second file though.
Thank you.

You do NOT need two files, just jam the contents of secondserver.cs into where it executes secondserver.cs

You do NOT need two files, just jam the contents of secondserver.cs into where it executes secondserver.cs

Fixed that.

Here is the link also. Please do not flame me based on the face that I am basically combining two addons. I just want to prove to myself that I can. Don't worry. It would never be released and once it is fixed I will remove this link here.

To reiterate, I need to find out why it isn't showing up in my addons menu.

http://www.mediafire.com/?biaoybna88lo5a8

Arg, why do people use mediafire.
I click download and nothing happens.

Ill upload it to a different site. Just one second.

EDIT: Better?

http://www.4shared.com/file/BSh7MJGY/Weapon_Minishot.html
« Last Edit: January 18, 2011, 09:58:20 PM by slimabob »

lol, you used banana. but seriously, just copy everything from the banana.cs, and put it where it says exec banana.

I thought I did..
Re-uploading check back in a minute.

EDIT: This should be the right one.. http://www.4shared.com/file/peeLccRz/Weapon_Minishot.html

So, why isn't it showing up in addons?
« Last Edit: January 18, 2011, 10:33:44 PM by slimabob »