#include <amxmod>
#include <amxmisc>
#include <reapi>
new const PLUGIN_NAME[] = "[ReAPI] ^"status^" & ^"ping^" Commands Blocker"
new const g_iVersionRequired_RH[2] = {1, 0}
public plugin_init() {
register_plugin(PLUGIN_NAME, "1.0.0", "AMX Mod Dev")
switch(ReAPI_BF_HasBinaryRunning(ReAPI_BT_ReHLDS, true, g_iVersionRequired_RH[0], g_iVersionRequired_RH[1], true, true)) {
case 0: {
log_amx("[%s] Unable to use the plugin, the %s's API is unavailable (the %s engine binary is probably not running).", PLUGIN_NAME, "ReHLDS", "ReHLDS")
//pause("ae")
return
}
case 1: {
new iMajorVersion = -1, iMinorVersion = -1
ReAPI_BF_GetBinaryInformations(ReAPI_BT_ReHLDS, iMajorVersion, iMinorVersion)
log_amx("[%s] Unable to use the plugin, the %s's API version is lower than the one required (current: v%d.%d, required: v%d.%d).", PLUGIN_NAME, "ReHLDS", "ReHLDS", iMajorVersion, iMinorVersion, g_iVersionRequired_RH[0], g_iVersionRequired_RH[1])
//pause("ae")
return
}
}
// Note: Do not use "ValidateCommand" hook!
ReAPI_HM_AddHookByTypeName(ReAPI_BT_ReHLDS, "ExecuteServerStringCmd", ReAPI_AHCT_Pre1_Alterable, ReAPI_AHPT_Beginning, "HOOK_ExecuteSRVStringCmd_Pre1")
}
public HOOK_ExecuteSRVStringCmd_Pre1(const szCommand[], cmd_source:iCommandSourceType, iPerformerID) {
// Only allow the server (ID #0) or a real admin to use them.
if(iCommandSourceType != src_client
|| iPerformerID <= 0
|| is_user_realadmin(iPerformerID)
|| !equali(szCommand, "status") && !equali(szCommand, "ping"))
return ReAPI_AHRVF_Ignored
// Hehehehehe!
console_print(iPerformerID, "Unknown command: %s", szCommand)
return ReAPI_AHRVF_Supercede
}