Jump to content

Events & Commands not working...


Renae

Recommended Posts

So just trying to get a server set up here... the console outputs 'Hello World!" but the command /sethealth doesn't work, neither does the message displaying on spawn.

 

using System;
using GTANetworkAPI;

namespace Trial
{
    public class Main : Script
    {
        [ServerEvent(Event.ResourceStart)]
        public void ResourceStart()
        {
            NAPI.Util.ConsoleOutput("Hello World!");
        }

        [ServerEvent(Event.PlayerSpawn)]
        public void OnPlayerSpawn(Client player)
        {
            player.SendChatMessage($"Hello! Welcome back, {player.Name}");
        }

        [Command("sethealth")]
        public void CmdSetHealth(Client player, int health)
        {
            player.Health = health;
            player.SendChatMessage($"Your health has been set to: {health}");
        }
    }
}

What am I doing wrong? /sethealth displays Unknown Command

Edited by Renae
Link to comment
Share on other sites

1 hour ago, Jaimuzu said:

This may be due to mismatched version of either one of the following files used, "server.exe", "bridge.dll", "server-files/bridge/runtime/bootstrapper.dll" or compiled code reference of "bootstrapper.dll/nuget gtanetwork api"

Well I know that server.exe is up to date because I can connect to the server on the latest rage. So how would I go about updating the other three?

Link to comment
Share on other sites

  • 4 years later...

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