Thread Rating:
  • 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release [CODE][TUT]Boxes
#21
I just ported some code from mw2, credits to @Killingdyl for original code.

Math_cs:
Code:
public static float Difference(float loc, float loc2)
        {
            return Math.Abs(loc - loc2);
        }
Code:
public int roundUp( float floatVal )
        {
            if ( (int) floatVal!= floatVal )
                return (int) floatVal+1;
            else
                return (int)floatVal;
        }

        public void CreateModel(string name, Vector pos)
        {
            Entity ent = SpawnModel("script_model", name, pos);
        }
        
          public void Ramps(Vector top, Vector bottom, int bb)
        {
            float top1 = top.X;
            
            int blocks = bb;//roundUp(D/30);
            float CX = top.X - bottom.X;
            float CY = top.Y - bottom.Y;
            float CZ = top.Z - bottom.Z;
            int XA = (int)CX/blocks;
            int YA = (int)CY/blocks;
            int ZA = (int)CZ/blocks;
            //CXY = Distance((top[0], top[1], 0), (bottom[0], bottom[1], 0));
            for(int b = 0; b < blocks; b++){
                Vector pos;
                float x1 = bottom.X;
                float y1 = bottom.Y;
                float z1 = bottom.Z;

                float x2 = XA * b;
                float y2 = YA * b;
                float z2 = ZA * b;
                
                pos = new Vector(x1+x2, y1+y2, z1+z2);

                Entity ent = SpawnModel("script_model", "com_plasticcase_trap_friendly", pos);

                Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId());
                //Extensions.SetAngles(ent, pos);
                //ServerPrint(Extensions.GetAngles(ent).X + " " + Extensions.GetAngles(ent).Y + " " + Extensions.GetAngles(ent).Z);
            }
        }

        public void CreateGrids(Vector corner1, Vector corner2, int howmuch, int rows)
        {
            float W = Math_.Difference(corner1.X, corner2.X);//Distance((corner1[0], 0, 0), (corner2[0], 0, 0));
            float L = Math_.Difference(corner1.Y, corner2.Y);
            float H = 100;//Math_.Difference(corner1.Z, corner2.Z);
            int CX = (int)corner2.X - (int)corner1.X;
            int CY = (int)corner2.Y - (int)corner1.Y;
            int CZ = (int)corner2.Z - (int)corner1.Z;
            int ROWS = rows;//roundUp(W/55);
            int COLUMNS = howmuch;//roundUp(L/30);
            int XA = CX/ROWS;
            int YA = CY/COLUMNS;
            int ZA = CZ/COLUMNS;
            for(int r = 0; r <= ROWS; r++){
                for(int c = 0; c <= COLUMNS; c++){
                    //for(int h = 0; h <= HEIGHT; h++){
                        int x1 = XA*r;
                        int y1 = YA*c;
                        int z1 = ZA;

                        int x2 = (int)corner1.X + x1;
                        int y2 = (int)corner1.Y + y1;
                        int z2 = (int)corner1.Z + z1;

                        Entity block = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(x2, y2, z2));
                        Extensions.CloneBrushModelToScriptModel(block, Extensions.FindAirdropCrateCollisionId());
                    //}
                }
            }
        }
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#22
(01-09-2013, 08:33)JariZ Wrote: Good tutorial, wrong section. Moved.

return is a keyword and shouldn't be capitalized.

Thank you, and I fixed return, sorry :p

@sailormoon
Can you maybe explain for that people what it does, so I can also add it too the post Smile
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#23
can this work?

Code:
using System;

using Addon;

