View Single Post
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 #6

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