imi-tat0r / CS2-CustomVotes

A plugin for Counter-Strike 2 to create custom votes for settings.
MIT License
15 stars 4 forks source link

[Question] Shared API Project Reference #3

Closed nickj609 closed 7 months ago

nickj609 commented 7 months ago

Hey, thanks for this great plugin! I am trying to learn how to integrate this plugin with my own (GameModeManager) and am trying to figure out how to reference this in my project. I have reviewed some of the documentation from the CounterStrikeSharp repo but am struggling to understand how this should be referenced.

For example, the CounterStrikeSharp library uses shared types like this:

<PackageReference Include="shared\CS2-CustomVotes.Shared\CS2-CustomVotes.Shared.csproj"/>

But should I be using something more like this?

<Reference Include="shared\CS2-CustomVotes.Shared\CS2-CustomVotes.Shared.dll"/>

Also, how should the final build look? Would this require the CS2-CustomVotes plugin to exist in both /counterstrikesharp/plugins and /counterstrikesharp/shared or should the dlls exist in my own plugins output directory?

I apologize if this is a dumb/rudimentary question. Appreciate any help you can offer.

imi-tat0r commented 7 months ago

Hey there. First of all, there's barely any dumb questions. We all were new to this stuff at some point. Now to answer your questions:

  1. yes you should reference the dll instead of the project
  2. the CS2-CustomVotes.Shared should be put into counterstrikesharp/shared and the CS2-CustomVotes itself should be put into counterstrikesharp/plugins. To make things easier, just download the release and extract it into your addons folder. Then everything should be where it is supposed to be. NOTE: The release package also includes the shared part in the plugins folder but that is an oversight on my end and shouldn't be necessary.

For reference you can check out HvH-gg/CS2-Essentials which uses CS2-CustomVotes. This also checks if the CS2-CustomVotes plugin is loaded like this

nickj609 commented 7 months ago

Hey @imi-tat0r, your explanation was extremely helpful. I managed to get it working as intended. Thank you so much for your help! I will be creating a new release of my GameModeManager within the next week or so containing a reference to this plugin. This definitely makes creating custom votes so much easier.

nickj609 commented 5 months ago

I wanted to follow up here @imi-tat0r to let you know that I have successfully integrated your plugin via the Shared API. Your plugin is now in the latest release for my plugin GameModeManager.

I made sure to include a link to your plugin on the release, as well as a credit on the README.md. Any references to your libraries within my code are also prefaced with a link to your plugin and a reference to its MIT License.

// Copyright (c) 2024 imi-tat0r
// https://github.com/imi-tat0r/CS2-CustomVotes/
using CS2_CustomVotes.Shared.Models;
// ---------------------------------------------

If you ever want to collaborate further feel free to add me on discord (striker.nick). I have a degree in Cyber Security with a minor in Computer Programming and work as an IT/Security Engineering Consultant and so it appears our interests may align.

imi-tat0r commented 4 months ago

didn't even see your last message :D I added you