View Single Post
Author Message
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 10-14-2022 , 22:39   How to create properly a native for a bool value?
Reply With Quote #1

In base plugin:
Code:
new bool:RankedMatch = false;

public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
	CreateNative("RankedMatch", Native_RankedMatch);
	
	RegPluginLibrary("warmode");
	
	return APLRes_Success;
}

public int Native_RankedMatch(Handle plugin, int numParams)
{
	return RankedMatch;
}
My include:

Code:
#if defined _warmode_included
 #endinput
#endif
#define _warmode_included

native int RankedMatch();

public SharedPlugin __pl_warmode =
{
	name = "War mode",
	file = "warmode.smx",
#if defined REQUIRE_PLUGIN
	required = 1,
#else
	required = 0,
#endif
};

#if !defined REQUIRE_PLUGIN
public void __pl_warmode_SetNTVOptional()
{

	MarkNativeAsOptional("RankedMatch");
}
#endif

In other plugin added the inc file and created a debug command but have error 076: syntax error in the expression, or invalid function call on both "rankedmatch" when compiling
Code:
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
	RegPluginLibrary("warmode");


	return APLRes_Success;
}

public Action DebugWar_Cmd(int client, int args)
{
    if ( RankedMatch == true )
    {
        PrintToChat(client,"Enabled");
    }
    
    if ( RankedMatch == false )
    {
        PrintToChat(client,"Disabled");
    }
}

Last edited by JLmelenchon; 10-14-2022 at 22:46.
JLmelenchon is offline