Raised This Month: $ Target: $400
 0% 

MarkNativeAsOptional - inconvenient moment.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
client21
Senior Member
Join Date: Apr 2013
Old 10-15-2021 , 13:24   Re: MarkNativeAsOptional - inconvenient moment.
Reply With Quote #1

Quote:
Originally Posted by Fortis View Post
Example:
Thanks, but I know that. This way is not suitable for me because:

Quote:
Originally Posted by client21 View Post
But my goal is to create native "Test_z" with a delay.
Don't ask me why I need it, just accept the fact that I need it

In any case, I will find the optimal solution, but I thought that __pl_z_SetNTVOptional was not working correctly and created this thread. Perhaps I should have written about this in section "Issues" (github).
client21 is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 10-15-2021 , 19:49   Re: MarkNativeAsOptional - inconvenient moment.
Reply With Quote #2

Quote:
Originally Posted by client21 View Post
Thanks, but I know that. This way is not suitable for me because:
Don't ask me why I need it, just accept the fact that I need it
AskPluginLoad2 is the earliest you may create a it such that all other plugins are able to use the native.

Fortis was kind enough to show you the right way to register a native (if you're still unsure review the wiki).

Quote:
Originally Posted by client21 View Post
Perhaps I should have written about this in section "Issues" (github).
The first question we'd ask you in the issue is "why".
headline is offline
client21
Senior Member
Join Date: Apr 2013
Old 10-15-2021 , 20:33   Re: MarkNativeAsOptional - inconvenient moment.
Reply With Quote #3

Quote:
Originally Posted by headline View Post
Fortis was kind enough
Yes, you are all very kind, but for some reason you do not answer my main question. I've provided a specific example code and I'm wondering why __pl_z_SetNTVOptional->MarkNativeAsOptional doesn't work for z.smx. Instead of answering this, you teach me to create natives, although I can do it.
client21 is offline
Fortis
Junior Member
Join Date: Nov 2016
Old 10-16-2021 , 12:48   Re: MarkNativeAsOptional - inconvenient moment.
Reply With Quote #4

Quote:
Originally Posted by client21 View Post
Don't ask me why I need it, just accept the fact that I need it
We're asking why because if you don't create the native in AskPluginLoad2 then to my knowledge no other plugin can use it besides the one it was created in. (Read the Wiki Under Registering Natives) At that point why create a Native if only one plugin is gonna use it? If you're ultimately set on creating a native with a delay, just use a timer, just note only this plugin can use it.

PHP Code:
#include <z>

public void OnPluginStart()
{
    
CreateTimer(2.0Timer_Natives);
}

public 
Action Timer_Natives(Handle timer)
{
    
CreateNative("Test_Z"Native_Z);
    return 
Plugin_Handled;


Last edited by Fortis; 10-16-2021 at 14:26. Reason: I forgot some information, was on mobile at the time.
Fortis is offline
client21
Senior Member
Join Date: Apr 2013
Old 10-16-2021 , 16:10   Re: MarkNativeAsOptional - inconvenient moment.
Reply With Quote #5

Quote:
Originally Posted by Fortis View Post
just note only this plugin can use it.

PHP Code:
#include <z>

public void OnPluginStart()
{
    
CreateTimer(2.0Timer_Natives);
}

public 
Action Timer_Natives(Handle timer)
{
    
CreateNative("Test_Z"Native_Z);
    return 
Plugin_Handled;

Why are you lying?) If another plugin is loaded later or there is the necessary communication between them (for example, using events, or GetFeatureStatus->FeatureType_Native), then this will work. The topic does not need to be continued, the answer was received. It's okay that you couldn't help me

----------
I think I understand what you mean.
If the native is created using a timer (even 0.1), then other plugins get an error: "[SM] Exception reported: Native is not bound".
But still works in "OnPluginStart" or if the plugin was loaded after the native-creator plugin.
Thx.

Last edited by client21; 10-17-2021 at 00:59.
client21 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:33.


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