I made this tutorial for @SaviouR9966 and offcourse any other people who needs it
Well most of the people know this info already, but for the new people:
I made some basic commands to help you making carepackage boxes.
First of all the basics on making a plugin:
1 Make a new project in visual studio.
2 Make 2 classes, Extensions.cs and Boxes.cs
3 Copy and paste the code from this to extensions.cs topic made by@master131
4 Put those parts of code in Boxes.cs
Add the even onchatsay to make some usefull commands for making boxes.
Than add the chatcommands :
Than add the event OnMapChange.
Add this line of code to make a string called map
Than add your map you want
Now place the boxes code.
Be sure to place the } when needed (Everytime you open one, you also have to close it)
5 Save the project
6 Go to Project > <yourprojectname> properties
7 Click on Application.
8 Set the Netwerk framework to 3.0
9 Than compile it
USEFULL FOR COMPILING:
http://www.itsmods.com/forum/Thread-How-...noobs.html
Final code if you or me did something wrong:
If you have any questions just ask.
EDIT:
Usefull code made by @8q4s8
Place this code:
After this :
Put this on the event OnSay:
Writing it to a text file made by @8q4s8 thanks <3
Well most of the people know this info already, but for the new people:
I made some basic commands to help you making carepackage boxes.
First of all the basics on making a plugin:
1 Make a new project in visual studio.
2 Make 2 classes, Extensions.cs and Boxes.cs
3 Copy and paste the code from this to extensions.cs topic made by@master131
4 Put those parts of code in Boxes.cs
Code:
using System;
using Addon;
namespace Addon
{
public class Boxes : CPlugin // Always use : CPlugin behind your class name
{
Add the even onchatsay to make some usefull commands for making boxes.
Code:
public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat)
{
Than add the chatcommands :
Code:
if (Message == "!noclip") // This will let you fly through walls
{
Client.Other.NoClip = !Client.Other.NoClip; // Smart code from koro35
return ChatType.ChatNone;
}
if (Message == "!pos") // This will let you fly through walls
{
ServerPrint(Client.Name + "is on the position X: " + Client.OriginX + " Y: " + Client.OriginY + " Z: " + Client.OriginZ); // Serverprints the coords
TellClient(Client.ClientNum, "You are on the position X: " + Client.OriginX + " Y: " + Client.OriginY + " Z: " + Client.OriginZ, true); // Send a message to client
return ChatType.ChatNone;
}
}//This will end the event
Than add the event OnMapChange.
Code:
public override void OnMapChange() // The event OnMapChange
{
Code:
string map = GetDvar("mapname");
Code:
if (map == "mp_dome") // In this case I use dome to close the stairs to the dome
Code:
{
Entity domeleft = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(462f, 108f, -220f)); //Creates an entity named domeleft and spawns a model on the coordinates 462f, 108f, -220f
Entity domeright = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-373f, -103f, -220f)); //Creates an entity named domeright and spawns a model on the coordinates -373f, -103f, -220f
Extensions.CloneBrushModelToScriptModel(domeleft, Extensions.FindAirdropCrateCollisionId()); // Makes the entity domeleft solid
Extensions.CloneBrushModelToScriptModel(domeright, Extensions.FindAirdropCrateCollisionId()); // Makes the entity domeright solid
}
}
}
}
5 Save the project
6 Go to Project > <yourprojectname> properties
7 Click on Application.
8 Set the Netwerk framework to 3.0
9 Than compile it
USEFULL FOR COMPILING:
http://www.itsmods.com/forum/Thread-How-...noobs.html
Final code if you or me did something wrong:
Code:
using System;
using Addon;
namespace Addon
{
public class Boxes : CPlugin // Always use : CPlugin behind your class name
{
public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat)
{
if (Message == "!noclip") // This will let you fly through walls
{
Client.Other.NoClip = !Client.Other.NoClip; // Smart code from koro35
return ChatType.ChatNone;
}
if (Message == "!pos") // This will let you fly through walls
{
ServerPrint(Client.Name + "is on the position X: " + Client.OriginX + " Y: " + Client.OriginY + " Z: " + Client.OriginZ); // Serverprints the coords
TellClient(Client.ClientNum, "You are on the position X: " + Client.OriginX + " Y: " + Client.OriginY + " Z: " + Client.OriginZ, true); // Send a message to client
return ChatType.ChatNone;
}
} // This } will end the event
public override void OnMapChange() // The event OnMapChange
{
string map = GetDvar("mapname");
if (map == "mp_dome") // In this case I use dome to close the stairs to the dome
{
Entity domeleft = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(462f, 108f, -220f)); //Creates an entity named domeleft and spawns a model on the coordinates 462f, 108f, -220f
Entity domeright = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-373f, -103f, -220f)); //Creates an entity named domeright and spawns a model on the coordinates -373f, -103f, -220f
Extensions.CloneBrushModelToScriptModel(domeleft, Extensions.FindAirdropCrateCollisionId()); // Makes the entity domeleft solid
Extensions.CloneBrushModelToScriptModel(domeright, Extensions.FindAirdropCrateCollisionId()); // Makes the entity domeright solid
}
} // This will end the event
}
}
If you have any questions just ask.
EDIT:
Usefull code made by @8q4s8
Place this code:
Code:
int ent = 0;
float locationX = Client.OriginX;
float locationY = Client.OriginY;
float locationZ = Client.OriginZ;
After this :
Code:
public class Boxes : CPlugin // Always use : CPlugin behind your class name
{
Put this on the event OnSay:
Code:
if (Message.ToLower().StartsWith("!box"))
{
Entity entdefault = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(locationX, locationY, locationZ));
Extensions.CloneBrushModelToScriptModel(entdefault, Extensions.FindAirdropCrateCollisionId());
ent++;
ServerPrint("Entity ent" + ent + " = SpawnModel(" + "script_model" + "," + "com_plasticcase_trap_friendly" + "," + "new Vector(" + locationX + "f" + "," + locationY + "f" + "," + locationZ + "f" + "))" + ";");
Client.OriginZ += 40f;
return ChatType.ChatNone;
}
else if (Message.ToLower().StartsWith("!ent")) // this is for changing the entity number if you restarted the server or placed a box in the wrong location
{
string[] split = Message.Split(' ');
try
{
ent = int.Parse(split[1]);
}
catch
{
return ChatType.ChatContinue;
}
}
Writing it to a text file made by @8q4s8 thanks <3
Code:
string map = GetDvar("mapname");
StreamWriter writer = new StreamWriter("C:\\Mw3\\Entity\\" + map + ".txt", true);
writer.WriteLine("Entity ent" + ent + " = SpawnModel(" + "script_model" + "," + "com_plasticcase_trap_friendly" + "," + "new Vector(" + locationX + "f" + "," + locationY + "f" + "," + locationZ + "f" + "))" + ";");
writer.Dispose();
writer.Close();