added request amb369, part 1
authorDavid Anderson <dvander@alliedmods.net>
Fri Jun 08 04:40:40 2007 +0000 (2007-06-08)
changeset 926b42be6b5f221
parent 925 2cd3d817b5ab
child 927 a60cedac2a1a
added request amb369, part 1
plugins/basecommands.sp
plugins/include/functions.inc
plugins/include/helpers.inc
     1.1 --- a/plugins/basecommands.sp	Fri Jun 08 03:50:23 2007 +0000
     1.2 +++ b/plugins/basecommands.sp	Fri Jun 08 04:40:40 2007 +0000
     1.3 @@ -33,6 +33,8 @@
     1.4  	url = "http://www.sourcemod.net/"
     1.5  };
     1.6  
     1.7 +new Handle:hBanForward = INVALID_HANDLE;
     1.8 +
     1.9  public OnPluginStart()
    1.10  {
    1.11  	LoadTranslations("common.cfg");
    1.12 @@ -45,6 +47,8 @@
    1.13  	RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]");
    1.14  	RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> <minutes|0> [reason]");
    1.15  	RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>");
    1.16 +	
    1.17 +	hBanForward = CreateGlobalForward("OnClientBanned", ET_Ignore, Param_Cell, Param_Cell, Param_String);
    1.18  }
    1.19  
    1.20  public Action:Command_Unban(client, args)
    1.21 @@ -137,6 +141,13 @@
    1.22  	
    1.23  	LogMessage("\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, clients[0], time, reason);
    1.24  	
    1.25 +	/* Fire the ban forward */
    1.26 +	Call_StartForward(hBanForward);
    1.27 +	Call_PushCell(client);
    1.28 +	Call_PushCell(clients[0]);
    1.29 +	Call_PushString(reason);
    1.30 +	Call_Finish();
    1.31 +
    1.32  	if (reason[0] == '\0')
    1.33  	{
    1.34  		strcopy(reason, sizeof(reason), "Banned");
     2.1 --- a/plugins/include/functions.inc	Fri Jun 08 03:50:23 2007 +0000
     2.2 +++ b/plugins/include/functions.inc	Fri Jun 08 04:40:40 2007 +0000
     2.3 @@ -310,7 +310,7 @@
     2.4   * @return					SP_ERROR_NONE on success, any other integer on failure.
     2.5   * @error					Called before a call has been started.
     2.6   */
     2.7 -native Call_Finish(&result);
     2.8 +native Call_Finish(&result=0);
     2.9  
    2.10  /**
    2.11   * Cancels a call to a function or forward's call list.
     3.1 --- a/plugins/include/helpers.inc	Fri Jun 08 03:50:23 2007 +0000
     3.2 +++ b/plugins/include/helpers.inc	Fri Jun 08 04:40:40 2007 +0000
     3.3 @@ -19,6 +19,15 @@
     3.4  #define _helpers_included
     3.5  
     3.6  /**
     3.7 + * Provided by basecommands.sp when sm_ban is called.
     3.8 + *
     3.9 + * @param admin			Admin client index.
    3.10 + * @param client		Client index which will be banned.
    3.11 + * @param reason		Ban reason (may be empty if none exists).
    3.12 + */
    3.13 +forward OnClientBanned(admin, client, const String:reason[]);
    3.14 +
    3.15 +/**
    3.16   * Formats a user's info as log text.
    3.17   *
    3.18   * @param client		Client index.