namespace Addon
{
    public class Boxes : CPlugin  // always use: Behind Your Class
    {
        public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat
        {
if (Message == "!noclip") // This will let u fly through walls
        {
        Client.Other.NoClip = !Client.Other.Noclip; // Smart code from koro35
        return ChatType.ChatNone;

        }
if (Message == "!pos") // This will let u fly throught 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
     }
   }
  }
}
for if i copy the text u have does it not works. it comes 1.if in start and with second 2. u understand?
Code:
1.using System;2. 3.using Addon;4. 5.namespace Addon6.{7.    public class Boxes : CPlugin // Always use : CPlugin behind your class name8.    {
i get this if i copy it and it is hard to wrie every thing on that. do u can help me?
Reply

#24
(01-09-2013, 19:20)EnVi Sweden Rocks Wrote: for if i copy the text u have does it not works. it comes 1.if in start and with second 2. u understand?
Code:
1.using System;2. 3.using Addon;4. 5.namespace Addon6.{7.    public class Boxes : CPlugin // Always use : CPlugin behind your class name8.    {
i get this if i copy it and it is hard to wrie every thing on that. do u can help me?

Press the reply button on his post and copy the text between [.code=csharp][./code]
Reply

#25
@EnVi Sweden Rocks
The code you posted can work.
To compile it(make it a .dll to put it in your plugins folder), please look at this topic for a clear and good tutorial.
http://www.itsmods.com/forum/Thread-How-...noobs.html
Very usefull Wink

And I didn't understand your second question, what do you mean?
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#26
(01-09-2013, 19:33)99IRock Wrote: @EnVi Sweden Rocks
The code you posted can work.
To compile it(make it a .dll to put it in your plugins folder), please look at this topic for a clear and good tutorial.
http://www.itsmods.com/forum/Thread-How-...noobs.html
Very usefull Wink

And I didn't understand your second question, what do you mean?

He meant he can't copy your code because you used code=csharp but if you reply to the post you can copy it
Reply

#27
Updated post again, I changed the code use to the normal code, now people can easily copy paste it.
Thank you Smile
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#28
hey there, i had make Boxes and Exension to .dll files, but no one of them works on the server.
Code:
//////////////////////////////////////////
//////Dedicated server addon enabled//////
////Created by Nukem | www.itsmods.com////
////CoD8HMod | www.cod6hmod.itshax.com////
//////////////////////////////////////////

Version 1.413
Server timed messages successfully loaded!
Permission plugin loaded. Author: Pozzuh. Version 1.0 Beta
[ANTIRAGE] Command set to: kickclient | Show Message set to True
[ANTIRAGE] Threshold set to: 60 seconds

version 1.9.461
Command "seta" tried to modify non-archive external dvar "cg_headIconMinScreenRadius".
Invalid external archiving dvar "g_allowVote"; this code dvar is not an archiving type.  Resetting dvar.
Invalid external archiving dvar "sv_hostname"; this code dvar is not an archiving type.  Resetting dvar.
Connecting to online services....
Connected to online services.
Executing server config "server.cfg"
with Boxes, and
Code:
//////////////////////////////////////////
//////Dedicated server addon enabled//////
////Created by Nukem | www.itsmods.com////
////CoD8HMod | www.cod6hmod.itshax.com////
//////////////////////////////////////////

Version 1.413
Server timed messages successfully loaded!
Permission plugin loaded. Author: Pozzuh. Version 1.0 Beta
[ANTIRAGE] Command set to: kickclient | Show Message set to True
[ANTIRAGE] Threshold set to: 60 seconds
Teleport plugin loaded!

NoReconnect Plugin 1.1 loaded
Author: zxz0O0
Thanks to Nukem, Jariz, Pozzuh and Surtek

www.youtube.com/zxz0O0
www.itsmods.com


FOV Plugin loaded
Author: zxz0O0
Thanks to Nukem, Jariz, Pozzuh


ServerAd Plugin loaded
Author: zxz0O0
Thanks to Nukem, Jariz, Pozzuh and Makavel

www.youtube.com/zxz0O0
www.itsmods.com

Bonemind's ingame RCON v0.7.5 BETA loaded
Speed plugin for version 1.9.461 loaded. Author: Pozzuh.
Teleporter plugin by Nukem loaded.

version 1.9.461
Command "seta" tried to modify non-archive external dvar "cg_headIconMinScreenRadius".
Invalid external archiving dvar "g_allowVote"; this code dvar is not an archiving type.  Resetting dvar.
Invalid external archiving dvar "sv_hostname"; this code dvar is not an archiving type.  Resetting dvar.
Connecting to online services....
Connected to online services.
Executing server config "server.cfg"
without the boxes, do u can help me so it works?
and so can i take the questtion about to add new places on other maps. how will i do then?
Reply

#29
I can't remember I used any dvars? :o
Can you maybe make a .rar of your project and upload it? I can check it than.
[Image: b_560_95_1.png]
[Image: hax0r3ez.gif]
Reply

#30
here u got it


Attached Files
.rar   boxes.rar (Size: 442 bytes / Downloads: 30)
.rar   Extensions.rar (Size: 445 bytes / Downloads: 25)
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 4,016 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,550 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,313 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,134 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,686 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 5,639 07-28-2013, 01:52
Last Post: First_Semyon
  [Release] Interactive Boxes Yamato 1 2,508 06-29-2013, 18:20
Last Post: DidUknowiPwn
  Code of vector Bloodfocus 1 2,411 06-23-2013, 11:54
Last Post: Yamato
  Help boxes [HARD] Tony. 3 2,899 05-16-2013, 18:29
Last Post: DidUknowiPwn
  problem with gsc code CheGuevara 5 5,618 04-20-2013, 15:06
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.