You have to bundle the PolicingRedefined.dll in your project, then you can call:
PolicingRedefined.API.PedAPI.SetPedDrunk(ped, mappedLevel, setWalkstyle);
For StopThePed the same process, but call:
StopThePed.API.Functions.setPedAlcoholOverLimit(ped, drunk);
Be aware that if you call the API function directly and a user hasn't installed the dll, LSPDFR will crash.
To prevent that, you have to check in your plugin if STP or PR is installed and working. Only then you are allowed to call the API functions.
You have to create a seperate class, it can look something like this:
internal static class STP
{
internal static void DrunkSTP(this Ped ped)
{
if (Config.STPinstalled)
{
ped.DrunkSTP2(true);
}
}
private static void DrunkSTP2(this Ped ped, bool drunk = true)
{
if (Config.STPinstalled)
{
StopThePed.API.Functions.setPedAlcoholOverLimit(ped, drunk);
}
}
}
As you can see there are two funtions for each function. This is required so LSPDFR doesn't crash when the required dll is not installed by the user.
In your Main class you have to check if the STP or PR dll is installed.
You can do that with: File.Exists(@"plugins\LSPDFR\PolicingRedefined.dll")