Jump to content

Server crashes on CreateOwnedExplosion


Recommended Posts

Hey there,

I am fairly new to rage.mp but neverless a fairly experienced C# developer.


Well I am using the PlaceMine example from gtanetwork. Already rewrote the page to fit NAPI instead of API.


Still my server.exe crashes once the mine is supposed to explode. No error logs :/ It just stops running, any ideas ?


using System;
using GTANetworkAPI;

namespace minesTest
    public class minesTest:Script

        public minesTest()

        public void myResourceStart()
            NAPI.Util.ConsoleOutput("TestScript started!");

        public void PlaceMine(Client sender)
            var pos = NAPI.Entity.GetEntityPosition(sender);
            var playerDimension = NAPI.Entity.GetEntityDimension(sender);

            var prop = NAPI.Object.CreateObject(NAPI.Util.GetHashKey("prop_bomb_01"), pos - new Vector3(0, 0, 1f), new Vector3(), 255, playerDimension);
            var shape = NAPI.ColShape.CreateSphereColShape(pos, 10);
            shape.Dimension = playerDimension;

            bool mineArmed = false;

            shape.OnEntityEnterColShape += (s, ent) =>
                if (!mineArmed) return;

                NAPI.Explosion.CreateOwnedExplosion(sender, ExplosionType.ProxMine, pos, 1f, playerDimension);

            shape.OnEntityExitColShape += (s, ent) =>
                if(ent == sender.Handle && !mineArmed)
                    mineArmed = true;
                    NAPI.Notification.SendNotificationToPlayer(sender, "Mine has been ~r~armed~w~!", true);



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...