Raised This Month: $51 Target: $400
 12% 

RegAdminCmd() => Error 100: function prototypes do not match


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AmeriK
Junior Member
Join Date: Jul 2016
Location: Not here
Old 07-25-2016 , 12:42   RegAdminCmd() => Error 100: function prototypes do not match
Reply With Quote #1

Hello world !
Today, i opened my 1st TF2 server and i'm scripting a little plugin for server.
When compiling, there is an error on that line :
Code:
RegAdminCmd("dbinfo", DataBaseConfiguration, ADMFLAG_SLAY);
I try with :
Code:
RegConsoleCmd("dbinfo", DataBaseConfiguration, "Start the configuration of db");
same result.
There is the .sp :

Code:
#include <sourcemod>


bool pluginsLoaded[] = {
	true,
	false,
	false,
	false,
	false,
	false
	};

/*
* pluginsLoaded : KafhetCore.smx | KafhetFF2.smx | KafhetPerm.smx | KafhetMenu.smx | KafhetFF2Select.smx | KafhetStat.smx penser a changer dans DataBaseConfiguration
*/

char pluginsName[] = {
	"KafhetCore",
	"KafhetPerm",
	"KafhetMenu",
	"KafhetStat",
	"KafhetFF2",
	"KafhetFF2Select"
	};

public Plugin:myinfo = 
{
	name = "KafhetCore",
	author = "AmeriK",
	description = "Base for Kafhet plugins",
	version = "1.0",
	url = "www.amerik.fr"
}

public void OnPluginStart()
{
	LoadTranslations("common.phrases");	

	RegConsoleCmd("plugins_info", Cmd_plugins_info, "Show Kafhet's plugins");
	RegAdminCmd("dbinfo", DataBaseConfiguration, ADMFLAG_SLAY);
}

public DataBaseConfiguration(pluginsLoaded[], pluginsName[])
{
	char name[25];
	for (int i = 0; i < 6; i++)// pour 6 plugins
	{
		if (GetPluginFilename(pluginsName[i], name[i], 25) != INVALID_HANDLE) //test si plugins présents, pour excecuter bdd
		{
			pluginsLoaded[i] = true;
			PrintToServer("KAFHETCORE Find this plugin: ");
			PrintToServer(name[i]);
		}
		else
		{
			pluginsLoaded[i] = false;
			PrintToServer("KAFHETCORE Dont find : ");
			PrintToServer(name[i]);
		}
		
	}
}



//Check ingame command : Menu Plugins
public Action:Cmd_plugins_info(client, args)
{
	if (client == 0)
	{
		ReplyToCommand(client, "%t", "Command is in-game only");
		return Plugin_Handled;
	}
	KafhetMenuPlugins(client);
	return Plugin_Handled;
}

