Beispiel #1
0
        public override void OnStart( )
        {
            // YOU MUST ADD THIS IN THE ONSTART OF YOUR GAMEMODE, OBJECTSTREAMER WONT WORK WITHOUT IT!
            AltEntitySync.Init(1, 100,
                               repository => new ServerEventNetworkLayer(repository),
                               () => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 600),
                               new IdProvider( )
                               );
            //////////////////////////

            AltAsync.OnPlayerConnect  += OnPlayerConnect;
            AltAsync.OnConsoleCommand += OnConsoleCommand;

            // Spawn markers
            CreateMarkers( );

            // Display commands in console
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("|---------------------AVAILABLE CONSOLE COMMANDS:---------------------|");
            Console.WriteLine("| dam -> Destroy all created markers.");
            Console.WriteLine("| cam -> Create all markers defined in the CreateMarkers method.");
            Console.WriteLine(" ");
            Console.WriteLine("| cp {id} -> Move a specified marker by 5 units on the Z axis(height).");
            Console.WriteLine("| cr {id} -> Rotate a specified marker by 5 units on the Z axis(yaw).");
            Console.WriteLine("| ct {id} -> Change type of the specified marker.");
            Console.WriteLine("| cd {id} -> Change direction of the specified marker.");
            Console.WriteLine(" ");
            Console.WriteLine("| do {id} -> Destroy a dynamic marker by ID(IDs start at 0).");
            Console.WriteLine("| go {id} -> Get dynamic marker data of the specified marker ID.");
            Console.WriteLine(" ");
            Console.WriteLine("| countmarker -> Get the amount of created markers.");
            Console.WriteLine("|--------------------------------------------------------------------|");
            Console.ResetColor( );
        }
Beispiel #2
0
        public override void OnStart()
        {
            AltEntitySync.Init(1, 100, false,
                               (threadCount, repository) => new ServerEventNetworkLayer(threadCount, repository),
                               (entity, threadCount) => (entity.Id % threadCount),
                               (entityId, entityType, threadCount) => (entityId % threadCount),
                               (threadId) => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 300),
                               new IdProvider());

            StartDestroyedVehicleTimer();
            StartGlobalMessageTimer();
            StartLostPlayerTimer();

            Database db = new Database();

            db.LoadBattleRoyaleItem();
            db.LoadBattleRoyaleMaps();
            db.LoadBattleRoyaleItemSpawns();
            db.LoadVehicleShop();

            for (int i = 0; i < db.ColumnCount("SELECT * FROM `team`"); i++)
            {
                Team team = new Team(i + 1);
                Data.Teams.Add(i + 1, team);
                db.LoadTeamClothes(i + 1);
                db.LoadTeamProps(i + 1);
            }

            for (int i = 0; i < db.ColumnCount("SELECT * FROM `deathmatch`"); i++)
            {
                Deathmatch dmteam = new Deathmatch(i + 1);
                Data.DmTeams.Add(i + 1, dmteam);
            }
            db.LoadDuell();
        }
Beispiel #3
0
 public void Setup()
 {
     AltEntitySync.Init(1, 500,
                        repository => new MockNetworkLayer(repository),
                        () => new Grid(50_000, 50_000, 100, 10_000, 10_000),
                        new IdProvider());
     grid3 = new Grid3(50_000, 50_000, 100, 10_000, 10_000);
 }
 public EntityScript()
 {
     AltEntitySync.Init(1, 100, false,
                        (threadCount, repository) => new ServerEventNetworkLayer(threadCount, repository),
                        (entity, threadCount) => (entity.Id % threadCount),
                        (entityId, entityType, threadCount) => (entityId % threadCount),
                        (threadId) => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 300), new IdProvider());
 }
 public void Setup()
 {
     AltEntitySync.Init(1, 500,
                        (threadCount, repository) => new MockNetworkLayer(threadCount, repository),
                        (entity, threadCount) => (entity.Id % threadCount),
                        (entityId, entityType, threadCount) => (entityId % threadCount),
                        (id) => new Grid2(50_000, 50_000, 100, 10_000, 10_000),
                        new IdProvider());
 }
 public void Setup()
 {
     AltEntitySync.Init(1, 500, _ => true,
                        (threadCount, repository) => new MockNetworkLayer(threadCount, repository),
                        (entity, threadCount) => (entity.Id % threadCount),
                        (entityId, entityType, threadCount) => (entityId % threadCount),
                        (id) => new LimitedGrid(50_000, 50_000, 100, 10_000, 10_000, 3),
                        new IdProvider());
     grid2 = new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 3);
 }
Beispiel #7
0
 public override void OnStart()
 {
     AltEntitySync.Init(2, 100,
                        (threadId) => false,
                        (threadCount, repository) => new ServerEventNetworkLayer(threadCount, repository),
                        (entity, threadCount) => (entity.Type % threadCount),
                        (entityId, entityType, threadCount) => (entityType % threadCount),
                        (threadId) => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 300),
                        new IdProvider());
 }
