Sign in to follow this  
Renae

Events & Commands not working...

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

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.