/* Plugin Template generated by Pawn Studio */
name = "Radio Spam Block",
description = "Blocking players from radio spam. Also can disable radio commands for all players on the server if option is set.",
version = PLUGIN_VERSION,
url = "www.sourcemod.net"
new Handle:cvar_radio_spam_block = INVALID_HANDLE;
new Handle:cvar_radio_spam_block_time = INVALID_HANDLE;
new Handle:cvar_radio_spam_block_all = INVALID_HANDLE;
new Handle:cvar_radio_spam_block_notify = INVALID_HANDLE;
CreateConVar("sm_radio_spam_block_version", PLUGIN_VERSION, "Radio Spam Block Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
cvar_radio_spam_block = CreateConVar("sm_radio_spam_block", "1", "0 = disabled, 1 = enabled Radio Spam Block functionality", FCVAR_PLUGIN, true, 0.0, true, 1.0);
cvar_radio_spam_block_time = CreateConVar("sm_radio_spam_block_time", "5", "Time in seconds between radio messages", FCVAR_PLUGIN, true, 1.0, true, 60.0);
cvar_radio_spam_block_all = CreateConVar("sm_radio_spam_block_all", "1", "0 = disabled, 1 = block all radio messages", FCVAR_PLUGIN, true, 0.0, true, 1.0);
cvar_radio_spam_block_notify = CreateConVar("sm_radio_spam_block_notify", "1", "0 = disabled, 1 = show a chat message to the player when his radio spam blocked", FCVAR_PLUGIN, true, 0.0, true, 1.0);
for (new i = 0; i < 64; i++)
RegConsoleCmd("coverme", RestrictRadio);
RegConsoleCmd("takepoint", RestrictRadio);
RegConsoleCmd("holdpos", RestrictRadio);
RegConsoleCmd("regroup", RestrictRadio);
RegConsoleCmd("followme", RestrictRadio);
RegConsoleCmd("takingfire", RestrictRadio);
RegConsoleCmd("go", RestrictRadio);
RegConsoleCmd("fallback", RestrictRadio);
RegConsoleCmd("sticktog", RestrictRadio);
RegConsoleCmd("getinpos", RestrictRadio);
RegConsoleCmd("stormfront", RestrictRadio);
RegConsoleCmd("report", RestrictRadio);
RegConsoleCmd("roger", RestrictRadio);
RegConsoleCmd("enemyspot", RestrictRadio);
RegConsoleCmd("needbackup", RestrictRadio);
RegConsoleCmd("sectorclear", RestrictRadio);
RegConsoleCmd("inposition", RestrictRadio);
RegConsoleCmd("reportingin", RestrictRadio);
RegConsoleCmd("getout", RestrictRadio);
RegConsoleCmd("negative", RestrictRadio);
RegConsoleCmd("enemydown", RestrictRadio);
LoadTranslations("radiospamblock.phrases.txt");
public Action:RestrictRadio(client ,args)
if (!GetConVarBool(cvar_radio_spam_block))
notify = GetConVarBool(cvar_radio_spam_block_notify);
if(GetConVarBool(cvar_radio_spam_block_all))
PrintToChat(client, "[SM] %t", "Disabled");
if (last_radio_use[client] == -1)
last_radio_use[client] = GetTime();
new time = GetTime() - last_radio_use[client];
new block_time = GetConVarInt(cvar_radio_spam_block_time);
if ( time >= block_time )
last_radio_use[client] = GetTime();
new wait_time = block_time - time;
if ( (note[client] != wait_time) && notify)
PrintToChat(client, "[SM] %t", "Wait 1 second");
PrintToChat(client, "[SM] %t", "Wait X seconds", wait_time);
note[client] = wait_time;