added request amb369, part 1

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40932
This commit is contained in:
David Anderson 2007-06-08 04:40:40 +00:00
parent 7b9b90e2a2
commit 48830e2c16
3 changed files with 21 additions and 1 deletions

View File

@ -33,6 +33,8 @@ public Plugin:myinfo =
url = "http://www.sourcemod.net/" url = "http://www.sourcemod.net/"
}; };
new Handle:hBanForward = INVALID_HANDLE;
public OnPluginStart() public OnPluginStart()
{ {
LoadTranslations("common.cfg"); LoadTranslations("common.cfg");
@ -45,6 +47,8 @@ public OnPluginStart()
RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]"); RegAdminCmd("sm_who", Command_Who, ADMFLAG_GENERIC, "sm_who [#userid|name]");
RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> <minutes|0> [reason]"); RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> <minutes|0> [reason]");
RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>"); RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>");
hBanForward = CreateGlobalForward("OnClientBanned", ET_Ignore, Param_Cell, Param_Cell, Param_String);
} }
public Action:Command_Unban(client, args) 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); 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') if (reason[0] == '\0')
{ {
strcopy(reason, sizeof(reason), "Banned"); strcopy(reason, sizeof(reason), "Banned");

View File

@ -310,7 +310,7 @@ native Call_PushStringEx(String:value[], length, szflags, cpflags);
* @return SP_ERROR_NONE on success, any other integer on failure. * @return SP_ERROR_NONE on success, any other integer on failure.
* @error Called before a call has been started. * @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. * Cancels a call to a function or forward's call list.

View File

@ -18,6 +18,15 @@
#endif #endif
#define _helpers_included #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. * Formats a user's info as log text.
* *