2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-28 15:45:31 +03:00

Fixed pmtrace natives

Added error if native requires one of the unexisting addons
This commit is contained in:
asmodai 2016-07-08 00:27:35 +03:00
parent b03360a268
commit 1ba339a98b
6 changed files with 30 additions and 16 deletions

View File

@ -88,7 +88,7 @@ native any:get_movevar(const MoveVars:var, any:...);
*
* @return 1 on success.
*/
native set_pmtrace(const PMTrace:var, any:...);
native set_pmtrace(const tracehandle, const PMTrace:var, any:...);
/*
* Returns a pmtrace vars
@ -97,7 +97,7 @@ native set_pmtrace(const PMTrace:var, any:...);
*
* @return If an integer or boolean or one byte, array or everything else is passed via 3rd argument and more, look at argument list for specified mvar
*/
native any:get_pmtrace(const PMTrace:var, any:...);
native any:get_pmtrace(const tracehandle, const PMTrace:var, any:...);
/*
* Assign the number of the player animations.

View File

@ -108,9 +108,12 @@ AMX_NATIVE_INFO Reunion_Natives[] =
void RegisterNatives_Addons()
{
if (api_cfg.hasVTC())
g_amxxapi.AddNatives(Vtc_Natives);
if (!api_cfg.hasVTC())
fillNatives(Vtc_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "VTC"); return FALSE; });
if (api_cfg.hasReunion())
g_amxxapi.AddNatives(Reunion_Natives);
if (!api_cfg.hasReunion())
fillNatives(Reunion_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "Reunion"); return FALSE; });
g_amxxapi.AddNatives(Vtc_Natives);
g_amxxapi.AddNatives(Reunion_Natives);
}

View File

@ -93,3 +93,9 @@ private:
AMX* m_amx;
cell* m_params;
};
inline void fillNatives(AMX_NATIVE_INFO* table, cell (AMX_NATIVE_CALL with)(AMX *, cell *))
{
for (size_t i = 0; table[i].name; i++)
table[i].func = with;
}

View File

@ -295,6 +295,8 @@ AMX_NATIVE_INFO HookChain_Natives[] =
void RegisterNatives_HookChains()
{
if (api_cfg.hasReHLDS() || api_cfg.hasReGameDLL())
g_amxxapi.AddNatives(HookChain_Natives);
if (!api_cfg.hasReHLDS() && !api_cfg.hasReGameDLL())
fillNatives(HookChain_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "You need ReHlds or ReGameDll for use hookchains"); return FALSE; });
g_amxxapi.AddNatives(HookChain_Natives);
}

View File

@ -433,9 +433,10 @@ AMX_NATIVE_INFO ReGameVars_Natives[] =
void RegisterNatives_Members()
{
if (api_cfg.hasReGameDLL())
g_amxxapi.AddNatives(ReGameVars_Natives);
if (!api_cfg.hasReGameDLL())
fillNatives(ReGameVars_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReGameDll"); return FALSE; });
g_amxxapi.AddNatives(ReGameVars_Natives);
g_amxxapi.AddNatives(EngineVars_Natives);
}

View File

@ -1760,11 +1760,13 @@ AMX_NATIVE_INFO Misc_Natives_Checks[] =
void RegisterNatives_Misc()
{
if (api_cfg.hasReGameDLL())
g_amxxapi.AddNatives(Misc_Natives_RG);
if (api_cfg.hasReHLDS())
g_amxxapi.AddNatives(Misc_Natives_RH);
if (!api_cfg.hasReGameDLL())
fillNatives(Misc_Natives_RG, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReGameDll"); return FALSE; });
if (!api_cfg.hasReHLDS())
fillNatives(Misc_Natives_RH, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReHlds"); return FALSE; });
g_amxxapi.AddNatives(Misc_Natives_RG);
g_amxxapi.AddNatives(Misc_Natives_RH);
g_amxxapi.AddNatives(Misc_Natives_Checks);
}