Beispiel #8
0
 public void Setup()
 {
     AltEntitySync.Init(1, 100,
                        repository =>
     {
         mockNetworkLayer = new MockNetworkLayer(repository);
         return(mockNetworkLayer);
     },
                        () => new Grid2(50_000, 50_000, 100, 10_000, 10_000),
                        new IdProvider());
 }
 public void OnScriptsStarted(IScript[] scripts)
 {
     AltEntitySync.Init(5, 100,
                        (repository, threadCount) => new ServerEventNetworkLayer(repository, threadCount),
                        (entity, threadCount) => entity.Type,
                        (entityId, entityType, threadCount) => entityType,
                        (threadId) =>
     {
         if (threadId == 0)     // objects
         {
             return(new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 350));
         }
Beispiel #10
0
 public static void Main(string[] args)
 {
     AltEntitySync.Init(1, 100,
                        repository =>
     {
         mockNetworkLayer = new MockNetworkLayer(repository);
         return(mockNetworkLayer);
     },
                        () => new Grid2(50_000, 50_000, 10, 10_000, 10_000),
                        new IdProvider());
     Entities();
 }
Beispiel #11
0
 public void Setup()
 {
     AltEntitySync.Init(2, 500, _ => true,
                        (threadCount, repository) =>
     {
         mockNetworkLayer = new MockNetworkLayer(threadCount, repository);
         return(mockNetworkLayer);
     },
                        (entity, threadCount) => (entity.Id % threadCount),
                        (entityId, entityType, threadCount) => (entityId % threadCount),
                        (id) => new Grid(50_000, 50_000, 100, 10_000, 10_000),
                        new IdProvider());
 }
 public static void Main(string[] args)
 {
     AltEntitySync.Init(1, (id) => 100, _ => false,
                        (threadCount, repository) =>
     {
         mockNetworkLayer = new MockNetworkLayer(threadCount, repository);
         return(mockNetworkLayer);
     },
                        (entity, threadCount) => (entity.Id % threadCount),
                        (entityId, entityType, threadCount) => (entityId % threadCount),
                        (id) => new Grid3(50_000, 50_000, 10, 10_000, 10_000),
                        new IdProvider());
     Entities();
 }
Beispiel #13
0
        public override void OnStart()
        {
            AltEntitySync.Init(1, 100,
                               (threadCount, repository) => new ServerEventNetworkLayer(threadCount, repository),
                               (entity, threadCount) => (entity.Id % threadCount),
                               (entityId, entityType, threadCount) => (entityId % threadCount),
                               (threadId) => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 600),
                               new IdProvider());

            // Ładowanie zasobów serwera
            Task.Run(async() =>
            {
                await EntityHelper.LoadServerEntity();
            });
        }
Beispiel #14
0
        private void InitEntitySync()
        {
            //Prepare the EntitySync - Ped Limit is 256
            AltEntitySync.Init(
                4,
                100,
                true,
                (threadCount, repository) => new PedSyncerNetworkLayer(threadCount, repository),
                (entity, threadCount) => (entity.Id % threadCount),
                (entityId, entityType, threadCount) => (entityId % threadCount),
                (threadId) => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 128),
                new IdProvider()
                );

            Console.WriteLine("[INFO] GameEntityResource InitEntitySync startet");
        }
Beispiel #15
0
        public async Task OnStartup()
        {
            // initialize EntitySync
            // docs: http://csharp.altv.mp/articles/entity-sync.html

            AltEntitySync.Init(2, 100,
                               (threadId) => false,
                               (threadCount, repository) => new ServerEventNetworkLayer(threadCount, repository),
                               (entity, threadCount) => (entity.Type % threadCount),
                               (entityId, entityType, threadCount) => (entityType % threadCount),
                               (threadId) => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 300),
                               new IdProvider());

            Logger.LogInformation("EntitySync initialized");

            await Task.CompletedTask;
        }
Beispiel #16
0
        public override void OnStart( )
        {
            // YOU MUST ADD THIS IN THE ONSTART OF YOUR GAMEMODE, OBJECTSTREAMER WONT WORK WITHOUT IT!
            AltEntitySync.Init(1, 100,
                               repository => new ServerEventNetworkLayer(repository),
                               () => new LimitedGrid3(50_000, 50_000, 100, 10_000, 10_000, 600),
                               new IdProvider( )
                               );
            //////////////////////////

            AltAsync.OnPlayerConnect  += OnPlayerConnect;
            AltAsync.OnConsoleCommand += OnConsoleCommand;

            // Spawn objects
            CreateObjects( );

            // Display commands in console
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("|---------------------AVAILABLE CONSOLE COMMANDS:---------------------|");
            Console.WriteLine("| dao -> Destroy all created objects.");
            Console.WriteLine("| cao -> Create all objects defined in the CreateObjects method.");
            Console.WriteLine(" ");
            Console.WriteLine("| cp {id} -> Move a specified object by 5 units on the Z axis(height).");
            Console.WriteLine("| cr {id} -> Rotate a specified object by 5 units on the Z axis(yaw).");
            Console.WriteLine("| cm {id} -> Change model of the specified object.");
            Console.WriteLine("| cld {id} -> Change LOD Distance of the specified object.");
            Console.WriteLine("| ctv {id} -> Change texture variation of the specified object.");
            Console.WriteLine("| cd {id} -> Change dynamic of the specified object.");
            Console.WriteLine("| cv {id} -> Change visibility of the specified object.");
            Console.WriteLine("| cof {id} -> Change on fire of the specified object.");
            Console.WriteLine("| cf {id} -> Change frozen of the specified object.");
            Console.WriteLine("| clc {id} -> Change light color of the specified object.");
            Console.WriteLine(" ");
            Console.WriteLine("| do {id} -> Destroy a dynamic object by ID(IDs start at 0).");
            Console.WriteLine("| go {id} -> Get dynamic object data of the specified object ID.");
            Console.WriteLine("| gc -> Get the dynamic object closest to player 1.");
            Console.WriteLine(" ");
            Console.WriteLine("| countobj -> Get the amount of created objects.");
            Console.WriteLine("|--------------------------------------------------------------------|");
            Console.ResetColor( );
        }