AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SetNTVOptional() isn't being called automatically? (https://forums.alliedmods.net/showthread.php?t=310959)

shavit 09-27-2018 22:17

SetNTVOptional() isn't being called automatically?
 
What could cause my SetNTVOptional() to not call automatically?
I made sure I have the #include for it, made sure I undefined REQUIRE_PLUGIN before including and set required to 0 in SharedPlugin.

Getting "native X not found" unless I manually call the SetNTVOptional() function in AskPluginLoad2. Which is weird as I only get the error for 1 native.

Fyren 09-27-2018 22:39

Re: SetNTVOptional() isn't being called automatically?
 
It won't be called if you named it incorrectly.

shavit 09-28-2018 03:12

Re: SetNTVOptional() isn't being called automatically?
 
Quote:

Originally Posted by Fyren (Post 2617061)
It won't be called if you named it incorrectly.

My naming seems correct though.

Plugin file name is shavit-core.

.inc
Code:

public SharedPlugin __pl_shavit =
{
        name = "shavit",
        file = "shavit-core.smx",
#if defined REQUIRE_PLUGIN
        required = 1
#else
        required = 0
#endif
};

#if !defined REQUIRE_PLUGIN
public void __pl_shavit_SetNTVOptional()
{
        MarkNativeAsOptional("Shavit_Rankings_DeleteMap");
}

.sp
Code:

#undef REQUIRE_PLUGIN
#include <shavit>


Fyren 09-28-2018 03:52

Re: SetNTVOptional() isn't being called automatically?
 
Using your first block (with an #endif and native void Shavit_Rankings_DeleteMap();) and the following code, the plugin loads fine for me:

PHP Code:

#undef REQUIRE_PLUGIN
#include "shavit"

public void OnPluginStart() {
        
int x 0;
        if (
xShavit_Rankings_DeleteMap();



shavit 09-28-2018 04:10

Re: SetNTVOptional() isn't being called automatically?
 
Quote:

Originally Posted by Fyren (Post 2617076)
Using your first block (with an #endif and native void Shavit_Rankings_DeleteMap();) and the following code, the plugin loads fine for me:

PHP Code:

#undef REQUIRE_PLUGIN
#include "shavit"

public void OnPluginStart() {
        
int x 0;
        if (
xShavit_Rankings_DeleteMap();



That's just weird.. it doesn't for me from the shavit-core plugin, but it does run it from other plugins. Is there a limit for how many plugins can use a SharedPlugin? I have multiple plugins' natives in a single .inc

Edit: I found that the issue is gone as soon as I remove the file = "file name", part in the SharedPlugin struct. Is that a bug?

Fyren 09-28-2018 15:34

Re: SetNTVOptional() isn't being called automatically?
 
If you can post code with everything cut out of it possible that still has the problem, we'll look into it.

DarkDeviL 09-29-2018 11:23

Re: SetNTVOptional() isn't being called automatically?
 
Quote:

Originally Posted by shavit (Post 2617074)
.sp
Code:

#undef REQUIRE_PLUGIN
#include <shavit>


If the code (dependency) is indeed "optional", e.g. not required, I would in the above code do:

Code:

#tryinclude

Fyren 09-29-2018 17:44

Re: SetNTVOptional() isn't being called automatically?
 
#tryinclude isn't very useful. If the include is missing, then you can't have any mention of its declared stuff or the compile will fail. You'd end up wrapping everything in #ifs to deal with it and then the resulting binary will not optionally use the other plugin if the include was missing at compile-time.


All times are GMT -4. The time now is 07:15.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.