AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   error 100: function prototypes do not match with natives (https://forums.alliedmods.net/showthread.php?t=347029)

bridgebucket 03-28-2024 21:46

error 100: function prototypes do not match with natives
 
trying to use natives, confused on this error. just need some help figuring out what the correct code to use would be. the lines producing this error are these two:

CreateNative("wardenExists", Native_wardenExists);
CreateNative("isWarden", Native_isWarden);

the full code is as follows:

// warden.sp
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("wardenExists", Native_wardenExists);
CreateNative("isWarden", Native_isWarden);
return APLRes_Success;
}

public bool Native_wardenExists(Handle plugin, int numParams)
{
if(Warden != -1) { return true; }
else { return false; }
}

public bool Native_isWarden(Handle plugin, int numParams)
{
int client = GetNativeCell(1);

for(int i = 2; i <= numParams; i++)
{
client += GetNativeCellRef(i);
}

if(client == Warden) { return true; }
else { return false; }
}

//warden.inc
#if defined _warden_included_
#endinput
#endif
#define _warden_included_

/**
*
* @return true on match, false if not
*/
native bool wardenExists();

/**
*
* @param client client to run the check on
* @return true on match, false if not
*/
native bool isWarden(client);

little_froy 03-29-2024 08:05

Re: error 100: function prototypes do not match with natives
 
public bool Native_wardenExists -> any Native_wardenExists
public bool Native_isWarden -> any Native_isWarden

"public" prefix is only for implementing forwards. other callbacks don't need it.

bridgebucket 03-29-2024 18:44

Re: error 100: function prototypes do not match with natives
 
Quote:

Originally Posted by little_froy (Post 2820254)
public bool Native_wardenExists -> any Native_wardenExists
public bool Native_isWarden -> any Native_isWarden

this solution adds 3 new errors on top of the previous two; symbol is never used: "numParams"/"plugin"

little_froy 03-29-2024 21:45

Re: error 100: function prototypes do not match with natives
 
Quote:

Originally Posted by bridgebucket (Post 2820286)
this solution adds 3 new errors on top of the previous two; symbol is never used: "numParams"/"plugin"

update sourcemod, if you are using an old version.

bridgebucket 03-30-2024 01:56

Re: error 100: function prototypes do not match with natives
 
Quote:

Originally Posted by little_froy (Post 2820298)
update sourcemod

i'm using spedit, latest version. under the configuration tab, it says i'm using Standard SM 1.8.0.5914. is spedit outdated, how should i be making plugins?

little_froy 03-30-2024 02:22

Re: error 100: function prototypes do not match with natives
 
Quote:

Originally Posted by bridgebucket (Post 2820311)
i'm using spedit, latest version. under the configuration tab, it says i'm using Standard SM 1.8.0.5914. is spedit outdated, how should i be making plugins?

should update sourcemod. latest stable version is 1.11 - build 6956.
use vscode to write code, to compile plugins, use command line in linux or drag .sp file to compile.exe in windows.


All times are GMT -4. The time now is 12:58.

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