Raised This Month: $ Target: $400
 0% 

Solved How to pass tagged variable to other plugins


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 04-25-2021 , 15:39   Re: How to pass tagged variable to other plugins
Reply With Quote #7

Tags doesn't actually do anything except makes the compiler capable of telling you that you might have used a variable in the wrong context. After compilation they're basically gone.
However, if you end up using a tag and enforce it's usage in other plugins I would recommend putting them in the API plugin as well.

The enum is basically useless in your API plugin if you're not using them individually in any way. It should be in the include which is used for the secondary plugin, along with the native declaration.

I strongly suggest using the first example of these.
Code:
// API Plugin public plugin_natives()     register_native("ExampleNative", "nativeExample"); public nativeExample(plugin, params) {     return 999; } // Secondary Plugin native ExampleNative(); Data ends up here      |      V new data = ExampleNative();

Code:
// API Plugin public plugin_natives()     register_native("ExampleNative", "nativeExample"); public nativeExample(plugin, params) {     set_param_byref(1, 999); } // Secondary Plugin native ExampleNative(&data); Data ends up here                |                V ExampleNative(data);

If you're using tagged byref. Look how CsTeams based natives are declared in the include for guidance:
Code:
native CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model = CS_DONTCHANGE);

Example of tag mismatching still working fine
__________________

Last edited by Black Rose; 04-25-2021 at 16:21.
Black Rose is offline
 



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 02:29.


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