$kylar Posted December 24, 2019 Posted December 24, 2019 I've made a very simple script. using System; using GTANetworkAPI; namespace GTA_V_RP { public class Main : Script { [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput($"{NAPI.Server.GetServerName()} has loaded."); NAPI.Server.SetGlobalServerChat(false); } [ServerEvent(Event.ChatMessage)] public void OnChatMessage(Client player, string message) { foreach(Client players in NAPI.Player.GetPlayersInRadiusOfPlayer(5.0, player)) { if (players.Equals(player)) player.SendChatMessage($"I say: {message}"); else players.SendChatMessage($"{NAPI.Player.GetPlayerName(player)} says: {message}"); } } [ServerEvent(Event.PlayerConnected)] public void OnPlayerConnected(Client client) { NAPI.Util.ConsoleOutput("Test"); client.SendNotification("Hi", false); } [ServerEvent(Event.PlayerSpawn)] public void OnPlayerRespawn(Client player) { NAPI.Util.ConsoleOutput("Test"); player.SendChatMessage("spawned"); } [Command("kill")] public void CMD_Kill(Client sender) { NAPI.Player.SetPlayerHealth(sender, 0); } } } Now the problem arises is that if I build it into a .dll file and run it. The script runs. OnResourceStart() even gets called. However OnPlayerConnected(), OnPlayerSpawned() never gets called unless I explicitly call them. However if I make it into a .cs file and the script compiles itself when the server is initiated then everything works fine. And yes, I've set the meta.xml perfectly fine. It is correct, if it weren't then OnResourceStart() wouldn't have called in the first place.
Xabi Posted December 25, 2019 Posted December 25, 2019 Don't compile the solution using the Nuget package, just add the bootstrapper.dll as a dependency library.
$kylar Posted December 27, 2019 Author Posted December 27, 2019 On 12/25/2019 at 2:36 PM, Xabi said: Don't compile the solution using the Nuget package, just add the bootstrapper.dll as a dependency library. Thank you it's working. You can delete this now.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now