Quote:
Originally Posted by DonKisgot
Thanks bro! Really nicework!
1 more suggestion from me ;
Can you please make an admin command like : amx_warn , as ı see when we use this plugin we don't need to use another external gag plugin. So , if you can make an admin command admins can warn players ? (with motd)
Anyways NJ
|
What I feel is that these are Misc features i.e. these are not related to the motive of the plugin. However, since the code is open, you can yourself define it in the plugin. functions like : "ASP_Motd" and "ASP_Punish" readily maintain the information and execution of spammers + as I mentioned, a developmental API has been made out of the entire plugin. You can add your own scripts for other types of spams as well ( if there are any )
Specifically in your case, you would need to register a concmd/clcmd command in plugin_init() to point to a function eg. "ASP_gag" or whatever you want to name it. eg.
PHP Code:
ASP_Gag ( id )
{
static iTarget, argc, arg[32];
argc = read_argc ( ) - 1;
if ( !argc ) /* min. 1 argument */
return PLUGIN_HANDLED
// Read Argument 1 eg. SteamID or #UserID or Name
read_argv ( 1, arg, charsmax ( arg ) );
iTarget = cmd_target ( id, arg );
if ( !iTarget ) // Player not Found
return PLUGIN_HANDLED
// Read Argument 2 eg. 0 - MODE_CHAT, 1 - MODE_NAME, 2 - BOTH
static bool: MODE_GAG;
MODE_GAG = 0;
if ( argc >= 2 )
{
read_argv ( 2, arg, charsmax ( arg ) );
MODE_GAG = str_to_num ( arg );
}
// Read Argument 3 eg. 30.0 ( in Seconds Duration )
static Float: fDuration, szDuration[32];
fDuration = 0.0;
if ( argc >= 3 ) /* actual 3 arguments */
{
read_argv ( 3, arg, charsmax ( arg ) );
fDuration = str_to_float ( arg );
formatex ( szDuration, charsmax ( szDuration ), "[ Duration - %0.0f Seconds ]", fDuration );
}
static Float: fStore;
fStore = 0.0;
if ( MODE_GAG == 0 || MODE_GAG == 2 )
{
// Check for Duration
if ( fDuration )
{
// Store Original Duration
fStore = Float: CONFIG[Chat_PunishDuration];
CONFIG[Chat_PunishDuration] = _:fDuration;
// Punish and Restore Original Duration
ASP_Punish ( iTarget, SPAM_NULL, MODE_CHAT );
CONFIG[Chat_PunishDuration] = _:fStore;
// Show MOTD
if ( MODE_GAG == 0 )
ASP_Motd ( iTarget, "Your Chat Has Been Blocked For Spamming", szDuration );
}
else
{
// Simply Punish and Show Motd
ASP_Punish ( iTarget, SPAM_NULL, MODE_CHAT );
if ( MODE_GAG == 0 )
ASP_Motd ( iTarget, "Your Chat Has Been Blocked For Spamming", CONFIG[Chat_PunishDuration] );
}
}
if ( MODE_GAG == 1 || MODE_GAG == 2 )
{
// Check for Duration
if ( fDuration )
{
// Store Original Duration
fStore = Float: CONFIG[Name_PunishDuration];
CONFIG[Name_PunishDuration] = _:fDuration;
// Punish and Restore Original Duration
ASP_Punish ( iTarget, SPAM_NULL, MODE_NAME );
CONFIG[Name_PunishDuration] = _:fStore;
// Show MOTD
if ( MODE_GAG == 1 )
ASP_Motd ( iTarget, "You have been Prevented from Changing Name For Spamming", szDuration );
}
else
{
// Simply Punish and Show Motd
ASP_Punish ( iTarget, SPAM_NULL, MODE_NAME );
if ( MODE_GAG == 1 )
ASP_Motd ( iTarget, "You have been Prevented from Changing Name For Spamming", Float: CONFIG[Name_PunishDuration] );
}
}
// Just a little different MOTD for "Both" case
if ( MODE_GAG == 2 )
ASP_Motd ( iTarget, "Your Chat and Name, both have been Blocked For Spamming", fDuration? szDuration : ( Float: CONFIG[Name_PunishDuration] ) );
return PLUGIN_HANDLED
}