ItsMods

Full Version: [CODE][TUT]Boxes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
@8q4s8 thanks anyway Tongue
But I did post it in steps 7,8,9 or something like that Tongue
But thanksSmile
is it possible if u can make an video?
(01-08-2013, 19:37)EnVi Sweden Rocks Wrote: [ -> ]is it possible if u can make an video?

What should I do in it? Make the code live? Tongue
If you want that I can maybe do it, but not today I got an test in 20 minutes so I need to learn for that , and I will be late back.
Maybe tomorrow
(01-08-2013, 19:33)99IRock Wrote: [ -> ]Noo Tongue, look In my topic at the lower bottom I expained it (where to place it)
place it after
CSHARP Code
  1. public class Boxes : CPlugin // Always use : CPlugin behind your class name
  2. {


@8q4s8 I would like to have that Smile

Writing it to a textfile:

CSHARP Code
  1. string map = GetDvar("mapname");
  2. StreamWriter writer = new StreamWriter("C:\\Mw3\\Entity\\" + map + ".txt", true);
  3.  
  4. writer.WriteLine("Entity ent" + ent + " = SpawnModel(" + "script_model" + "," + "com_plasticcase_trap_friendly" + "," + "new Vector(" + locationX + "f" + "," + locationY + "f" + "," + locationZ + "f" + "))" + ";");
  5. writer.Dispose();
  6. writer.Close();
np man, i can wait Smile
(01-08-2013, 18:44)99IRock Wrote: [ -> ]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

Extensions.cs

is it only that code i need to copy, not the other ones? (step 3)
You need to click on "this" and than copy the code of extensions.cs there, and paste it in your extensions.cs
The link was wrong, I fixed it
http://www.itsmods.com/forum/Thread-Rele...3#pid94703
Sorry :p
I made everything according to the instruction but at compilation of this code:
Code:
using System;

using Addon;

namespace Addon
{
    public class Boxes : CPlugin //  : CPlugin  
    {
        public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat)
        {
if (Message == "!noclip") //    
            {
            Client.Other.NoClip = !Client.Other.NoClip; //    koro35
            Return ChatType.ChatNone;

            }
if (Message == "!pos") //    
            {
             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;
            }
} //  }    

        public override void OnMapChange() // The event OnMapChange
        {
            string map = GetDvar("mapname");
            if (map == "mp_dome") //     -    
            {
                Entity domeleft = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(462f, 108f, -220f)); //    domeleft   462f, 108f, -220f
                Entity domeright = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-373f, -103f, -220f)); //    domeright    -373f, -103f, -220f
                Extensions.CloneBrushModelToScriptModel(domeleft, Extensions.FindAirdropCrateCollisionId()); //  
                Extensions.CloneBrushModelToScriptModel(domeright, Extensions.FindAirdropCrateCollisionId()); //  
            }
        } //    
    }
}
There are these mistakes:
Mistake 1 Inadmissible element "."
The mistake 2 Is required ";"
The mistake 3 Is required ";"

In this line:
Code:
Return ChatType.ChatNone;

How to correct it?
Good tutorial, wrong section. Moved.

return is a keyword and shouldn't be capitalized.
(01-09-2013, 08:12)ltybcs Wrote: [ -> ]How to correct it?

Code:
using System;
using Addon;

namespace Addon
{
    public class Boxes : CPlugin //  : CPlugin  
    {
        public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat)
        {
            if (Message == "!noclip") //    
            {
                Client.Other.NoClip = !Client.Other.NoClip; //    koro35
                return ChatType.ChatNone;
            }
            
            if (Message == "!pos") //  
            {
                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;
            }
            
            return ChatType.ChatContinue;
        } //  }  

        public override void OnMapChange() // The event OnMapChange
        {
            string map = GetDvar("mapname");
            if (map == "mp_dome") //     -    
            {
                Entity domeleft = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(462f, 108f, -220f)); //    domeleft   462f, 108f, -220f
                Entity domeright = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-373f, -103f, -220f)); //    domeright    -373f, -103f, -220f
                Extensions.CloneBrushModelToScriptModel(domeleft, Extensions.FindAirdropCrateCollisionId()); //  
                Extensions.CloneBrushModelToScriptModel(domeright, Extensions.FindAirdropCrateCollisionId()); //  
            }
        } //    
    }
}
Pages: 1 2 3 4 5