|
Senior Member
|
04-20-2015
, 01:58
Re: SourceMod 1.7.1 Released
|
#10
|
i am put line "#pragma newdecls required" after include's and after experiments get error..
- why we cannot create custom native with type not a int type, may be beacuse by this in .inc files
Code:
native CreateNative(const String:name[], NativeCall:func);
typedef NativeCall = function int (Handle plugin, int numParams)
for example how get error
Code:
error 100: function prototypes do not match
example code:
Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("TestNative", _TestNative);
return APLRes_Success;
}
public bool _TestNative(Handle plugin, int numParams)
{
return GetSpawnAccess();
}
bool GetSpawnAccess()
{
return true;
}
- line public void OnEntityCreated(int entity, const char[] classname) get error:
Code:
error 180: function return type differs from prototype. expected 'int', but got 'void'
example code:
Code:
#include <sourcemod>
#include <sdkhooks>
#pragma semicolon 1
#pragma newdecls required
public void OnEntityCreated(int entity, const char[] classname)
{
if (IsServerProcessing())
{
}
}
in sdkhooks.inc
Code:
/**
* @brief When an entity is created
*
* @param entity Entity index
* @param classname Class name
*/
forward void OnEntityCreated(int entity, const char[] classname);
Last edited by Electr000999; 04-20-2015 at 03:11.
|
|
|
|