DxWo Posted February 21, 2019 Share Posted February 21, 2019 Good day everyone, i recently came across an old C# API script for 7days but cant seem to get it to work. the API class extends ModApiAbstract but that is not found in the Assembly-CSharp.dll that i have referenced in the solution. What am i missing here? Here is the exact error: "The type or namespace 'ModApiAbstract' could not be found (are you missing a using directive or an assembly reference?). Again, i do have Assembly-CSHarp listed under the references for my project, but im obviously missing something. Link to comment Share on other sites More sharing options...
Prisma501 Posted February 21, 2019 Share Posted February 21, 2019 in API.cs change public class API : ModApiAbstract to public class API : IModApi then use within API class: public void InitMod() { ModEvents.GameStartDone.RegisterHandler(GameAwake); ModEvents.GameShutdown.RegisterHandler(GameShutdown); ModEvents.SavePlayerData.RegisterHandler(SavePlayerData); etc etc } for registering eventhandlers for the api hooks. Cheers Link to comment Share on other sites More sharing options...
DxWo Posted February 21, 2019 Author Share Posted February 21, 2019 in API.cs change public class API : ModApiAbstract to public class API : IModApi then use within API class: public void InitMod() { ModEvents.GameStartDone.RegisterHandler(GameAwake); ModEvents.GameShutdown.RegisterHandler(GameShutdown); ModEvents.SavePlayerData.RegisterHandler(SavePlayerData); etc etc } for registering eventhandlers for the api hooks. Cheers Should i then remove all the other Public overrides that were in the api.cs class? They are all erroring out a non suitable method. Link to comment Share on other sites More sharing options...
Prisma501 Posted February 21, 2019 Share Posted February 21, 2019 Should i then remove all the other Public overrides that were in the api.cs class? They are all erroring out a non suitable method. They are not overrides anymore: public class API : IModApi { public void InitMod() { ModEvents.GameStartDone.RegisterHandler(GameStartDone); ModEvents.GameShutdown.RegisterHandler(GameShutdown); ModEvents.SavePlayerData.RegisterHandler(SavePlayerData); ModEvents.PlayerSpawnedInWorld.RegisterHandler(PlayerSpawnedInWorld); ModEvents.PlayerDisconnected.RegisterHandler(PlayerDisconnected); ModEvents.ChatMessage.RegisterHandler(ChatMessage); } public void GameStartDone() { } public void GameShutdown() { } public void PlayerDisconnected(ClientInfo _cInfo, bool _bShutdown) { } public void PlayerSpawnedInWorld(ClientInfo _cInfo, RespawnType _respawnReason, Vector3i _pos) { } public void SavePlayerData(ClientInfo _cInfo, PlayerDataFile _playerDataFile) { } public bool PlayerLogin(ClientInfo _cInfo, string _compatibilityVersion, StringBuilder sb) { } public bool ChatMessage(ClientInfo _cInfo, EChatType _type, int _senderId, string _msg, string _mainName, bool _localizeMain, List<int> _recipientEntityIds) { } } Cheers -edit- those are not all available ModEvents but just to get the drift Link to comment Share on other sites More sharing options...
DxWo Posted February 21, 2019 Author Share Posted February 21, 2019 Ahh ok that makes more sense. Now to try and figure out where to go from here lol Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.