diff --git a/plugins/basecommands.sp b/plugins/basecommands.sp index b1324eed..76550683 100644 --- a/plugins/basecommands.sp +++ b/plugins/basecommands.sp @@ -33,6 +33,8 @@ public Plugin:myinfo = url = "http://www.sourcemod.net/" }; +new Handle:hBanForward = INVALID_HANDLE; + public OnPluginStart() { LoadTranslations("common.cfg"); @@ -45,6 +47,8 @@ public OnPluginStart() RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]"); RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> [reason]"); RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban "); + + hBanForward = CreateGlobalForward("OnClientBanned", ET_Ignore, Param_Cell, Param_Cell, Param_String); } public Action:Command_Unban(client, args) @@ -137,6 +141,13 @@ public Action:Command_Ban(client, args) LogMessage("\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, clients[0], time, reason); + /* Fire the ban forward */ + Call_StartForward(hBanForward); + Call_PushCell(client); + Call_PushCell(clients[0]); + Call_PushString(reason); + Call_Finish(); + if (reason[0] == '\0') { strcopy(reason, sizeof(reason), "Banned"); diff --git a/plugins/include/functions.inc b/plugins/include/functions.inc index a7f0587c..6190f391 100644 --- a/plugins/include/functions.inc +++ b/plugins/include/functions.inc @@ -310,7 +310,7 @@ native Call_PushStringEx(String:value[], length, szflags, cpflags); * @return SP_ERROR_NONE on success, any other integer on failure. * @error Called before a call has been started. */ -native Call_Finish(&result); +native Call_Finish(&result=0); /** * Cancels a call to a function or forward's call list. diff --git a/plugins/include/helpers.inc b/plugins/include/helpers.inc index e3519aff..0e2fe128 100644 --- a/plugins/include/helpers.inc +++ b/plugins/include/helpers.inc @@ -18,6 +18,15 @@ #endif #define _helpers_included +/** + * Provided by basecommands.sp when sm_ban is called. + * + * @param admin Admin client index. + * @param client Client index which will be banned. + * @param reason Ban reason (may be empty if none exists). + */ +forward OnClientBanned(admin, client, const String:reason[]); + /** * Formats a user's info as log text. *