Method isStrikePlane keeps returning false

Hi,

I'm trying to use this hook like this:

if (Airstrike?.Call("isStrikePlane", plane))

But the type returned is an object.
If I explicitly convert it to bool then it is never true and always false:

if ((bool)Airstrike?.Call("isStrikePlane", plane))

I have the plugin reference:

[PluginReference]
private Plugin Airstrike;

Could I have some assistance with using this hook to return true or false please?

Try:
if (Airstrike != null && Airstrike.Call<bool>("isStrikePlane", plane))​

You may want to make sure Airstrike is not null too, so I'd check for that.

5e13a8d5b2bc5.jpg Wulf
Try:
if (Airstrike != null && Airstrike.Call<bool>("isStrikePlane", plane))​

You may want to make sure Airstrike is not null too, so I'd check for that.

Thanks for the suggestion, it's unfortunately still always returning false.

I'm using this for the sake of testing:

void OnServerInitialized()
{
    if (Airstrike != null)
        Puts("Plugin Airstrike found.");
}

void OnAirdrop(CargoPlane plane)
{
    bool isAirstrike = false;
    if (Airstrike != null && Airstrike.Call<bool>("isStrikePlane", plane))
        isAirstrike = true;
    Puts(isAirstrike.ToString());
}

Which always outputs:

[GUIAnnouncements] Plugin Airstrike found.
[GUIAnnouncements] False

I'm running the command "airstrike strike random" from console to spawn an airstrike plane.
Then using "entity.spawn cargo_plane" to check normal planes are false.

Merged post

@k1lly0u I'm still struggling with this, are you able to assist please?

I sorted this out without using the API.

AirStrike sets CargoPlane.dropped to true when spawned in the StrikePlane class so that it doesn't drop anything during the airstrike. So I just stuck a 0.5s delay before checking this property is false in my plugin as it was too quick and if true it won't announce an airdrop.