Jump to content

Add commands to main class


Bnece

Recommended Posts

Hy all!

 

I created an AdminCommands class and it have a few commands for admins, on the Main class i defined the class but it not load the commans.

I find solution https://wiki.gtanet.work/index.php?title=C.Register this but it not implemend yet.

 

Forexample in AdminCommands class

        [Command("getpos")]
        public void GetPosition(Client player)
        {
            Vector3 PlayerPos = NAPI.Entity.GetEntityPosition(player);
            NAPI.Chat.SendChatMessageToPlayer(player, "X: " + PlayerPos.X + " Y: " + PlayerPos.Y + " Z: " + PlayerPos.Z);
        }

 and the Main class

 

    public class Main : Script
    {

        private static List<Vehicles> vehicle = new List<Vehicles>();
        private static List<Players> players = new List<Players>();
        private static AdminCommands admcmd = new AdminCommands(players, vehicle);
        

        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStart()
        {
            NAPI.Util.ConsoleOutput("Loaded");

            
        }

 

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...