KafhetMenuPlugins(client)
{
	new Handle:menu = CreateMenu(k_PluginsInfos, MENU_ACTIONS_DEFAULT);
	SetMenuTitle(menu, "Kafhet plugins infos");

	AddMenuItem(menu, "kafcor", "KafhetCore.smx", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "baseplugin_info", "1.0 by AmeriK : Click for specifics");
	AddMenuItem(menu, "kafff2", "KafhetFF2.smx", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "ff2modified_info", "1.0 by AmeriK : Click for specifics");
	AddMenuItem(menu, "kafper", "KafhetPerm.smx", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "notrel", "Not released yet :C", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "kafmen", "KafhetMenu.smx", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "kafmen_info", "1.0 by AmeriK : Click for specifics");
	AddMenuItem(menu, "kafsel", "KafhetFF2Select.smx", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "kafsel_info", "1.0 by Amerik : Click for specifics");
	AddMenuItem(menu, "kafsta", "KafhetStats.smx", ITEMDRAW_DISABLED);
	AddMenuItem(menu, "kafstat_info", "Not released yet :C", ITEMDRAW_DISABLED);

	DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public k_PluginsInfos(Handle:menu, MenuAction:action, param1, param2)
{
	switch (action)
	{
		case MenuAction_Select:
		{
			//param1 is client, param2 is item

			new String:item[64];
			GetMenuItem(menu, param2, item, sizeof(item));

			if (StrEqual(item, "baseplugin_info"))
			{
				PrintToChat(param1, "License : None. \nStatus : Private \nVersion : 1.0 \nAuthor : AmeriK \nKafhetCore.smx is a base plugin for all Kafhet Plugins.");

				new pos = GetMenuSelectionPosition();
				DisplayMenuAtItem(CloneHandle(menu), param1, pos, MENU_TIME_FOREVER);
			}
			else if (StrEqual(item, "ff2modified_info"))
			{
				PrintToChat(param1, "License : None. \nStatus : Private \nVersion : 1.0 \nAuthor : AmeriK, FF2 Authors \nKafhetFF2.smx is a FF2 modified plugin for Kafhet's webpanel");

				new pos = GetMenuSelectionPosition();
				DisplayMenuAtItem(CloneHandle(menu), param1, pos, MENU_TIME_FOREVER);
			}
			else if (StrEqual(item, "kafmen_info"))
			{
				PrintToChat(param1, "License : None. \nStatus : Private \nVersion : 1.0 \nAuthor : AmeriK \nKafhetMenu.smx is a powerful plugins to display customs menu for custom KafhetPerm.smx's ranks !");

				new pos = GetMenuSelectionPosition();
				DisplayMenuAtItem(CloneHandle(menu), param1, pos, MENU_TIME_FOREVER);
			}
			else if (StrEqual(item, "kafsel_info"))
			{
				PrintToChat(param1, "License : None. \nStatus : Private \nVersion : 1.0 \nAuthor : AmeriK \nKafhetFF2Selection.smx is a plugin to toggle boos selection and custom boss packs for FF2 !");

				new pos = GetMenuSelectionPosition();
				DisplayMenuAtItem(CloneHandle(menu), param1, pos, MENU_TIME_FOREVER);
			}
		}

		case MenuAction_End:
		{
			//param1 is MenuEnd reason, if canceled param2 is MenuCancel reason
			CloseHandle(menu);

		}

	}
}
There is the compiler :
Code:
//// KafhetCore.sp
//
// D:\PawnStudio\Projects\KafhetCore.sp(40) : error 100: function prototypes do
not match
// D:\PawnStudio\Projects\KafhetCore.sp(43) : warning 219: local variable "plugi
nsLoaded" shadows a variable at a preceding level
// D:\PawnStudio\Projects\KafhetCore.sp(43) : warning 219: local variable "plugi
nsName" shadows a variable at a preceding level
// D:\PawnStudio\Projects\KafhetCore.sp(48) : warning 213: tag mismatch
// D:\PawnStudio\Projects\KafhetCore.sp(48) : warning 213: tag mismatch
// D:\PawnStudio\Projects\KafhetCore.sp(11) : warning 203: symbol is never used:
 "pluginsLoaded"
// D:\PawnStudio\Projects\KafhetCore.sp(24) : warning 203: symbol is never used:
 "pluginsName"
//
// 1 Error.
//
// Compilation Time: 0,91 sec
// ----------------------------------------
Thanks and don't vomit when you see my 1st plugin ^^
__________________
Still loading...
AmeriK is offline
Farbror Godis
AlliedModders Donor
Join Date: Feb 2016
Old 07-25-2016 , 12:56   Re: RegAdminCmd() => Error 100: function prototypes do not match
Reply With Quote #2

The second parameter of RegAdminCmd takes a ConCmd callback, and that is not at all what you have provided.

PHP Code:
public DataBaseConfiguration(pluginsLoaded[], pluginsName[]) 
Should be:

PHP Code:
public Action ShowDataBaseInfo(int clientint args
https://sm.alliedmods.net/new-api/console/ConCmd
Farbror Godis is offline
AmeriK
Junior Member
Join Date: Jul 2016
Location: Not here
Old 07-25-2016 , 13:17   Re: RegAdminCmd() => Error 100: function prototypes do not match
Reply With Quote #3

Quote:
Originally Posted by Farbror Godis View Post
The second parameter of RegAdminCmd takes a ConCmd callback, and that is not at all what you have provided.

PHP Code:
public DataBaseConfiguration(pluginsLoaded[], pluginsName[]) 
Should be:

PHP Code:
public Action ShowDataBaseInfo(int clientint args
https://sm.alliedmods.net/new-api/console/ConCmd
Thanks for fast reply

So, i don't need give args for DataBaseConfiguration(pluginsLoaded[], pluginsName[]) ?
__________________
Still loading...
AmeriK is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-25-2016 , 16:50   Re: RegAdminCmd() => Error 100: function prototypes do not match
Reply With Quote #4

Any function that you supply to "RegAdminCmd" must 100% match the following signature:
PHP Code:
typedef ConCmd = function Action(int clientint args
Any deviance will result in the prototype mismatch error.
Signature explained:
1) Function is public (As of SM 1.8's release as stable, this is now optional)
2) Function's return type is "Action"
3) Function takes 2 arguements, both are type int
__________________
WildCard65 is offline
AmeriK
Junior Member
Join Date: Jul 2016
Location: Not here
Old 07-26-2016 , 03:39   Re: RegAdminCmd() => Error 100: function prototypes do not match
Reply With Quote #5

Quote:
Originally Posted by WildCard65 View Post
Any function that you supply to "RegAdminCmd" must 100% match the following signature:
PHP Code:
typedef ConCmd = function Action(int clientint args
Any deviance will result in the prototype mismatch error.
Signature explained:
1) Function is public (As of SM 1.8's release as stable, this is now optional)
2) Function's return type is "Action"
3) Function takes 2 arguements, both are type int
It worked ! Thank you for your help
__________________
Still loading...
AmeriK 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 17:22.


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