Posts: 42
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: May 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
Code: /* AMX Mod X
* NextMap Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <amxmodx>
#include <colorchat>
// WARNING: If you comment this line make sure
// that in your mapcycle file maps don't repeat.
// However the same map in a row is still valid.
#define OBEY_MAPCYCLE
new g_nextMap[32]
new g_mapCycle[32]
new g_pos
public plugin_init()
{
register_plugin("NextMap", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("nextmap.txt")
register_event("30", "changeMap", "a")
register_clcmd("say nextmap", "sayNextMap", 0, "- displays nextmap")
register_clcmd("say currentmap", "sayCurrentMap", 0, "- display current map")
register_clcmd("say ff", "sayFFStatus", 0, "- display friendly fire status")
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
new szString[32], szString2[32], szString3[8]
get_localinfo("lastmapcycle", szString, 31)
parse(szString, szString2, 31, szString3, 7)
g_pos = str_to_num(szString3)
get_cvar_string("mapcyclefile", g_mapCycle, 31)
if (!equal(g_mapCycle, szString2))
g_pos = 0 // mapcyclefile has been changed - go from first
readMapCycle(g_mapCycle, g_nextMap, 31)
set_cvar_string("amx_nextmap", g_nextMap)
format(szString3, 31, "%s %d", g_mapCycle, g_pos) // save lastmapcycle settings
set_localinfo("lastmapcycle", szString3)
}
getNextMapName(szArg[], iMax)
{
new len = get_cvar_string("amx_nextmap", szArg, iMax)
if (ValidMap(szArg)) return len
len = copy(szArg, iMax, g_nextMap)
set_cvar_string("amx_nextmap", g_nextMap)
return len
}
public sayNextMap()
{
new name[32]
getNextMapName(name, 31)
client_print_color(0, print_chat, "^4%L ^3%s", LANG_PLAYER, "^4NEXT_MAP", name)
}
public sayCurrentMap()
{
new mapname[32]
get_mapname(mapname, 31)
client_print_color(0, print_chat, "^4%L: ^3%s", LANG_PLAYER, "^4PLAYED_MAP", mapname)
}
public sayFFStatus()
{
client_print_color(0, print_chat, "^4%L: ^3%L", LANG_PLAYER, "^4FRIEND_FIRE", LANG_PLAYER, get_cvar_num("mp_friendlyfire") ? "^3ON" : "^4OFF")
}
public delayedChange(param[])
{
set_cvar_float("mp_chattime", get_cvar_float("mp_chattime") - 2.0)
server_cmd("changelevel %s", param)
}
public changeMap()
{
new string[32]
new Float:chattime = get_cvar_float("mp_chattime")
set_cvar_float("mp_chattime", chattime + 2.0) // make sure mp_chattime is long
new len = getNextMapName(string, 31) + 1
set_task(chattime, "delayedChange", 0, string, len) // change with 1.5 sec. delay
}
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")"
stock bool:ValidMap(mapname[])
{
if ( is_map_valid(mapname) )
{
return true;
}
// If the is_map_valid check failed, check the end of the string
new len = strlen(mapname) - 4;
// The mapname was too short to possibly house the .bsp extension
if (len < 0)
{
return false;
}
if ( equali(mapname[len], ".bsp") )
{
// If the ending was .bsp, then cut it off.
// the string is byref'ed, so this copies back to the loaded text.
mapname[len] = '^0';
// recheck
if ( is_map_valid(mapname) )
{
return true;
}
}
return false;
}
#if defined OBEY_MAPCYCLE
readMapCycle(szFileName[], szNext[], iNext)
{
new b, i = 0, iMaps = 0
new szBuffer[32], szFirst[32]
if (file_exists(szFileName))
{
while (read_file(szFileName, i++, szBuffer, 31, b))
{
if (!isalnum(szBuffer[0]) || !ValidMap(szBuffer)) continue
if (!iMaps)
copy(szFirst, 31, szBuffer)
if (++iMaps > g_pos)
{
copy(szNext, iNext, szBuffer)
g_pos = iMaps
return
}
}
}
if (!iMaps)
{
log_amx(g_warning, szFileName)
get_mapname(szFirst, 31)
}
copy(szNext, iNext, szFirst)
g_pos = 1
}
#else
readMapCycle(szFileName[], szNext[], iNext)
{
new b, i = 0, iMaps = 0
new szBuffer[32], szFirst[32], szCurrent[32]
get_mapname(szCurrent, 31)
new a = g_pos
if (file_exists(szFileName))
{
while (read_file(szFileName, i++, szBuffer, 31, b))
{
if (!isalnum(szBuffer[0]) || !ValidMap(szBuffer)) continue
if (!iMaps)
{
iMaps = 1
copy(szFirst, 31, szBuffer)
}
if (iMaps == 1)
{
if (equali(szCurrent, szBuffer))
{
if (a-- == 0)
iMaps = 2
}
} else {
if (equali(szCurrent, szBuffer))
++g_pos
else
g_pos = 0
copy(szNext, iNext, szBuffer)
return
}
}
}
if (!iMaps)
{
log_amx(g_warning, szFileName)
copy(szNext, iNext, szCurrent)
}
else
copy(szNext, iNext, szFirst)
g_pos = 0
}
#endif
ej kqyre be edhe te kjo e bona complie e krejt ama pe qet aty ML_NOTFOUND:NEXTMAP de_dust2 ?? a munesh me ma bo ni plugin me ngjyra te timeleft ama qe o tamam ?
edhe
Code: /* AMX Mod X
* TimeLeft Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <amxmodx>
#include <colorchat>
new g_TimeSet[32][2]
new g_LastTime
new g_CountDown
new g_Switch
public plugin_init()
{
register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("timeleft.txt")
register_cvar("amx_time_voice", "1")
register_srvcmd("amx_time_display", "setDisplaying")
register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
}
public sayTheTime(id)
{
if (get_cvar_num("amx_time_voice"))
{
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
get_time("%H", mhours, 5)
get_time("%M", mmins, 5)
new mins = str_to_num(mmins)
new hrs = str_to_num(mhours)
if (mins)
num_to_word(mins, wmins, 31)
else
wmins[0] = 0
if (hrs < 12)
wpm = "am "
else
{
if (hrs > 12) hrs -= 12
wpm = "pm "
}
if (hrs)
num_to_word(hrs, whours, 31)
else
whours = "twelve "
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
}
new ctime[64]
get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
client_print_color(0, print_chat, "^4%L: ^3%s", LANG_PLAYER, "^4THE_TIME", ctime)
return PLUGIN_CONTINUE
}
public sayTimeLeft(id)
{
if (get_cvar_float("mp_timelimit"))
{
new a = get_timeleft()
if (get_cvar_num("amx_time_voice"))
{
new svoice[128]
setTimeVoice(svoice, 127, 0, a)
client_cmd(id, "%s", svoice)
}
client_print_color(0, print_chat, "^4%L: ^3%d:%02d", LANG_PLAYER, "^4TIME_LEFT", (a / 60), (a % 60))
}
else
client_print_color(0, print_chat, "^4%L", LANG_PLAYER, "^3NO_T_LIMIT")
return PLUGIN_CONTINUE
}
setTimeText(text[], len, tmlf, id)
{
new secs = tmlf % 60
new mins = tmlf / 60
if (secs == 0)
format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
else if (mins == 0)
format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
else
format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
}
setTimeVoice(text[], len, flags, tmlf)
{
new temp[7][32]
new secs = tmlf % 60
new mins = tmlf / 60
for (new a = 0;a < 7;++a)
temp[a][0] = 0
if (secs > 0)
{
num_to_word(secs, temp[4], 31)
if (!(flags & 8))
temp[5] = "seconds " /* there is no "second" in default hl */
}
if (mins > 59)
{
new hours = mins / 60
num_to_word(hours, temp[0], 31)
if (!(flags & 8))
temp[1] = "hours "
mins = mins % 60
}
if (mins > 0)
{
num_to_word(mins, temp[2], 31)
if (!(flags & 8))
temp[3] = "minutes "
}
if (!(flags & 4))
temp[6] = "remaining "
return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
}
findDispFormat(time)
{
for (new i = 0; g_TimeSet[i][0]; ++i)
{
if (g_TimeSet[i][1] & 16)
{
if (g_TimeSet[i][0] > time)
{
if (!g_Switch)
{
g_CountDown = g_Switch = time
remove_task(8648458)
set_task(1.0, "timeRemain", 34543, "", 0, "b")
}
return i
}
}
else if (g_TimeSet[i][0] == time)
{
return i
}
}
return -1
}
public setDisplaying()
{
new arg[32], flags[32], num[32]
new argc = read_argc() - 1
new i = 0
while (i < argc && i < 32)
{
read_argv(i + 1, arg, 31)
parse(arg, flags, 31, num, 31)
g_TimeSet[i][0] = str_to_num(num)
g_TimeSet[i][1] = read_flags(flags)
i++
}
g_TimeSet[i][0] = 0
return PLUGIN_HANDLED
}
public timeRemain(param[])
{
new gmtm = get_timeleft()
new tmlf = g_Switch ? --g_CountDown : gmtm
new stimel[12]
format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
set_cvar_string("amx_timeleft", stimel)
if (g_Switch && gmtm > g_Switch)
{
remove_task(34543)
g_Switch = 0
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
return
}
if (tmlf > 0 && g_LastTime != tmlf)
{
g_LastTime = tmlf
new tm_set = findDispFormat(tmlf)
if (tm_set != -1)
{
new flags = g_TimeSet[tm_set][1]
new arg[128]
if (flags & 1)
{
new players[32], pnum
get_players(players, pnum, "c")
for (new i = 0; i < pnum; i++)
{
setTimeText(arg, 127, tmlf, players[i])
if (flags & 16)
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
else
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)
show_hudmessage(players[i], "%s", arg)
}
}
if (flags & 2)
{
setTimeVoice(arg, 127, flags, tmlf)
client_cmd(0, "%s", arg)
}
}
}
}
ej kqyre be edhe te kjo e bona complie e krejt ama pe qet aty ML_NOTFOUND:TIME_LEFT: (kohen pe tregon) ?? a munesh me ma bo ni plugin me ngjyra te timeleft ama qe o tamam ?
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 42
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: May 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
Code: /* AMX Mod X
* NextMap Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <amxmodx>
#include <colorchat>
// WARNING: If you comment this line make sure
// that in your mapcycle file maps don't repeat.
// However the same map in a row is still valid.
#define OBEY_MAPCYCLE
new g_nextMap[32]
new g_mapCycle[32]
new g_pos
public plugin_init()
{
register_plugin("NextMap", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("nextmap.txt")
register_event("30", "changeMap", "a")
register_clcmd("say nextmap", "sayNextMap", 0, "- displays nextmap")
register_clcmd("say currentmap", "sayCurrentMap", 0, "- display current map")
register_clcmd("say ff", "sayFFStatus", 0, "- display friendly fire status")
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
new szString[32], szString2[32], szString3[8]
get_localinfo("lastmapcycle", szString, 31)
parse(szString, szString2, 31, szString3, 7)
g_pos = str_to_num(szString3)
get_cvar_string("mapcyclefile", g_mapCycle, 31)
if (!equal(g_mapCycle, szString2))
g_pos = 0 // mapcyclefile has been changed - go from first
readMapCycle(g_mapCycle, g_nextMap, 31)
set_cvar_string("amx_nextmap", g_nextMap)
format(szString3, 31, "%s %d", g_mapCycle, g_pos) // save lastmapcycle settings
set_localinfo("lastmapcycle", szString3)
}
getNextMapName(szArg[], iMax)
{
new len = get_cvar_string("amx_nextmap", szArg, iMax)
if (ValidMap(szArg)) return len
len = copy(szArg, iMax, g_nextMap)
set_cvar_string("amx_nextmap", g_nextMap)
return len
}
public sayNextMap()
{
new name[32]
getNextMapName(name, 31)
client_print_color(0, print_chat, "^4%L ^3%s", LANG_PLAYER, "^4NEXT_MAP", name)
}
public sayCurrentMap()
{
new mapname[32]
get_mapname(mapname, 31)
client_print_color(0, print_chat, "^4%L: ^3%s", LANG_PLAYER, "^4PLAYED_MAP", mapname)
}
public sayFFStatus()
{
client_print_color(0, print_chat, "^4%L: ^3%L", LANG_PLAYER, "^4FRIEND_FIRE", LANG_PLAYER, get_cvar_num("mp_friendlyfire") ? "^3ON" : "^4OFF")
}
public delayedChange(param[])
{
set_cvar_float("mp_chattime", get_cvar_float("mp_chattime") - 2.0)
server_cmd("changelevel %s", param)
}
public changeMap()
{
new string[32]
new Float:chattime = get_cvar_float("mp_chattime")
set_cvar_float("mp_chattime", chattime + 2.0) // make sure mp_chattime is long
new len = getNextMapName(string, 31) + 1
set_task(chattime, "delayedChange", 0, string, len) // change with 1.5 sec. delay
}
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")"
stock bool:ValidMap(mapname[])
{
if ( is_map_valid(mapname) )
{
return true;
}
// If the is_map_valid check failed, check the end of the string
new len = strlen(mapname) - 4;
// The mapname was too short to possibly house the .bsp extension
if (len < 0)
{
return false;
}
if ( equali(mapname[len], ".bsp") )
{
// If the ending was .bsp, then cut it off.
// the string is byref'ed, so this copies back to the loaded text.
mapname[len] = '^0';
// recheck
if ( is_map_valid(mapname) )
{
return true;
}
}
return false;
}
#if defined OBEY_MAPCYCLE
readMapCycle(szFileName[], szNext[], iNext)
{
new b, i = 0, iMaps = 0
new szBuffer[32], szFirst[32]
if (file_exists(szFileName))
{
while (read_file(szFileName, i++, szBuffer, 31, b))
{
if (!isalnum(szBuffer[0]) || !ValidMap(szBuffer)) continue
if (!iMaps)
copy(szFirst, 31, szBuffer)
if (++iMaps > g_pos)
{
copy(szNext, iNext, szBuffer)
g_pos = iMaps
return
}
}
}
if (!iMaps)
{
log_amx(g_warning, szFileName)
get_mapname(szFirst, 31)
}
copy(szNext, iNext, szFirst)
g_pos = 1
}
#else
readMapCycle(szFileName[], szNext[], iNext)
{
new b, i = 0, iMaps = 0
new szBuffer[32], szFirst[32], szCurrent[32]
get_mapname(szCurrent, 31)
new a = g_pos
if (file_exists(szFileName))
{
while (read_file(szFileName, i++, szBuffer, 31, b))
{
if (!isalnum(szBuffer[0]) || !ValidMap(szBuffer)) continue
if (!iMaps)
{
iMaps = 1
copy(szFirst, 31, szBuffer)
}
if (iMaps == 1)
{
if (equali(szCurrent, szBuffer))
{
if (a-- == 0)
iMaps = 2
}
} else {
if (equali(szCurrent, szBuffer))
++g_pos
else
g_pos = 0
copy(szNext, iNext, szBuffer)
return
}
}
}
if (!iMaps)
{
log_amx(g_warning, szFileName)
copy(szNext, iNext, szCurrent)
}
else
copy(szNext, iNext, szFirst)
g_pos = 0
}
#endif
ej kqyre be edhe te kjo e bona complie e krejt ama pe qet aty ML_NOTFOUND:NEXTMAP de_dust2 ?? a munesh me ma bo ni plugin me ngjyra te timeleft ama qe o tamam ?
edhe
Code: /* AMX Mod X
* TimeLeft Plugin
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <amxmodx>
#include <colorchat>
new g_TimeSet[32][2]
new g_LastTime
new g_CountDown
new g_Switch
public plugin_init()
{
register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("timeleft.txt")
register_cvar("amx_time_voice", "1")
register_srvcmd("amx_time_display", "setDisplaying")
register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
}
public sayTheTime(id)
{
if (get_cvar_num("amx_time_voice"))
{
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
get_time("%H", mhours, 5)
get_time("%M", mmins, 5)
new mins = str_to_num(mmins)
new hrs = str_to_num(mhours)
if (mins)
num_to_word(mins, wmins, 31)
else
wmins[0] = 0
if (hrs < 12)
wpm = "am "
else
{
if (hrs > 12) hrs -= 12
wpm = "pm "
}
if (hrs)
num_to_word(hrs, whours, 31)
else
whours = "twelve "
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
}
new ctime[64]
get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
client_print_color(0, print_chat, "^4%L: ^3%s", LANG_PLAYER, "^4THE_TIME", ctime)
return PLUGIN_CONTINUE
}
public sayTimeLeft(id)
{
if (get_cvar_float("mp_timelimit"))
{
new a = get_timeleft()
if (get_cvar_num("amx_time_voice"))
{
new svoice[128]
setTimeVoice(svoice, 127, 0, a)
client_cmd(id, "%s", svoice)
}
client_print_color(0, print_chat, "^4%L: ^3%d:%02d", LANG_PLAYER, "^4TIME_LEFT", (a / 60), (a % 60))
}
else
client_print_color(0, print_chat, "^4%L", LANG_PLAYER, "^3NO_T_LIMIT")
return PLUGIN_CONTINUE
}
setTimeText(text[], len, tmlf, id)
{
new secs = tmlf % 60
new mins = tmlf / 60
if (secs == 0)
format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
else if (mins == 0)
format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
else
format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
}
setTimeVoice(text[], len, flags, tmlf)
{
new temp[7][32]
new secs = tmlf % 60
new mins = tmlf / 60
for (new a = 0;a < 7;++a)
temp[a][0] = 0
if (secs > 0)
{
num_to_word(secs, temp[4], 31)
if (!(flags & 8))
temp[5] = "seconds " /* there is no "second" in default hl */
}
if (mins > 59)
{
new hours = mins / 60
num_to_word(hours, temp[0], 31)
if (!(flags & 8))
temp[1] = "hours "
mins = mins % 60
}
if (mins > 0)
{
num_to_word(mins, temp[2], 31)
if (!(flags & 8))
temp[3] = "minutes "
}
if (!(flags & 4))
temp[6] = "remaining "
return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
}
findDispFormat(time)
{
for (new i = 0; g_TimeSet[i][0]; ++i)
{
if (g_TimeSet[i][1] & 16)
{
if (g_TimeSet[i][0] > time)
{
if (!g_Switch)
{
g_CountDown = g_Switch = time
remove_task(8648458)
set_task(1.0, "timeRemain", 34543, "", 0, "b")
}
return i
}
}
else if (g_TimeSet[i][0] == time)
{
return i
}
}
return -1
}
public setDisplaying()
{
new arg[32], flags[32], num[32]
new argc = read_argc() - 1
new i = 0
while (i < argc && i < 32)
{
read_argv(i + 1, arg, 31)
parse(arg, flags, 31, num, 31)
g_TimeSet[i][0] = str_to_num(num)
g_TimeSet[i][1] = read_flags(flags)
i++
}
g_TimeSet[i][0] = 0
return PLUGIN_HANDLED
}
public timeRemain(param[])
{
new gmtm = get_timeleft()
new tmlf = g_Switch ? --g_CountDown : gmtm
new stimel[12]
format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
set_cvar_string("amx_timeleft", stimel)
if (g_Switch && gmtm > g_Switch)
{
remove_task(34543)
g_Switch = 0
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
return
}
if (tmlf > 0 && g_LastTime != tmlf)
{
g_LastTime = tmlf
new tm_set = findDispFormat(tmlf)
if (tm_set != -1)
{
new flags = g_TimeSet[tm_set][1]
new arg[128]
if (flags & 1)
{
new players[32], pnum
get_players(players, pnum, "c")
for (new i = 0; i < pnum; i++)
{
setTimeText(arg, 127, tmlf, players[i])
if (flags & 16)
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
else
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, -1)
show_hudmessage(players[i], "%s", arg)
}
}
if (flags & 2)
{
setTimeVoice(arg, 127, flags, tmlf)
client_cmd(0, "%s", arg)
}
}
}
}
ej kqyre be edhe te kjo e bona complie e krejt ama pe qet aty ML_NOTFOUND:TIME_LEFT: (kohen pe tregon) ?? a munesh me ma bo ni plugin me ngjyra te timeleft ama qe o tamam ?
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 326
Threads: 52
%%TYL_NUMTHANKEDLIKED%%
Joined: Feb 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
@veron qyre ku e ki .amxx edhe ashtu qysh e ke bo ti aty te scripting sbon se ajo lidhet me .txt kshtu qe mos jau bo se nuk din
http://www.mediafire.com/download/krie16...eleft.amxx Qe ku e ki .amxx
[info] Qe don addons krejt me ngjyra qe ku e ki http://kosovagamers.com/viewtopic.php?f=393&t=59382[/info]
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 326
Threads: 52
%%TYL_NUMTHANKEDLIKED%%
Joined: Feb 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
@veron qyre ku e ki .amxx edhe ashtu qysh e ke bo ti aty te scripting sbon se ajo lidhet me .txt kshtu qe mos jau bo se nuk din
http://www.mediafire.com/download/krie16...eleft.amxx Qe ku e ki .amxx
[info] Qe don addons krejt me ngjyra qe ku e ki http://kosovagamers.com/viewtopic.php?f=393&t=59382[/info]
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 42
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: May 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
Code: /*******************************************************************************************
* rs_swearfilter.sma Version 2.0 Date: JAN/28/2005
*
* RS Advanced Swear Filter + Punishment (MySQL Support)
*
* By: Rob Secord
* Alias: xeroblood (aka; Achilles)
* Email: xeroblood@gmail.com
*
* Credits: _KaszpiR_, Util, Knocker, poosmith (See Credits Section Below For More Info)
*
* Tested / Developed On:
* CS 1.6 - AMX 0.9.9
* CS 1.6 - AMXX 1.0
* MySQL v4.0.16-nt (Driver: v03.51)
*
*******************************************************************************************
* Admin Commands:
* amx_swearmode <on|off> - In-game admin command to Turn swearMode
* on or off. (removes any current punishments)
* amx_swearmenu - Toggles Swear Menu To Be Attached to you In-Game
* If Swear Menu is attached to an Admin, only
* that admin will see the Swear Menu when a
* player swears too many times. If SwearMenu
* is not attached to an admin, then Gag mode
* is the default!
* amx_namecheck - Runs a Swear Filter On All Clients' Username
* Should be called if CVAR sv_checknames is
* changed to 1 In-Game.
*
* Server CVARS:
* sv_swearfilter <0|1> - Turns the Whole Plugin On/Off
* (0 = Off) (1 = On)
* sv_filtersystem <0|1|2> - Swear Filter System to use:
* (0 = Full Mode) (1 = Slim Mode) (2 = Simple Mode)
* sv_punishsystem <0|1|2> - Punishment System to use:
* (0 = None) (1 = Single) (2 = Progressive)
* sv_censorsystem <0|1|2> - Word Censoring System to use:
* (0 = None) (1 = Random (@$%#)) (2 = Custom)
* sv_renamesystem <0|1|2> - Renaming System to use:
* (0 = Old Name) (1 = Steam ID) (2 = Custom)
* sv_whitelist <0|1> - Whitelist System for GOOD words
* (0 = No Whitelist) (1 = Use Whitelist)
* sv_checknames <0|1> - Player Name Filter
* (0 = Ignore Names) (1 = Filter Names)
* sv_swearhelp <0|1> - Player Help System (say /swear)
* (0 = No Help) (1 = Help)
* sv_bantype <0|1> - Player Ban Type to use:
* (0 = Steam ID) (1 = IP Address)
* sv_obeyimmunity <0|1> - Obey AMX Admin Immunity Rules for Punishments
* (0 = Disobey) (1 = Obey)
*
* sv_menu_options "abc" - The Punishments Allowed in Swear Menu (Possible Flags: "abcdefg")
* sv_punish_single "abc" - The Default Punishment for Single Mode (Possible Flags: "abcdefg")
* sv_rename_custom "Noob" - The Custom Name used for Renaming System
* sv_censor_custom "*" - The Custom Character used for Censoring System
* sv_cash_loss ## - Amount of Cash player will Lose
* sv_gag_time ## - Number of Seconds player will be Gagged
* sv_ban_time ## - Number of Minutes player will be Banned
* sv_fire_time ## - Number of Seconds. player will be Set on Fire
* sv_fire_dmg ## - Amount of Damage/Second player will lose from Fire
* sv_slap_times ## - Number of Times player will be Slapped
* sv_slap_dmg ## - Amount of Damage of each Slap
*
*******************************************************************************************
*
* If longest swear word is > 24 characters, change MAX_WORD_LENGTH
* to reflect longest word.
* If you have more that 40 words, change BLACKLIST_WORDS to reflect
* the number of words in file!
*
* If you use SQL, run the file tables.sql included in ZIP!
*
*******************************************************************************************
* Credits:
* As Always, Much of the credit goes to The People and Tutorials at
* http://amxmod.net/forums" onclick="window.open(this.href);return false; & http://www.amxmodx.org/forums" onclick="window.open(this.href);return false; for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801" onclick="window.open(this.href);return false;
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621" onclick="window.open(this.href);return false;
*
* Bug Fixes/Updates
* _KaszpiR_
*
* Ideas/Suggestions:
* Util, Knocker (see Updates below)
*
* Noticed Bugs (Case-Sensitivity):
* poosmith
*
*******************************************************************************************
* Revision History:
*
* Updates To Version 2.0:
* - Added support for AMX 0.9.9b & AMXX 1.0
* - Added Punishment System: None, Single and Progressive Modes
* - Added Filter System: Simple, Slim and Full Modes
* - Changed Renaming System: Old Name, STEAM ID or Custom
* - Changed Word Censor System: None, Random or Custom
* - Added CVAR to turn Punishments ON/OFF in Swear Menu
* - Fixed Crash Bugs on Multiple Swear Words in one line
*
* Updates To Version 1.6:
* - Fixed support for non-MySql admins (requires recompile)
* (Removed CVAR sv_usemysql -- Defined USE_MYSQL instead)
* - Compiled on Linux SUSE 9.0 by Knocker!!
*
* Updates To Version 1.5:
* - Checks Names for Swear Words if CVAR sv_checknames is set to 1
* - Renames Offensive names to WONID, IP or "Potty-Mouth #". Change by
* setting CVAR sv_rename_mode to 1, 2 or 3 respectively.
*
* - Uses MySQL or FILE for Swear Word List. To Use MySQL, set CVAR
* sv_usemysql to 1, default is 0 (Read From File)
*
* - Added a Whitelist for Good Words (goodwords.ini, or MySQL Table)
*
* - Uses Word Filters (fu.ck) If CVAR sv_usefilters is set to 1
* - Added CVAR sv_swearexact to Test against whole words or substrings
* (This should help protect ppl who say FUN when FU is a Swear Word)
* (Idea: Knocker)
*
* - Added A New Menu Punishment! Remove Cash From Player, Amount of
* cash removed is in CVAR sv_cashloss
*
* - Added a CVAR for the Special Character used for Censoring Words!!
* (instead of ****, see whatever char you want!!)
* (Idea: Knocker)
*
* - Changed: if sv_sweartimes is set to 0, Punishment Is Turned OFF!
*
* - Added a Help MOTD for players who say /swearwords. Admins may
* disable this option with CVAR sv_swearhelp
*
* Updates To Version 1.4: (Credits: Util for the Ideas!)
* - Reads Swear Words From File (addons/amx/swearwords.ini)
* - Added Ban Option (Ban Perm / # Minutes)
* (# Minutes is a CVAR: amx_bantime #)
* (Ban By WONID or IP)
* - Added Swear Word To Menu
*
* Updates To Version 1.4: (Credits: Knocker for the Ideas!)
* - Added Notice to Users When They Swear
* - Added CVAR for displaying/censoring Swear Word
* - Added Word Filter to catch words like: fu.ck or f*u.C,k etc...
*
* Versions prior to 1.4 unreleased...
*
**************************************************************************/
#include "base_inc/config.cfg" // Pre-compilation Configurations
#if defined USE_AMXX_MODE
#include <amxmodx> // AMX Mod X 1.0 Base
#include <cstrike> // AMX Mod X 1.0 CS Module
#include <fun> // AMX Mod X 1.0 Fun Module
#else
#include <amxmod> // AMX Mod 0.9.9b Base
#include <fun> // AMX Mod 0.9.9b Fun Module
#endif
#include <amxmisc> // AMX/AMXX Misc
#include <colorchat>
#include "base_inc/const.inc" // Constants
#include "base_inc/global.inc" // Globals
#include "base_inc/stock.inc" // Stock Functions
#include "base_inc/actions.inc" // Punishment Actions
#include "base_inc/effects.inc" // Punishment Effects
#if defined USE_SQL_MODE
#if defined USE_AMXX_MODE
#include "base_inc/dbi.inc" // AMXX DBI Interface
#else
#include "base_inc/mysql.inc" // AMX MySQL Interface
#endif
#else
#include "base_inc/file.inc" // File Interface
#endif
#if defined USE_AMXX_MODE && defined USE_SQL_MODE
public plugin_modules()
{
require_module("DBI")
}
#endif
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
// Defaults:
register_cvar( "sv_swearfilter", "1" ) // 1 = On
register_cvar( "sv_filtersystem", "0" ) // 0 = Full Mode
register_cvar( "sv_punishsystem", "2" ) // 2 = Progressive
register_cvar( "sv_censorsystem", "1" ) // 2 = Random
register_cvar( "sv_renamesystem", "2" ) // 2 = Custom Name (Defined in CVAR)
register_cvar( "sv_whitelist", "1" ) // 1 = Whitelisted Words Enabled
register_cvar( "sv_checknames", "1" ) // 1 = Check Names for Swear Words
register_cvar( "sv_swearhelp", "1" ) // 1 = Client Help Enabled
register_cvar( "sv_bantype", "0" ) // 0 = Ban Steam ID
register_cvar( "sv_obeyimmunity", "1" ) // 1 = Obey Admin Immunity
register_cvar( "sv_menu_options", "abcdefg" ) // = All Punishments Enabled in Menu
register_cvar( "sv_punish_single", "ae" ) // = Gag & CashLoss in Single Mode
register_cvar( "sv_rename_custom", "PottyMouth" ) // = Custom Name for Renaming
register_cvar( "sv_censor_custom", "*" ) // = Custom Character for Overwriting Swear Words
register_cvar( "sv_cash_loss", "1000" ) // = Amount of Cash Lost as Punishment
register_cvar( "sv_gag_time", "120" ) // = Time in Seconds Gag Lasts
register_cvar( "sv_ban_time", "1440" ) // = Time in Minutes Ban Lasts
register_cvar( "sv_fire_time", "15" ) // = Time in Intervals Fire Lasts
register_cvar( "sv_fire_dmg", "5" ) // = Amount of HP Damage/Interval
register_cvar( "sv_slap_times", "15" ) // = Amount of Slaps for Punishment
register_cvar( "sv_slap_dmg", "5" ) // = Amount of HP Damage/Slap
register_menucmd( register_menuid("Swear Menu"), 1023, "SwearMenuCommand" )
register_clcmd( "amx_swearmode", "ToggleSwearFilter", REQD_LEVEL, "<on|off> -- Toggles Swear Mod On or Off" )
register_clcmd( "amx_swearmenu", "AttachMenuToAdmin", REQD_LEVEL, "Toggle Switch For Admins To See Menu" )
register_clcmd( "amx_namecheck", "RunNameCheck", REQD_LEVEL, "Runs A Name Check On All Clients" )
register_clcmd( "amx_sf_ungag", "UngagPlayer", REQD_LEVEL, "Ungags a Player Gagged by Swear Punishment" )
register_clcmd( "say", "CheckSay" )
register_clcmd( "say_team", "CheckSay" )
// Client Message Indexes
g_nMsgDamage = get_user_msgid( "Damage" )
}
public plugin_cfg()
{
if( !ConnectDB() )
{
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
if( !LoadBlackList() )
{
DisconnectDB()
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
g_bLoadErrWL = !LoadWhiteList()
g_bLoadErrPunish = !LoadPunishments()
DisconnectDB()
return PLUGIN_CONTINUE
}
public plugin_precache()
{
g_sprSmoke = precache_model( "sprites/steam1.spr" )
g_sprMFlash = precache_model( "sprites/muzzleflash.spr" )
g_sprLight = precache_model( "sprites/lgtning.spr" )
precache_sound( g_szSndScream )
precache_sound( g_szSndFlames )
precache_sound( g_szSndThunder )
return PLUGIN_CONTINUE
}
public client_authorized( id )
{
if( PluginEnabled( NULL ) )
{
AdminRanks( id )
CheckName( id )
}
return PLUGIN_CONTINUE
}
public client_putinserver( id )
{
if( PluginEnabled( NULL ) )
{
client_print_color( id, print_chat, "^4%s ^3%s ^4Plugin Enabled! ^#Do Not Swear!", PLUGIN_MOD, PLUGIN_NAME )
if( HelpEnabled( NULL ) )
client_print( id, print_chat, "%s To See the List of Swear Words, Say /swear", PLUGIN_MOD )
}
return PLUGIN_CONTINUE
}
public client_disconnect( id )
{
if( PluginEnabled( NULL ) )
{
ResetPlayer( id )
ResetAdmin( id )
}
return PLUGIN_CONTINUE
}
public client_infochanged( id )
{
if ( !PluginEnabled( NULL ) || !is_user_connected( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szNewName[MAX_NAME_LEN]
new szOldName[MAX_NAME_LEN]
get_user_info( id, "name", szNewName, MAX_NAME_LEN-1 )
get_user_name( id, szOldName, MAX_NAME_LEN-1 )
if( !equal( szNewName, szOldName ) )
return CheckName( id )
return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////
// Client Commands Section
////////////////////////////////////////////////////////////////////////////////////////////
public ToggleSwearFilter( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new i, szArg[32]
read_argv( 1, szArg, 31 )
new bool:nOnOff = InputSwitch( szArg )
PluginEnabled( (nOnOff)?ON:OFF )
console_print( id, "%s %s %s!", PLUGIN_MOD, PLUGIN_NAME, (nOnOff)?"Enabled":"Disabled" )
for( i = 1; i < MAX_PLAYERS+1; i++ )
{
ResetPlayer( i )
ResetAdmin( i )
}
if( nOnOff ) AdminRanks( id )
return PLUGIN_HANDLED
}
public AttachMenuToAdmin( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
if( g_nShowAdmin > OFF )
{
if( g_nShowAdmin != id )
{
new szAdminName[32]
get_user_name( g_nShowAdmin, szAdminName, 31 )
client_print_color( id, print_chat, "^4%s ^3ADMIN: ^4%s ^3Already has the Swear Menu attached!", PLUGIN_MOD, szAdminName )
}else
{
g_nShowAdmin = OFF
client_print_color( id, print_chat, "^4%s ^3You Have Unattached ^4The Swear Menu!", PLUGIN_MOD )
}
}else
{
g_nShowAdmin = id
client_print_color( id, print_chat, "^4%s ^3The Swear Menu is now attached to you!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
public RunNameCheck( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
for( new i = 1; i < MAX_PLAYERS+1; i++ )
CheckName( i )
return PLUGIN_HANDLED
}
public UngagPlayer( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new szTarget[STR_T]
read_args( szTarget, STR_T-1 )
new nUserID = cmd_target( id, szTarget, 2 )
if( nUserID > 0 && nUserID < 33 )
{
g_bUserGagged[nUserID-1] = false
remove_task( TASK_PLAYER_GAG + nUserID )
client_print_color( nUserID, print_chat, "^4%s ^3You have been ^4Ungagged ^3by an Admin! ^4Watch Your Language!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Swear Menu Section
////////////////////////////////////////////////////////////////////////////////////////////
public ShowMenuToAdmin( aID, vID )
{
new szUser[STR_T], szMenuBody[STR_X], szPunFlags[MAX_PUNISHMENTS+1]
new i, j = 0, nLen, nPunBits, nKeys = (1<<9)
// Get CVAR of Enabled Punishments
get_cvar_string( "sv_menu_options", szPunFlags, MAX_PUNISHMENTS )
nPunBits = ReadPunFlags( szPunFlags )
// Current Offender
g_nCurrClientID = vID
get_user_name( vID, szUser, STR_T-1 )
// Build Menu String
nLen = format( szMenuBody, (STR_X-1), "\rSwear Menu^n\w%s (%s)\w^n^n", szUser, g_szBadWord[vID-1] )
for( i = 0; i < MAX_PUNISHMENTS; i++ )
{
if( nPunBits & (1<<i) )
{
nLen += format( szMenuBody[nLen], (STR_X-1)-nLen, "\w%d. \y%s^n", (j+1), g_szPunTitle[i] )
nKeys |= (1<<j++)
}
}
format( szMenuBody[nLen], (STR_X-1)-nLen, "^n\w0. Take No Action" )
// Show Menu to Admin
show_menu( aID, nKeys, szMenuBody )
}
public SwearMenuCommand( id, key )
{
IssuePunishment( g_nCurrClientID, key )
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Name & Chat Text Filter Section
////////////////////////////////////////////////////////////////////////////////////////////
public CheckSay( id )
{
if ( !PluginEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
// Commented to test against self
//if( g_nShowAdmin == id ) return PLUGIN_CONTINUE
// Prevent Double-Checking
if( g_bUserSwore[id-1] )
{
g_bUserSwore[id-1] = false
return PLUGIN_CONTINUE
}
// Get User Chat Text/Command (say/say_team)
read_argv( 0, g_szUserCmd[id-1], 31 )
read_args( g_szUserSpeech[id-1], MAX_CHAT_LEN-1 )
remove_quotes( g_szUserSpeech[id-1] )
if( containi( g_szUserSpeech[id-1], "/swear" ) > NULL )
{
SwearWordsHelp( id )
return PLUGIN_HANDLED
}
if( g_bUserGagged[id-1] )
{
client_print_color( id, print_chat, "^4%s ^3You Have Been ^4Gagged for Swearing...^3You Must Wait!", PLUGIN_MOD )
if( HelpEnabled( NULL ) )
client_print_color( id, print_chat, "^4%s ^3Say ^4/swear ^3for a list of Offensive Words!", PLUGIN_MOD )
return PLUGIN_HANDLED
}
if( FilterText( id, g_szUserSpeech[id-1] ) > 0 )
{
g_bUserSwore[id-1] = true
new aID[2], Float:fDelay = get_cvar_float("amx_flood_time") + 0.05
aID[0] = id
set_task( fDelay, "RunSayFilter", (TASK_SAY_FILTER + id), aID, 1 )
PunishPlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public CheckName( id )
{
if ( !PluginEnabled( NULL ) || !NameFilterEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szUserName[MAX_NAME_LEN]
get_user_info( id, "name", szUserName, MAX_NAME_LEN-1 )
if( FilterText( id, szUserName ) > 0 )
{
PunishPlayer( id )
RenamePlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Name-Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public RunSayFilter( nArgs[] )
{
new nID = nArgs[0]
client_cmd( nID, "%s ^"%s^"", g_szUserCmd[nID-1], g_szUserSpeech[nID-1] )
if( task_exists( TASK_SAY_FILTER + nID ) )
remove_task( TASK_SAY_FILTER + nID )
return
}
e kto a munesh me bo me ngjyra ?
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 42
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: May 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
Code: /*******************************************************************************************
* rs_swearfilter.sma Version 2.0 Date: JAN/28/2005
*
* RS Advanced Swear Filter + Punishment (MySQL Support)
*
* By: Rob Secord
* Alias: xeroblood (aka; Achilles)
* Email: xeroblood@gmail.com
*
* Credits: _KaszpiR_, Util, Knocker, poosmith (See Credits Section Below For More Info)
*
* Tested / Developed On:
* CS 1.6 - AMX 0.9.9
* CS 1.6 - AMXX 1.0
* MySQL v4.0.16-nt (Driver: v03.51)
*
*******************************************************************************************
* Admin Commands:
* amx_swearmode <on|off> - In-game admin command to Turn swearMode
* on or off. (removes any current punishments)
* amx_swearmenu - Toggles Swear Menu To Be Attached to you In-Game
* If Swear Menu is attached to an Admin, only
* that admin will see the Swear Menu when a
* player swears too many times. If SwearMenu
* is not attached to an admin, then Gag mode
* is the default!
* amx_namecheck - Runs a Swear Filter On All Clients' Username
* Should be called if CVAR sv_checknames is
* changed to 1 In-Game.
*
* Server CVARS:
* sv_swearfilter <0|1> - Turns the Whole Plugin On/Off
* (0 = Off) (1 = On)
* sv_filtersystem <0|1|2> - Swear Filter System to use:
* (0 = Full Mode) (1 = Slim Mode) (2 = Simple Mode)
* sv_punishsystem <0|1|2> - Punishment System to use:
* (0 = None) (1 = Single) (2 = Progressive)
* sv_censorsystem <0|1|2> - Word Censoring System to use:
* (0 = None) (1 = Random (@$%#)) (2 = Custom)
* sv_renamesystem <0|1|2> - Renaming System to use:
* (0 = Old Name) (1 = Steam ID) (2 = Custom)
* sv_whitelist <0|1> - Whitelist System for GOOD words
* (0 = No Whitelist) (1 = Use Whitelist)
* sv_checknames <0|1> - Player Name Filter
* (0 = Ignore Names) (1 = Filter Names)
* sv_swearhelp <0|1> - Player Help System (say /swear)
* (0 = No Help) (1 = Help)
* sv_bantype <0|1> - Player Ban Type to use:
* (0 = Steam ID) (1 = IP Address)
* sv_obeyimmunity <0|1> - Obey AMX Admin Immunity Rules for Punishments
* (0 = Disobey) (1 = Obey)
*
* sv_menu_options "abc" - The Punishments Allowed in Swear Menu (Possible Flags: "abcdefg")
* sv_punish_single "abc" - The Default Punishment for Single Mode (Possible Flags: "abcdefg")
* sv_rename_custom "Noob" - The Custom Name used for Renaming System
* sv_censor_custom "*" - The Custom Character used for Censoring System
* sv_cash_loss ## - Amount of Cash player will Lose
* sv_gag_time ## - Number of Seconds player will be Gagged
* sv_ban_time ## - Number of Minutes player will be Banned
* sv_fire_time ## - Number of Seconds. player will be Set on Fire
* sv_fire_dmg ## - Amount of Damage/Second player will lose from Fire
* sv_slap_times ## - Number of Times player will be Slapped
* sv_slap_dmg ## - Amount of Damage of each Slap
*
*******************************************************************************************
*
* If longest swear word is > 24 characters, change MAX_WORD_LENGTH
* to reflect longest word.
* If you have more that 40 words, change BLACKLIST_WORDS to reflect
* the number of words in file!
*
* If you use SQL, run the file tables.sql included in ZIP!
*
*******************************************************************************************
* Credits:
* As Always, Much of the credit goes to The People and Tutorials at
* http://amxmod.net/forums" onclick="window.open(this.href);return false; & http://www.amxmodx.org/forums" onclick="window.open(this.href);return false; for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801" onclick="window.open(this.href);return false;
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621" onclick="window.open(this.href);return false;
*
* Bug Fixes/Updates
* _KaszpiR_
*
* Ideas/Suggestions:
* Util, Knocker (see Updates below)
*
* Noticed Bugs (Case-Sensitivity):
* poosmith
*
*******************************************************************************************
* Revision History:
*
* Updates To Version 2.0:
* - Added support for AMX 0.9.9b & AMXX 1.0
* - Added Punishment System: None, Single and Progressive Modes
* - Added Filter System: Simple, Slim and Full Modes
* - Changed Renaming System: Old Name, STEAM ID or Custom
* - Changed Word Censor System: None, Random or Custom
* - Added CVAR to turn Punishments ON/OFF in Swear Menu
* - Fixed Crash Bugs on Multiple Swear Words in one line
*
* Updates To Version 1.6:
* - Fixed support for non-MySql admins (requires recompile)
* (Removed CVAR sv_usemysql -- Defined USE_MYSQL instead)
* - Compiled on Linux SUSE 9.0 by Knocker!!
*
* Updates To Version 1.5:
* - Checks Names for Swear Words if CVAR sv_checknames is set to 1
* - Renames Offensive names to WONID, IP or "Potty-Mouth #". Change by
* setting CVAR sv_rename_mode to 1, 2 or 3 respectively.
*
* - Uses MySQL or FILE for Swear Word List. To Use MySQL, set CVAR
* sv_usemysql to 1, default is 0 (Read From File)
*
* - Added a Whitelist for Good Words (goodwords.ini, or MySQL Table)
*
* - Uses Word Filters (fu.ck) If CVAR sv_usefilters is set to 1
* - Added CVAR sv_swearexact to Test against whole words or substrings
* (This should help protect ppl who say FUN when FU is a Swear Word)
* (Idea: Knocker)
*
* - Added A New Menu Punishment! Remove Cash From Player, Amount of
* cash removed is in CVAR sv_cashloss
*
* - Added a CVAR for the Special Character used for Censoring Words!!
* (instead of ****, see whatever char you want!!)
* (Idea: Knocker)
*
* - Changed: if sv_sweartimes is set to 0, Punishment Is Turned OFF!
*
* - Added a Help MOTD for players who say /swearwords. Admins may
* disable this option with CVAR sv_swearhelp
*
* Updates To Version 1.4: (Credits: Util for the Ideas!)
* - Reads Swear Words From File (addons/amx/swearwords.ini)
* - Added Ban Option (Ban Perm / # Minutes)
* (# Minutes is a CVAR: amx_bantime #)
* (Ban By WONID or IP)
* - Added Swear Word To Menu
*
* Updates To Version 1.4: (Credits: Knocker for the Ideas!)
* - Added Notice to Users When They Swear
* - Added CVAR for displaying/censoring Swear Word
* - Added Word Filter to catch words like: fu.ck or f*u.C,k etc...
*
* Versions prior to 1.4 unreleased...
*
**************************************************************************/
#include "base_inc/config.cfg" // Pre-compilation Configurations
#if defined USE_AMXX_MODE
#include <amxmodx> // AMX Mod X 1.0 Base
#include <cstrike> // AMX Mod X 1.0 CS Module
#include <fun> // AMX Mod X 1.0 Fun Module
#else
#include <amxmod> // AMX Mod 0.9.9b Base
#include <fun> // AMX Mod 0.9.9b Fun Module
#endif
#include <amxmisc> // AMX/AMXX Misc
#include <colorchat>
#include "base_inc/const.inc" // Constants
#include "base_inc/global.inc" // Globals
#include "base_inc/stock.inc" // Stock Functions
#include "base_inc/actions.inc" // Punishment Actions
#include "base_inc/effects.inc" // Punishment Effects
#if defined USE_SQL_MODE
#if defined USE_AMXX_MODE
#include "base_inc/dbi.inc" // AMXX DBI Interface
#else
#include "base_inc/mysql.inc" // AMX MySQL Interface
#endif
#else
#include "base_inc/file.inc" // File Interface
#endif
#if defined USE_AMXX_MODE && defined USE_SQL_MODE
public plugin_modules()
{
require_module("DBI")
}
#endif
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
// Defaults:
register_cvar( "sv_swearfilter", "1" ) // 1 = On
register_cvar( "sv_filtersystem", "0" ) // 0 = Full Mode
register_cvar( "sv_punishsystem", "2" ) // 2 = Progressive
register_cvar( "sv_censorsystem", "1" ) // 2 = Random
register_cvar( "sv_renamesystem", "2" ) // 2 = Custom Name (Defined in CVAR)
register_cvar( "sv_whitelist", "1" ) // 1 = Whitelisted Words Enabled
register_cvar( "sv_checknames", "1" ) // 1 = Check Names for Swear Words
register_cvar( "sv_swearhelp", "1" ) // 1 = Client Help Enabled
register_cvar( "sv_bantype", "0" ) // 0 = Ban Steam ID
register_cvar( "sv_obeyimmunity", "1" ) // 1 = Obey Admin Immunity
register_cvar( "sv_menu_options", "abcdefg" ) // = All Punishments Enabled in Menu
register_cvar( "sv_punish_single", "ae" ) // = Gag & CashLoss in Single Mode
register_cvar( "sv_rename_custom", "PottyMouth" ) // = Custom Name for Renaming
register_cvar( "sv_censor_custom", "*" ) // = Custom Character for Overwriting Swear Words
register_cvar( "sv_cash_loss", "1000" ) // = Amount of Cash Lost as Punishment
register_cvar( "sv_gag_time", "120" ) // = Time in Seconds Gag Lasts
register_cvar( "sv_ban_time", "1440" ) // = Time in Minutes Ban Lasts
register_cvar( "sv_fire_time", "15" ) // = Time in Intervals Fire Lasts
register_cvar( "sv_fire_dmg", "5" ) // = Amount of HP Damage/Interval
register_cvar( "sv_slap_times", "15" ) // = Amount of Slaps for Punishment
register_cvar( "sv_slap_dmg", "5" ) // = Amount of HP Damage/Slap
register_menucmd( register_menuid("Swear Menu"), 1023, "SwearMenuCommand" )
register_clcmd( "amx_swearmode", "ToggleSwearFilter", REQD_LEVEL, "<on|off> -- Toggles Swear Mod On or Off" )
register_clcmd( "amx_swearmenu", "AttachMenuToAdmin", REQD_LEVEL, "Toggle Switch For Admins To See Menu" )
register_clcmd( "amx_namecheck", "RunNameCheck", REQD_LEVEL, "Runs A Name Check On All Clients" )
register_clcmd( "amx_sf_ungag", "UngagPlayer", REQD_LEVEL, "Ungags a Player Gagged by Swear Punishment" )
register_clcmd( "say", "CheckSay" )
register_clcmd( "say_team", "CheckSay" )
// Client Message Indexes
g_nMsgDamage = get_user_msgid( "Damage" )
}
public plugin_cfg()
{
if( !ConnectDB() )
{
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
if( !LoadBlackList() )
{
DisconnectDB()
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
g_bLoadErrWL = !LoadWhiteList()
g_bLoadErrPunish = !LoadPunishments()
DisconnectDB()
return PLUGIN_CONTINUE
}
public plugin_precache()
{
g_sprSmoke = precache_model( "sprites/steam1.spr" )
g_sprMFlash = precache_model( "sprites/muzzleflash.spr" )
g_sprLight = precache_model( "sprites/lgtning.spr" )
precache_sound( g_szSndScream )
precache_sound( g_szSndFlames )
precache_sound( g_szSndThunder )
return PLUGIN_CONTINUE
}
public client_authorized( id )
{
if( PluginEnabled( NULL ) )
{
AdminRanks( id )
CheckName( id )
}
return PLUGIN_CONTINUE
}
public client_putinserver( id )
{
if( PluginEnabled( NULL ) )
{
client_print_color( id, print_chat, "^4%s ^3%s ^4Plugin Enabled! ^#Do Not Swear!", PLUGIN_MOD, PLUGIN_NAME )
if( HelpEnabled( NULL ) )
client_print( id, print_chat, "%s To See the List of Swear Words, Say /swear", PLUGIN_MOD )
}
return PLUGIN_CONTINUE
}
public client_disconnect( id )
{
if( PluginEnabled( NULL ) )
{
ResetPlayer( id )
ResetAdmin( id )
}
return PLUGIN_CONTINUE
}
public client_infochanged( id )
{
if ( !PluginEnabled( NULL ) || !is_user_connected( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szNewName[MAX_NAME_LEN]
new szOldName[MAX_NAME_LEN]
get_user_info( id, "name", szNewName, MAX_NAME_LEN-1 )
get_user_name( id, szOldName, MAX_NAME_LEN-1 )
if( !equal( szNewName, szOldName ) )
return CheckName( id )
return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////
// Client Commands Section
////////////////////////////////////////////////////////////////////////////////////////////
public ToggleSwearFilter( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new i, szArg[32]
read_argv( 1, szArg, 31 )
new bool:nOnOff = InputSwitch( szArg )
PluginEnabled( (nOnOff)?ON:OFF )
console_print( id, "%s %s %s!", PLUGIN_MOD, PLUGIN_NAME, (nOnOff)?"Enabled":"Disabled" )
for( i = 1; i < MAX_PLAYERS+1; i++ )
{
ResetPlayer( i )
ResetAdmin( i )
}
if( nOnOff ) AdminRanks( id )
return PLUGIN_HANDLED
}
public AttachMenuToAdmin( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
if( g_nShowAdmin > OFF )
{
if( g_nShowAdmin != id )
{
new szAdminName[32]
get_user_name( g_nShowAdmin, szAdminName, 31 )
client_print_color( id, print_chat, "^4%s ^3ADMIN: ^4%s ^3Already has the Swear Menu attached!", PLUGIN_MOD, szAdminName )
}else
{
g_nShowAdmin = OFF
client_print_color( id, print_chat, "^4%s ^3You Have Unattached ^4The Swear Menu!", PLUGIN_MOD )
}
}else
{
g_nShowAdmin = id
client_print_color( id, print_chat, "^4%s ^3The Swear Menu is now attached to you!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
public RunNameCheck( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
for( new i = 1; i < MAX_PLAYERS+1; i++ )
CheckName( i )
return PLUGIN_HANDLED
}
public UngagPlayer( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new szTarget[STR_T]
read_args( szTarget, STR_T-1 )
new nUserID = cmd_target( id, szTarget, 2 )
if( nUserID > 0 && nUserID < 33 )
{
g_bUserGagged[nUserID-1] = false
remove_task( TASK_PLAYER_GAG + nUserID )
client_print_color( nUserID, print_chat, "^4%s ^3You have been ^4Ungagged ^3by an Admin! ^4Watch Your Language!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Swear Menu Section
////////////////////////////////////////////////////////////////////////////////////////////
public ShowMenuToAdmin( aID, vID )
{
new szUser[STR_T], szMenuBody[STR_X], szPunFlags[MAX_PUNISHMENTS+1]
new i, j = 0, nLen, nPunBits, nKeys = (1<<9)
// Get CVAR of Enabled Punishments
get_cvar_string( "sv_menu_options", szPunFlags, MAX_PUNISHMENTS )
nPunBits = ReadPunFlags( szPunFlags )
// Current Offender
g_nCurrClientID = vID
get_user_name( vID, szUser, STR_T-1 )
// Build Menu String
nLen = format( szMenuBody, (STR_X-1), "\rSwear Menu^n\w%s (%s)\w^n^n", szUser, g_szBadWord[vID-1] )
for( i = 0; i < MAX_PUNISHMENTS; i++ )
{
if( nPunBits & (1<<i) )
{
nLen += format( szMenuBody[nLen], (STR_X-1)-nLen, "\w%d. \y%s^n", (j+1), g_szPunTitle[i] )
nKeys |= (1<<j++)
}
}
format( szMenuBody[nLen], (STR_X-1)-nLen, "^n\w0. Take No Action" )
// Show Menu to Admin
show_menu( aID, nKeys, szMenuBody )
}
public SwearMenuCommand( id, key )
{
IssuePunishment( g_nCurrClientID, key )
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Name & Chat Text Filter Section
////////////////////////////////////////////////////////////////////////////////////////////
public CheckSay( id )
{
if ( !PluginEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
// Commented to test against self
//if( g_nShowAdmin == id ) return PLUGIN_CONTINUE
// Prevent Double-Checking
if( g_bUserSwore[id-1] )
{
g_bUserSwore[id-1] = false
return PLUGIN_CONTINUE
}
// Get User Chat Text/Command (say/say_team)
read_argv( 0, g_szUserCmd[id-1], 31 )
read_args( g_szUserSpeech[id-1], MAX_CHAT_LEN-1 )
remove_quotes( g_szUserSpeech[id-1] )
if( containi( g_szUserSpeech[id-1], "/swear" ) > NULL )
{
SwearWordsHelp( id )
return PLUGIN_HANDLED
}
if( g_bUserGagged[id-1] )
{
client_print_color( id, print_chat, "^4%s ^3You Have Been ^4Gagged for Swearing...^3You Must Wait!", PLUGIN_MOD )
if( HelpEnabled( NULL ) )
client_print_color( id, print_chat, "^4%s ^3Say ^4/swear ^3for a list of Offensive Words!", PLUGIN_MOD )
return PLUGIN_HANDLED
}
if( FilterText( id, g_szUserSpeech[id-1] ) > 0 )
{
g_bUserSwore[id-1] = true
new aID[2], Float:fDelay = get_cvar_float("amx_flood_time") + 0.05
aID[0] = id
set_task( fDelay, "RunSayFilter", (TASK_SAY_FILTER + id), aID, 1 )
PunishPlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public CheckName( id )
{
if ( !PluginEnabled( NULL ) || !NameFilterEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szUserName[MAX_NAME_LEN]
get_user_info( id, "name", szUserName, MAX_NAME_LEN-1 )
if( FilterText( id, szUserName ) > 0 )
{
PunishPlayer( id )
RenamePlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Name-Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public RunSayFilter( nArgs[] )
{
new nID = nArgs[0]
client_cmd( nID, "%s ^"%s^"", g_szUserCmd[nID-1], g_szUserSpeech[nID-1] )
if( task_exists( TASK_SAY_FILTER + nID ) )
remove_task( TASK_SAY_FILTER + nID )
return
}
e kto a munesh me bo me ngjyra ?
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 326
Threads: 52
%%TYL_NUMTHANKEDLIKED%%
Joined: Feb 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
veron Wrote:Code: /*******************************************************************************************
* rs_swearfilter.sma Version 2.0 Date: JAN/28/2005
*
* RS Advanced Swear Filter + Punishment (MySQL Support)
*
* By: Rob Secord
* Alias: xeroblood (aka; Achilles)
* Email: xeroblood@gmail.com
*
* Credits: _KaszpiR_, Util, Knocker, poosmith (See Credits Section Below For More Info)
*
* Tested / Developed On:
* CS 1.6 - AMX 0.9.9
* CS 1.6 - AMXX 1.0
* MySQL v4.0.16-nt (Driver: v03.51)
*
*******************************************************************************************
* Admin Commands:
* amx_swearmode <on|off> - In-game admin command to Turn swearMode
* on or off. (removes any current punishments)
* amx_swearmenu - Toggles Swear Menu To Be Attached to you In-Game
* If Swear Menu is attached to an Admin, only
* that admin will see the Swear Menu when a
* player swears too many times. If SwearMenu
* is not attached to an admin, then Gag mode
* is the default!
* amx_namecheck - Runs a Swear Filter On All Clients' Username
* Should be called if CVAR sv_checknames is
* changed to 1 In-Game.
*
* Server CVARS:
* sv_swearfilter <0|1> - Turns the Whole Plugin On/Off
* (0 = Off) (1 = On)
* sv_filtersystem <0|1|2> - Swear Filter System to use:
* (0 = Full Mode) (1 = Slim Mode) (2 = Simple Mode)
* sv_punishsystem <0|1|2> - Punishment System to use:
* (0 = None) (1 = Single) (2 = Progressive)
* sv_censorsystem <0|1|2> - Word Censoring System to use:
* (0 = None) (1 = Random (@$%#)) (2 = Custom)
* sv_renamesystem <0|1|2> - Renaming System to use:
* (0 = Old Name) (1 = Steam ID) (2 = Custom)
* sv_whitelist <0|1> - Whitelist System for GOOD words
* (0 = No Whitelist) (1 = Use Whitelist)
* sv_checknames <0|1> - Player Name Filter
* (0 = Ignore Names) (1 = Filter Names)
* sv_swearhelp <0|1> - Player Help System (say /swear)
* (0 = No Help) (1 = Help)
* sv_bantype <0|1> - Player Ban Type to use:
* (0 = Steam ID) (1 = IP Address)
* sv_obeyimmunity <0|1> - Obey AMX Admin Immunity Rules for Punishments
* (0 = Disobey) (1 = Obey)
*
* sv_menu_options "abc" - The Punishments Allowed in Swear Menu (Possible Flags: "abcdefg")
* sv_punish_single "abc" - The Default Punishment for Single Mode (Possible Flags: "abcdefg")
* sv_rename_custom "Noob" - The Custom Name used for Renaming System
* sv_censor_custom "*" - The Custom Character used for Censoring System
* sv_cash_loss ## - Amount of Cash player will Lose
* sv_gag_time ## - Number of Seconds player will be Gagged
* sv_ban_time ## - Number of Minutes player will be Banned
* sv_fire_time ## - Number of Seconds. player will be Set on Fire
* sv_fire_dmg ## - Amount of Damage/Second player will lose from Fire
* sv_slap_times ## - Number of Times player will be Slapped
* sv_slap_dmg ## - Amount of Damage of each Slap
*
*******************************************************************************************
*
* If longest swear word is > 24 characters, change MAX_WORD_LENGTH
* to reflect longest word.
* If you have more that 40 words, change BLACKLIST_WORDS to reflect
* the number of words in file!
*
* If you use SQL, run the file tables.sql included in ZIP!
*
*******************************************************************************************
* Credits:
* As Always, Much of the credit goes to The People and Tutorials at
* http://amxmod.net/forums" onclick="window.open(this.href);return false; & http://www.amxmodx.org/forums" onclick="window.open(this.href);return false; for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801" onclick="window.open(this.href);return false;
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621" onclick="window.open(this.href);return false;
*
* Bug Fixes/Updates
* _KaszpiR_
*
* Ideas/Suggestions:
* Util, Knocker (see Updates below)
*
* Noticed Bugs (Case-Sensitivity):
* poosmith
*
*******************************************************************************************
* Revision History:
*
* Updates To Version 2.0:
* - Added support for AMX 0.9.9b & AMXX 1.0
* - Added Punishment System: None, Single and Progressive Modes
* - Added Filter System: Simple, Slim and Full Modes
* - Changed Renaming System: Old Name, STEAM ID or Custom
* - Changed Word Censor System: None, Random or Custom
* - Added CVAR to turn Punishments ON/OFF in Swear Menu
* - Fixed Crash Bugs on Multiple Swear Words in one line
*
* Updates To Version 1.6:
* - Fixed support for non-MySql admins (requires recompile)
* (Removed CVAR sv_usemysql -- Defined USE_MYSQL instead)
* - Compiled on Linux SUSE 9.0 by Knocker!!
*
* Updates To Version 1.5:
* - Checks Names for Swear Words if CVAR sv_checknames is set to 1
* - Renames Offensive names to WONID, IP or "Potty-Mouth #". Change by
* setting CVAR sv_rename_mode to 1, 2 or 3 respectively.
*
* - Uses MySQL or FILE for Swear Word List. To Use MySQL, set CVAR
* sv_usemysql to 1, default is 0 (Read From File)
*
* - Added a Whitelist for Good Words (goodwords.ini, or MySQL Table)
*
* - Uses Word Filters (fu.ck) If CVAR sv_usefilters is set to 1
* - Added CVAR sv_swearexact to Test against whole words or substrings
* (This should help protect ppl who say FUN when FU is a Swear Word)
* (Idea: Knocker)
*
* - Added A New Menu Punishment! Remove Cash From Player, Amount of
* cash removed is in CVAR sv_cashloss
*
* - Added a CVAR for the Special Character used for Censoring Words!!
* (instead of ****, see whatever char you want!!)
* (Idea: Knocker)
*
* - Changed: if sv_sweartimes is set to 0, Punishment Is Turned OFF!
*
* - Added a Help MOTD for players who say /swearwords. Admins may
* disable this option with CVAR sv_swearhelp
*
* Updates To Version 1.4: (Credits: Util for the Ideas!)
* - Reads Swear Words From File (addons/amx/swearwords.ini)
* - Added Ban Option (Ban Perm / # Minutes)
* (# Minutes is a CVAR: amx_bantime #)
* (Ban By WONID or IP)
* - Added Swear Word To Menu
*
* Updates To Version 1.4: (Credits: Knocker for the Ideas!)
* - Added Notice to Users When They Swear
* - Added CVAR for displaying/censoring Swear Word
* - Added Word Filter to catch words like: fu.ck or f*u.C,k etc...
*
* Versions prior to 1.4 unreleased...
*
**************************************************************************/
#include "base_inc/config.cfg" // Pre-compilation Configurations
#if defined USE_AMXX_MODE
#include <amxmodx> // AMX Mod X 1.0 Base
#include <cstrike> // AMX Mod X 1.0 CS Module
#include <fun> // AMX Mod X 1.0 Fun Module
#else
#include <amxmod> // AMX Mod 0.9.9b Base
#include <fun> // AMX Mod 0.9.9b Fun Module
#endif
#include <amxmisc> // AMX/AMXX Misc
#include <colorchat>
#include "base_inc/const.inc" // Constants
#include "base_inc/global.inc" // Globals
#include "base_inc/stock.inc" // Stock Functions
#include "base_inc/actions.inc" // Punishment Actions
#include "base_inc/effects.inc" // Punishment Effects
#if defined USE_SQL_MODE
#if defined USE_AMXX_MODE
#include "base_inc/dbi.inc" // AMXX DBI Interface
#else
#include "base_inc/mysql.inc" // AMX MySQL Interface
#endif
#else
#include "base_inc/file.inc" // File Interface
#endif
#if defined USE_AMXX_MODE && defined USE_SQL_MODE
public plugin_modules()
{
require_module("DBI")
}
#endif
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
// Defaults:
register_cvar( "sv_swearfilter", "1" ) // 1 = On
register_cvar( "sv_filtersystem", "0" ) // 0 = Full Mode
register_cvar( "sv_punishsystem", "2" ) // 2 = Progressive
register_cvar( "sv_censorsystem", "1" ) // 2 = Random
register_cvar( "sv_renamesystem", "2" ) // 2 = Custom Name (Defined in CVAR)
register_cvar( "sv_whitelist", "1" ) // 1 = Whitelisted Words Enabled
register_cvar( "sv_checknames", "1" ) // 1 = Check Names for Swear Words
register_cvar( "sv_swearhelp", "1" ) // 1 = Client Help Enabled
register_cvar( "sv_bantype", "0" ) // 0 = Ban Steam ID
register_cvar( "sv_obeyimmunity", "1" ) // 1 = Obey Admin Immunity
register_cvar( "sv_menu_options", "abcdefg" ) // = All Punishments Enabled in Menu
register_cvar( "sv_punish_single", "ae" ) // = Gag & CashLoss in Single Mode
register_cvar( "sv_rename_custom", "PottyMouth" ) // = Custom Name for Renaming
register_cvar( "sv_censor_custom", "*" ) // = Custom Character for Overwriting Swear Words
register_cvar( "sv_cash_loss", "1000" ) // = Amount of Cash Lost as Punishment
register_cvar( "sv_gag_time", "120" ) // = Time in Seconds Gag Lasts
register_cvar( "sv_ban_time", "1440" ) // = Time in Minutes Ban Lasts
register_cvar( "sv_fire_time", "15" ) // = Time in Intervals Fire Lasts
register_cvar( "sv_fire_dmg", "5" ) // = Amount of HP Damage/Interval
register_cvar( "sv_slap_times", "15" ) // = Amount of Slaps for Punishment
register_cvar( "sv_slap_dmg", "5" ) // = Amount of HP Damage/Slap
register_menucmd( register_menuid("Swear Menu"), 1023, "SwearMenuCommand" )
register_clcmd( "amx_swearmode", "ToggleSwearFilter", REQD_LEVEL, "<on|off> -- Toggles Swear Mod On or Off" )
register_clcmd( "amx_swearmenu", "AttachMenuToAdmin", REQD_LEVEL, "Toggle Switch For Admins To See Menu" )
register_clcmd( "amx_namecheck", "RunNameCheck", REQD_LEVEL, "Runs A Name Check On All Clients" )
register_clcmd( "amx_sf_ungag", "UngagPlayer", REQD_LEVEL, "Ungags a Player Gagged by Swear Punishment" )
register_clcmd( "say", "CheckSay" )
register_clcmd( "say_team", "CheckSay" )
// Client Message Indexes
g_nMsgDamage = get_user_msgid( "Damage" )
}
public plugin_cfg()
{
if( !ConnectDB() )
{
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
if( !LoadBlackList() )
{
DisconnectDB()
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
g_bLoadErrWL = !LoadWhiteList()
g_bLoadErrPunish = !LoadPunishments()
DisconnectDB()
return PLUGIN_CONTINUE
}
public plugin_precache()
{
g_sprSmoke = precache_model( "sprites/steam1.spr" )
g_sprMFlash = precache_model( "sprites/muzzleflash.spr" )
g_sprLight = precache_model( "sprites/lgtning.spr" )
precache_sound( g_szSndScream )
precache_sound( g_szSndFlames )
precache_sound( g_szSndThunder )
return PLUGIN_CONTINUE
}
public client_authorized( id )
{
if( PluginEnabled( NULL ) )
{
AdminRanks( id )
CheckName( id )
}
return PLUGIN_CONTINUE
}
public client_putinserver( id )
{
if( PluginEnabled( NULL ) )
{
client_print_color( id, print_chat, "^4%s ^3%s ^4Plugin Enabled! ^#Do Not Swear!", PLUGIN_MOD, PLUGIN_NAME )
if( HelpEnabled( NULL ) )
client_print( id, print_chat, "%s To See the List of Swear Words, Say /swear", PLUGIN_MOD )
}
return PLUGIN_CONTINUE
}
public client_disconnect( id )
{
if( PluginEnabled( NULL ) )
{
ResetPlayer( id )
ResetAdmin( id )
}
return PLUGIN_CONTINUE
}
public client_infochanged( id )
{
if ( !PluginEnabled( NULL ) || !is_user_connected( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szNewName[MAX_NAME_LEN]
new szOldName[MAX_NAME_LEN]
get_user_info( id, "name", szNewName, MAX_NAME_LEN-1 )
get_user_name( id, szOldName, MAX_NAME_LEN-1 )
if( !equal( szNewName, szOldName ) )
return CheckName( id )
return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////
// Client Commands Section
////////////////////////////////////////////////////////////////////////////////////////////
public ToggleSwearFilter( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new i, szArg[32]
read_argv( 1, szArg, 31 )
new bool:nOnOff = InputSwitch( szArg )
PluginEnabled( (nOnOff)?ON:OFF )
console_print( id, "%s %s %s!", PLUGIN_MOD, PLUGIN_NAME, (nOnOff)?"Enabled":"Disabled" )
for( i = 1; i < MAX_PLAYERS+1; i++ )
{
ResetPlayer( i )
ResetAdmin( i )
}
if( nOnOff ) AdminRanks( id )
return PLUGIN_HANDLED
}
public AttachMenuToAdmin( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
if( g_nShowAdmin > OFF )
{
if( g_nShowAdmin != id )
{
new szAdminName[32]
get_user_name( g_nShowAdmin, szAdminName, 31 )
client_print_color( id, print_chat, "^4%s ^3ADMIN: ^4%s ^3Already has the Swear Menu attached!", PLUGIN_MOD, szAdminName )
}else
{
g_nShowAdmin = OFF
client_print_color( id, print_chat, "^4%s ^3You Have Unattached ^4The Swear Menu!", PLUGIN_MOD )
}
}else
{
g_nShowAdmin = id
client_print_color( id, print_chat, "^4%s ^3The Swear Menu is now attached to you!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
public RunNameCheck( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
for( new i = 1; i < MAX_PLAYERS+1; i++ )
CheckName( i )
return PLUGIN_HANDLED
}
public UngagPlayer( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new szTarget[STR_T]
read_args( szTarget, STR_T-1 )
new nUserID = cmd_target( id, szTarget, 2 )
if( nUserID > 0 && nUserID < 33 )
{
g_bUserGagged[nUserID-1] = false
remove_task( TASK_PLAYER_GAG + nUserID )
client_print_color( nUserID, print_chat, "^4%s ^3You have been ^4Ungagged ^3by an Admin! ^4Watch Your Language!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Swear Menu Section
////////////////////////////////////////////////////////////////////////////////////////////
public ShowMenuToAdmin( aID, vID )
{
new szUser[STR_T], szMenuBody[STR_X], szPunFlags[MAX_PUNISHMENTS+1]
new i, j = 0, nLen, nPunBits, nKeys = (1<<9)
// Get CVAR of Enabled Punishments
get_cvar_string( "sv_menu_options", szPunFlags, MAX_PUNISHMENTS )
nPunBits = ReadPunFlags( szPunFlags )
// Current Offender
g_nCurrClientID = vID
get_user_name( vID, szUser, STR_T-1 )
// Build Menu String
nLen = format( szMenuBody, (STR_X-1), "\rSwear Menu^n\w%s (%s)\w^n^n", szUser, g_szBadWord[vID-1] )
for( i = 0; i < MAX_PUNISHMENTS; i++ )
{
if( nPunBits & (1<<i) )
{
nLen += format( szMenuBody[nLen], (STR_X-1)-nLen, "\w%d. \y%s^n", (j+1), g_szPunTitle[i] )
nKeys |= (1<<j++)
}
}
format( szMenuBody[nLen], (STR_X-1)-nLen, "^n\w0. Take No Action" )
// Show Menu to Admin
show_menu( aID, nKeys, szMenuBody )
}
public SwearMenuCommand( id, key )
{
IssuePunishment( g_nCurrClientID, key )
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Name & Chat Text Filter Section
////////////////////////////////////////////////////////////////////////////////////////////
public CheckSay( id )
{
if ( !PluginEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
// Commented to test against self
//if( g_nShowAdmin == id ) return PLUGIN_CONTINUE
// Prevent Double-Checking
if( g_bUserSwore[id-1] )
{
g_bUserSwore[id-1] = false
return PLUGIN_CONTINUE
}
// Get User Chat Text/Command (say/say_team)
read_argv( 0, g_szUserCmd[id-1], 31 )
read_args( g_szUserSpeech[id-1], MAX_CHAT_LEN-1 )
remove_quotes( g_szUserSpeech[id-1] )
if( containi( g_szUserSpeech[id-1], "/swear" ) > NULL )
{
SwearWordsHelp( id )
return PLUGIN_HANDLED
}
if( g_bUserGagged[id-1] )
{
client_print_color( id, print_chat, "^4%s ^3You Have Been ^4Gagged for Swearing...^3You Must Wait!", PLUGIN_MOD )
if( HelpEnabled( NULL ) )
client_print_color( id, print_chat, "^4%s ^3Say ^4/swear ^3for a list of Offensive Words!", PLUGIN_MOD )
return PLUGIN_HANDLED
}
if( FilterText( id, g_szUserSpeech[id-1] ) > 0 )
{
g_bUserSwore[id-1] = true
new aID[2], Float:fDelay = get_cvar_float("amx_flood_time") + 0.05
aID[0] = id
set_task( fDelay, "RunSayFilter", (TASK_SAY_FILTER + id), aID, 1 )
PunishPlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public CheckName( id )
{
if ( !PluginEnabled( NULL ) || !NameFilterEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szUserName[MAX_NAME_LEN]
get_user_info( id, "name", szUserName, MAX_NAME_LEN-1 )
if( FilterText( id, szUserName ) > 0 )
{
PunishPlayer( id )
RenamePlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Name-Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public RunSayFilter( nArgs[] )
{
new nID = nArgs[0]
client_cmd( nID, "%s ^"%s^"", g_szUserCmd[nID-1], g_szUserSpeech[nID-1] )
if( task_exists( TASK_SAY_FILTER + nID ) )
remove_task( TASK_SAY_FILTER + nID )
return
}
e kto a munesh me bo me ngjyra ?
[info] Ke prek diqka spom bon me bo spe di ku o problemi se sdi qa ke prek kur e ke marr ti scripting je munu me bo ngjyra po nese don ni asi swear tmir ta gjej.[/info]
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 326
Threads: 52
%%TYL_NUMTHANKEDLIKED%%
Joined: Feb 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
veron Wrote:Code: /*******************************************************************************************
* rs_swearfilter.sma Version 2.0 Date: JAN/28/2005
*
* RS Advanced Swear Filter + Punishment (MySQL Support)
*
* By: Rob Secord
* Alias: xeroblood (aka; Achilles)
* Email: xeroblood@gmail.com
*
* Credits: _KaszpiR_, Util, Knocker, poosmith (See Credits Section Below For More Info)
*
* Tested / Developed On:
* CS 1.6 - AMX 0.9.9
* CS 1.6 - AMXX 1.0
* MySQL v4.0.16-nt (Driver: v03.51)
*
*******************************************************************************************
* Admin Commands:
* amx_swearmode <on|off> - In-game admin command to Turn swearMode
* on or off. (removes any current punishments)
* amx_swearmenu - Toggles Swear Menu To Be Attached to you In-Game
* If Swear Menu is attached to an Admin, only
* that admin will see the Swear Menu when a
* player swears too many times. If SwearMenu
* is not attached to an admin, then Gag mode
* is the default!
* amx_namecheck - Runs a Swear Filter On All Clients' Username
* Should be called if CVAR sv_checknames is
* changed to 1 In-Game.
*
* Server CVARS:
* sv_swearfilter <0|1> - Turns the Whole Plugin On/Off
* (0 = Off) (1 = On)
* sv_filtersystem <0|1|2> - Swear Filter System to use:
* (0 = Full Mode) (1 = Slim Mode) (2 = Simple Mode)
* sv_punishsystem <0|1|2> - Punishment System to use:
* (0 = None) (1 = Single) (2 = Progressive)
* sv_censorsystem <0|1|2> - Word Censoring System to use:
* (0 = None) (1 = Random (@$%#)) (2 = Custom)
* sv_renamesystem <0|1|2> - Renaming System to use:
* (0 = Old Name) (1 = Steam ID) (2 = Custom)
* sv_whitelist <0|1> - Whitelist System for GOOD words
* (0 = No Whitelist) (1 = Use Whitelist)
* sv_checknames <0|1> - Player Name Filter
* (0 = Ignore Names) (1 = Filter Names)
* sv_swearhelp <0|1> - Player Help System (say /swear)
* (0 = No Help) (1 = Help)
* sv_bantype <0|1> - Player Ban Type to use:
* (0 = Steam ID) (1 = IP Address)
* sv_obeyimmunity <0|1> - Obey AMX Admin Immunity Rules for Punishments
* (0 = Disobey) (1 = Obey)
*
* sv_menu_options "abc" - The Punishments Allowed in Swear Menu (Possible Flags: "abcdefg")
* sv_punish_single "abc" - The Default Punishment for Single Mode (Possible Flags: "abcdefg")
* sv_rename_custom "Noob" - The Custom Name used for Renaming System
* sv_censor_custom "*" - The Custom Character used for Censoring System
* sv_cash_loss ## - Amount of Cash player will Lose
* sv_gag_time ## - Number of Seconds player will be Gagged
* sv_ban_time ## - Number of Minutes player will be Banned
* sv_fire_time ## - Number of Seconds. player will be Set on Fire
* sv_fire_dmg ## - Amount of Damage/Second player will lose from Fire
* sv_slap_times ## - Number of Times player will be Slapped
* sv_slap_dmg ## - Amount of Damage of each Slap
*
*******************************************************************************************
*
* If longest swear word is > 24 characters, change MAX_WORD_LENGTH
* to reflect longest word.
* If you have more that 40 words, change BLACKLIST_WORDS to reflect
* the number of words in file!
*
* If you use SQL, run the file tables.sql included in ZIP!
*
*******************************************************************************************
* Credits:
* As Always, Much of the credit goes to The People and Tutorials at
* http://amxmod.net/forums" onclick="window.open(this.href);return false; & http://www.amxmodx.org/forums" onclick="window.open(this.href);return false; for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801" onclick="window.open(this.href);return false;
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621" onclick="window.open(this.href);return false;
*
* Bug Fixes/Updates
* _KaszpiR_
*
* Ideas/Suggestions:
* Util, Knocker (see Updates below)
*
* Noticed Bugs (Case-Sensitivity):
* poosmith
*
*******************************************************************************************
* Revision History:
*
* Updates To Version 2.0:
* - Added support for AMX 0.9.9b & AMXX 1.0
* - Added Punishment System: None, Single and Progressive Modes
* - Added Filter System: Simple, Slim and Full Modes
* - Changed Renaming System: Old Name, STEAM ID or Custom
* - Changed Word Censor System: None, Random or Custom
* - Added CVAR to turn Punishments ON/OFF in Swear Menu
* - Fixed Crash Bugs on Multiple Swear Words in one line
*
* Updates To Version 1.6:
* - Fixed support for non-MySql admins (requires recompile)
* (Removed CVAR sv_usemysql -- Defined USE_MYSQL instead)
* - Compiled on Linux SUSE 9.0 by Knocker!!
*
* Updates To Version 1.5:
* - Checks Names for Swear Words if CVAR sv_checknames is set to 1
* - Renames Offensive names to WONID, IP or "Potty-Mouth #". Change by
* setting CVAR sv_rename_mode to 1, 2 or 3 respectively.
*
* - Uses MySQL or FILE for Swear Word List. To Use MySQL, set CVAR
* sv_usemysql to 1, default is 0 (Read From File)
*
* - Added a Whitelist for Good Words (goodwords.ini, or MySQL Table)
*
* - Uses Word Filters (fu.ck) If CVAR sv_usefilters is set to 1
* - Added CVAR sv_swearexact to Test against whole words or substrings
* (This should help protect ppl who say FUN when FU is a Swear Word)
* (Idea: Knocker)
*
* - Added A New Menu Punishment! Remove Cash From Player, Amount of
* cash removed is in CVAR sv_cashloss
*
* - Added a CVAR for the Special Character used for Censoring Words!!
* (instead of ****, see whatever char you want!!)
* (Idea: Knocker)
*
* - Changed: if sv_sweartimes is set to 0, Punishment Is Turned OFF!
*
* - Added a Help MOTD for players who say /swearwords. Admins may
* disable this option with CVAR sv_swearhelp
*
* Updates To Version 1.4: (Credits: Util for the Ideas!)
* - Reads Swear Words From File (addons/amx/swearwords.ini)
* - Added Ban Option (Ban Perm / # Minutes)
* (# Minutes is a CVAR: amx_bantime #)
* (Ban By WONID or IP)
* - Added Swear Word To Menu
*
* Updates To Version 1.4: (Credits: Knocker for the Ideas!)
* - Added Notice to Users When They Swear
* - Added CVAR for displaying/censoring Swear Word
* - Added Word Filter to catch words like: fu.ck or f*u.C,k etc...
*
* Versions prior to 1.4 unreleased...
*
**************************************************************************/
#include "base_inc/config.cfg" // Pre-compilation Configurations
#if defined USE_AMXX_MODE
#include <amxmodx> // AMX Mod X 1.0 Base
#include <cstrike> // AMX Mod X 1.0 CS Module
#include <fun> // AMX Mod X 1.0 Fun Module
#else
#include <amxmod> // AMX Mod 0.9.9b Base
#include <fun> // AMX Mod 0.9.9b Fun Module
#endif
#include <amxmisc> // AMX/AMXX Misc
#include <colorchat>
#include "base_inc/const.inc" // Constants
#include "base_inc/global.inc" // Globals
#include "base_inc/stock.inc" // Stock Functions
#include "base_inc/actions.inc" // Punishment Actions
#include "base_inc/effects.inc" // Punishment Effects
#if defined USE_SQL_MODE
#if defined USE_AMXX_MODE
#include "base_inc/dbi.inc" // AMXX DBI Interface
#else
#include "base_inc/mysql.inc" // AMX MySQL Interface
#endif
#else
#include "base_inc/file.inc" // File Interface
#endif
#if defined USE_AMXX_MODE && defined USE_SQL_MODE
public plugin_modules()
{
require_module("DBI")
}
#endif
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
// Defaults:
register_cvar( "sv_swearfilter", "1" ) // 1 = On
register_cvar( "sv_filtersystem", "0" ) // 0 = Full Mode
register_cvar( "sv_punishsystem", "2" ) // 2 = Progressive
register_cvar( "sv_censorsystem", "1" ) // 2 = Random
register_cvar( "sv_renamesystem", "2" ) // 2 = Custom Name (Defined in CVAR)
register_cvar( "sv_whitelist", "1" ) // 1 = Whitelisted Words Enabled
register_cvar( "sv_checknames", "1" ) // 1 = Check Names for Swear Words
register_cvar( "sv_swearhelp", "1" ) // 1 = Client Help Enabled
register_cvar( "sv_bantype", "0" ) // 0 = Ban Steam ID
register_cvar( "sv_obeyimmunity", "1" ) // 1 = Obey Admin Immunity
register_cvar( "sv_menu_options", "abcdefg" ) // = All Punishments Enabled in Menu
register_cvar( "sv_punish_single", "ae" ) // = Gag & CashLoss in Single Mode
register_cvar( "sv_rename_custom", "PottyMouth" ) // = Custom Name for Renaming
register_cvar( "sv_censor_custom", "*" ) // = Custom Character for Overwriting Swear Words
register_cvar( "sv_cash_loss", "1000" ) // = Amount of Cash Lost as Punishment
register_cvar( "sv_gag_time", "120" ) // = Time in Seconds Gag Lasts
register_cvar( "sv_ban_time", "1440" ) // = Time in Minutes Ban Lasts
register_cvar( "sv_fire_time", "15" ) // = Time in Intervals Fire Lasts
register_cvar( "sv_fire_dmg", "5" ) // = Amount of HP Damage/Interval
register_cvar( "sv_slap_times", "15" ) // = Amount of Slaps for Punishment
register_cvar( "sv_slap_dmg", "5" ) // = Amount of HP Damage/Slap
register_menucmd( register_menuid("Swear Menu"), 1023, "SwearMenuCommand" )
register_clcmd( "amx_swearmode", "ToggleSwearFilter", REQD_LEVEL, "<on|off> -- Toggles Swear Mod On or Off" )
register_clcmd( "amx_swearmenu", "AttachMenuToAdmin", REQD_LEVEL, "Toggle Switch For Admins To See Menu" )
register_clcmd( "amx_namecheck", "RunNameCheck", REQD_LEVEL, "Runs A Name Check On All Clients" )
register_clcmd( "amx_sf_ungag", "UngagPlayer", REQD_LEVEL, "Ungags a Player Gagged by Swear Punishment" )
register_clcmd( "say", "CheckSay" )
register_clcmd( "say_team", "CheckSay" )
// Client Message Indexes
g_nMsgDamage = get_user_msgid( "Damage" )
}
public plugin_cfg()
{
if( !ConnectDB() )
{
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
if( !LoadBlackList() )
{
DisconnectDB()
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
g_bLoadErrWL = !LoadWhiteList()
g_bLoadErrPunish = !LoadPunishments()
DisconnectDB()
return PLUGIN_CONTINUE
}
public plugin_precache()
{
g_sprSmoke = precache_model( "sprites/steam1.spr" )
g_sprMFlash = precache_model( "sprites/muzzleflash.spr" )
g_sprLight = precache_model( "sprites/lgtning.spr" )
precache_sound( g_szSndScream )
precache_sound( g_szSndFlames )
precache_sound( g_szSndThunder )
return PLUGIN_CONTINUE
}
public client_authorized( id )
{
if( PluginEnabled( NULL ) )
{
AdminRanks( id )
CheckName( id )
}
return PLUGIN_CONTINUE
}
public client_putinserver( id )
{
if( PluginEnabled( NULL ) )
{
client_print_color( id, print_chat, "^4%s ^3%s ^4Plugin Enabled! ^#Do Not Swear!", PLUGIN_MOD, PLUGIN_NAME )
if( HelpEnabled( NULL ) )
client_print( id, print_chat, "%s To See the List of Swear Words, Say /swear", PLUGIN_MOD )
}
return PLUGIN_CONTINUE
}
public client_disconnect( id )
{
if( PluginEnabled( NULL ) )
{
ResetPlayer( id )
ResetAdmin( id )
}
return PLUGIN_CONTINUE
}
public client_infochanged( id )
{
if ( !PluginEnabled( NULL ) || !is_user_connected( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szNewName[MAX_NAME_LEN]
new szOldName[MAX_NAME_LEN]
get_user_info( id, "name", szNewName, MAX_NAME_LEN-1 )
get_user_name( id, szOldName, MAX_NAME_LEN-1 )
if( !equal( szNewName, szOldName ) )
return CheckName( id )
return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////
// Client Commands Section
////////////////////////////////////////////////////////////////////////////////////////////
public ToggleSwearFilter( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new i, szArg[32]
read_argv( 1, szArg, 31 )
new bool:nOnOff = InputSwitch( szArg )
PluginEnabled( (nOnOff)?ON:OFF )
console_print( id, "%s %s %s!", PLUGIN_MOD, PLUGIN_NAME, (nOnOff)?"Enabled":"Disabled" )
for( i = 1; i < MAX_PLAYERS+1; i++ )
{
ResetPlayer( i )
ResetAdmin( i )
}
if( nOnOff ) AdminRanks( id )
return PLUGIN_HANDLED
}
public AttachMenuToAdmin( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
if( g_nShowAdmin > OFF )
{
if( g_nShowAdmin != id )
{
new szAdminName[32]
get_user_name( g_nShowAdmin, szAdminName, 31 )
client_print_color( id, print_chat, "^4%s ^3ADMIN: ^4%s ^3Already has the Swear Menu attached!", PLUGIN_MOD, szAdminName )
}else
{
g_nShowAdmin = OFF
client_print_color( id, print_chat, "^4%s ^3You Have Unattached ^4The Swear Menu!", PLUGIN_MOD )
}
}else
{
g_nShowAdmin = id
client_print_color( id, print_chat, "^4%s ^3The Swear Menu is now attached to you!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
public RunNameCheck( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
for( new i = 1; i < MAX_PLAYERS+1; i++ )
CheckName( i )
return PLUGIN_HANDLED
}
public UngagPlayer( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new szTarget[STR_T]
read_args( szTarget, STR_T-1 )
new nUserID = cmd_target( id, szTarget, 2 )
if( nUserID > 0 && nUserID < 33 )
{
g_bUserGagged[nUserID-1] = false
remove_task( TASK_PLAYER_GAG + nUserID )
client_print_color( nUserID, print_chat, "^4%s ^3You have been ^4Ungagged ^3by an Admin! ^4Watch Your Language!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Swear Menu Section
////////////////////////////////////////////////////////////////////////////////////////////
public ShowMenuToAdmin( aID, vID )
{
new szUser[STR_T], szMenuBody[STR_X], szPunFlags[MAX_PUNISHMENTS+1]
new i, j = 0, nLen, nPunBits, nKeys = (1<<9)
// Get CVAR of Enabled Punishments
get_cvar_string( "sv_menu_options", szPunFlags, MAX_PUNISHMENTS )
nPunBits = ReadPunFlags( szPunFlags )
// Current Offender
g_nCurrClientID = vID
get_user_name( vID, szUser, STR_T-1 )
// Build Menu String
nLen = format( szMenuBody, (STR_X-1), "\rSwear Menu^n\w%s (%s)\w^n^n", szUser, g_szBadWord[vID-1] )
for( i = 0; i < MAX_PUNISHMENTS; i++ )
{
if( nPunBits & (1<<i) )
{
nLen += format( szMenuBody[nLen], (STR_X-1)-nLen, "\w%d. \y%s^n", (j+1), g_szPunTitle[i] )
nKeys |= (1<<j++)
}
}
format( szMenuBody[nLen], (STR_X-1)-nLen, "^n\w0. Take No Action" )
// Show Menu to Admin
show_menu( aID, nKeys, szMenuBody )
}
public SwearMenuCommand( id, key )
{
IssuePunishment( g_nCurrClientID, key )
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Name & Chat Text Filter Section
////////////////////////////////////////////////////////////////////////////////////////////
public CheckSay( id )
{
if ( !PluginEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
// Commented to test against self
//if( g_nShowAdmin == id ) return PLUGIN_CONTINUE
// Prevent Double-Checking
if( g_bUserSwore[id-1] )
{
g_bUserSwore[id-1] = false
return PLUGIN_CONTINUE
}
// Get User Chat Text/Command (say/say_team)
read_argv( 0, g_szUserCmd[id-1], 31 )
read_args( g_szUserSpeech[id-1], MAX_CHAT_LEN-1 )
remove_quotes( g_szUserSpeech[id-1] )
if( containi( g_szUserSpeech[id-1], "/swear" ) > NULL )
{
SwearWordsHelp( id )
return PLUGIN_HANDLED
}
if( g_bUserGagged[id-1] )
{
client_print_color( id, print_chat, "^4%s ^3You Have Been ^4Gagged for Swearing...^3You Must Wait!", PLUGIN_MOD )
if( HelpEnabled( NULL ) )
client_print_color( id, print_chat, "^4%s ^3Say ^4/swear ^3for a list of Offensive Words!", PLUGIN_MOD )
return PLUGIN_HANDLED
}
if( FilterText( id, g_szUserSpeech[id-1] ) > 0 )
{
g_bUserSwore[id-1] = true
new aID[2], Float:fDelay = get_cvar_float("amx_flood_time") + 0.05
aID[0] = id
set_task( fDelay, "RunSayFilter", (TASK_SAY_FILTER + id), aID, 1 )
PunishPlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public CheckName( id )
{
if ( !PluginEnabled( NULL ) || !NameFilterEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szUserName[MAX_NAME_LEN]
get_user_info( id, "name", szUserName, MAX_NAME_LEN-1 )
if( FilterText( id, szUserName ) > 0 )
{
PunishPlayer( id )
RenamePlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Name-Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public RunSayFilter( nArgs[] )
{
new nID = nArgs[0]
client_cmd( nID, "%s ^"%s^"", g_szUserCmd[nID-1], g_szUserSpeech[nID-1] )
if( task_exists( TASK_SAY_FILTER + nID ) )
remove_task( TASK_SAY_FILTER + nID )
return
}
e kto a munesh me bo me ngjyra ?
[info] Ke prek diqka spom bon me bo spe di ku o problemi se sdi qa ke prek kur e ke marr ti scripting je munu me bo ngjyra po nese don ni asi swear tmir ta gjej.[/info]
Thanks given by:
Thanks given by:
Thanks given by:
Posts: 42
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: May 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
iNFINITY^ Wrote:veron Wrote:Code: /*******************************************************************************************
* rs_swearfilter.sma Version 2.0 Date: JAN/28/2005
*
* RS Advanced Swear Filter + Punishment (MySQL Support)
*
* By: Rob Secord
* Alias: xeroblood (aka; Achilles)
* Email: xeroblood@gmail.com
*
* Credits: _KaszpiR_, Util, Knocker, poosmith (See Credits Section Below For More Info)
*
* Tested / Developed On:
* CS 1.6 - AMX 0.9.9
* CS 1.6 - AMXX 1.0
* MySQL v4.0.16-nt (Driver: v03.51)
*
*******************************************************************************************
* Admin Commands:
* amx_swearmode <on|off> - In-game admin command to Turn swearMode
* on or off. (removes any current punishments)
* amx_swearmenu - Toggles Swear Menu To Be Attached to you In-Game
* If Swear Menu is attached to an Admin, only
* that admin will see the Swear Menu when a
* player swears too many times. If SwearMenu
* is not attached to an admin, then Gag mode
* is the default!
* amx_namecheck - Runs a Swear Filter On All Clients' Username
* Should be called if CVAR sv_checknames is
* changed to 1 In-Game.
*
* Server CVARS:
* sv_swearfilter <0|1> - Turns the Whole Plugin On/Off
* (0 = Off) (1 = On)
* sv_filtersystem <0|1|2> - Swear Filter System to use:
* (0 = Full Mode) (1 = Slim Mode) (2 = Simple Mode)
* sv_punishsystem <0|1|2> - Punishment System to use:
* (0 = None) (1 = Single) (2 = Progressive)
* sv_censorsystem <0|1|2> - Word Censoring System to use:
* (0 = None) (1 = Random (@$%#)) (2 = Custom)
* sv_renamesystem <0|1|2> - Renaming System to use:
* (0 = Old Name) (1 = Steam ID) (2 = Custom)
* sv_whitelist <0|1> - Whitelist System for GOOD words
* (0 = No Whitelist) (1 = Use Whitelist)
* sv_checknames <0|1> - Player Name Filter
* (0 = Ignore Names) (1 = Filter Names)
* sv_swearhelp <0|1> - Player Help System (say /swear)
* (0 = No Help) (1 = Help)
* sv_bantype <0|1> - Player Ban Type to use:
* (0 = Steam ID) (1 = IP Address)
* sv_obeyimmunity <0|1> - Obey AMX Admin Immunity Rules for Punishments
* (0 = Disobey) (1 = Obey)
*
* sv_menu_options "abc" - The Punishments Allowed in Swear Menu (Possible Flags: "abcdefg")
* sv_punish_single "abc" - The Default Punishment for Single Mode (Possible Flags: "abcdefg")
* sv_rename_custom "Noob" - The Custom Name used for Renaming System
* sv_censor_custom "*" - The Custom Character used for Censoring System
* sv_cash_loss ## - Amount of Cash player will Lose
* sv_gag_time ## - Number of Seconds player will be Gagged
* sv_ban_time ## - Number of Minutes player will be Banned
* sv_fire_time ## - Number of Seconds. player will be Set on Fire
* sv_fire_dmg ## - Amount of Damage/Second player will lose from Fire
* sv_slap_times ## - Number of Times player will be Slapped
* sv_slap_dmg ## - Amount of Damage of each Slap
*
*******************************************************************************************
*
* If longest swear word is > 24 characters, change MAX_WORD_LENGTH
* to reflect longest word.
* If you have more that 40 words, change BLACKLIST_WORDS to reflect
* the number of words in file!
*
* If you use SQL, run the file tables.sql included in ZIP!
*
*******************************************************************************************
* Credits:
* As Always, Much of the credit goes to The People and Tutorials at
* http://amxmod.net/forums" onclick="window.open(this.href);return false; & http://www.amxmodx.org/forums" onclick="window.open(this.href);return false; for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801" onclick="window.open(this.href);return false;
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621" onclick="window.open(this.href);return false;
*
* Bug Fixes/Updates
* _KaszpiR_
*
* Ideas/Suggestions:
* Util, Knocker (see Updates below)
*
* Noticed Bugs (Case-Sensitivity):
* poosmith
*
*******************************************************************************************
* Revision History:
*
* Updates To Version 2.0:
* - Added support for AMX 0.9.9b & AMXX 1.0
* - Added Punishment System: None, Single and Progressive Modes
* - Added Filter System: Simple, Slim and Full Modes
* - Changed Renaming System: Old Name, STEAM ID or Custom
* - Changed Word Censor System: None, Random or Custom
* - Added CVAR to turn Punishments ON/OFF in Swear Menu
* - Fixed Crash Bugs on Multiple Swear Words in one line
*
* Updates To Version 1.6:
* - Fixed support for non-MySql admins (requires recompile)
* (Removed CVAR sv_usemysql -- Defined USE_MYSQL instead)
* - Compiled on Linux SUSE 9.0 by Knocker!!
*
* Updates To Version 1.5:
* - Checks Names for Swear Words if CVAR sv_checknames is set to 1
* - Renames Offensive names to WONID, IP or "Potty-Mouth #". Change by
* setting CVAR sv_rename_mode to 1, 2 or 3 respectively.
*
* - Uses MySQL or FILE for Swear Word List. To Use MySQL, set CVAR
* sv_usemysql to 1, default is 0 (Read From File)
*
* - Added a Whitelist for Good Words (goodwords.ini, or MySQL Table)
*
* - Uses Word Filters (fu.ck) If CVAR sv_usefilters is set to 1
* - Added CVAR sv_swearexact to Test against whole words or substrings
* (This should help protect ppl who say FUN when FU is a Swear Word)
* (Idea: Knocker)
*
* - Added A New Menu Punishment! Remove Cash From Player, Amount of
* cash removed is in CVAR sv_cashloss
*
* - Added a CVAR for the Special Character used for Censoring Words!!
* (instead of ****, see whatever char you want!!)
* (Idea: Knocker)
*
* - Changed: if sv_sweartimes is set to 0, Punishment Is Turned OFF!
*
* - Added a Help MOTD for players who say /swearwords. Admins may
* disable this option with CVAR sv_swearhelp
*
* Updates To Version 1.4: (Credits: Util for the Ideas!)
* - Reads Swear Words From File (addons/amx/swearwords.ini)
* - Added Ban Option (Ban Perm / # Minutes)
* (# Minutes is a CVAR: amx_bantime #)
* (Ban By WONID or IP)
* - Added Swear Word To Menu
*
* Updates To Version 1.4: (Credits: Knocker for the Ideas!)
* - Added Notice to Users When They Swear
* - Added CVAR for displaying/censoring Swear Word
* - Added Word Filter to catch words like: fu.ck or f*u.C,k etc...
*
* Versions prior to 1.4 unreleased...
*
**************************************************************************/
#include "base_inc/config.cfg" // Pre-compilation Configurations
#if defined USE_AMXX_MODE
#include <amxmodx> // AMX Mod X 1.0 Base
#include <cstrike> // AMX Mod X 1.0 CS Module
#include <fun> // AMX Mod X 1.0 Fun Module
#else
#include <amxmod> // AMX Mod 0.9.9b Base
#include <fun> // AMX Mod 0.9.9b Fun Module
#endif
#include <amxmisc> // AMX/AMXX Misc
#include <colorchat>
#include "base_inc/const.inc" // Constants
#include "base_inc/global.inc" // Globals
#include "base_inc/stock.inc" // Stock Functions
#include "base_inc/actions.inc" // Punishment Actions
#include "base_inc/effects.inc" // Punishment Effects
#if defined USE_SQL_MODE
#if defined USE_AMXX_MODE
#include "base_inc/dbi.inc" // AMXX DBI Interface
#else
#include "base_inc/mysql.inc" // AMX MySQL Interface
#endif
#else
#include "base_inc/file.inc" // File Interface
#endif
#if defined USE_AMXX_MODE && defined USE_SQL_MODE
public plugin_modules()
{
require_module("DBI")
}
#endif
public plugin_init()
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
// Defaults:
register_cvar( "sv_swearfilter", "1" ) // 1 = On
register_cvar( "sv_filtersystem", "0" ) // 0 = Full Mode
register_cvar( "sv_punishsystem", "2" ) // 2 = Progressive
register_cvar( "sv_censorsystem", "1" ) // 2 = Random
register_cvar( "sv_renamesystem", "2" ) // 2 = Custom Name (Defined in CVAR)
register_cvar( "sv_whitelist", "1" ) // 1 = Whitelisted Words Enabled
register_cvar( "sv_checknames", "1" ) // 1 = Check Names for Swear Words
register_cvar( "sv_swearhelp", "1" ) // 1 = Client Help Enabled
register_cvar( "sv_bantype", "0" ) // 0 = Ban Steam ID
register_cvar( "sv_obeyimmunity", "1" ) // 1 = Obey Admin Immunity
register_cvar( "sv_menu_options", "abcdefg" ) // = All Punishments Enabled in Menu
register_cvar( "sv_punish_single", "ae" ) // = Gag & CashLoss in Single Mode
register_cvar( "sv_rename_custom", "PottyMouth" ) // = Custom Name for Renaming
register_cvar( "sv_censor_custom", "*" ) // = Custom Character for Overwriting Swear Words
register_cvar( "sv_cash_loss", "1000" ) // = Amount of Cash Lost as Punishment
register_cvar( "sv_gag_time", "120" ) // = Time in Seconds Gag Lasts
register_cvar( "sv_ban_time", "1440" ) // = Time in Minutes Ban Lasts
register_cvar( "sv_fire_time", "15" ) // = Time in Intervals Fire Lasts
register_cvar( "sv_fire_dmg", "5" ) // = Amount of HP Damage/Interval
register_cvar( "sv_slap_times", "15" ) // = Amount of Slaps for Punishment
register_cvar( "sv_slap_dmg", "5" ) // = Amount of HP Damage/Slap
register_menucmd( register_menuid("Swear Menu"), 1023, "SwearMenuCommand" )
register_clcmd( "amx_swearmode", "ToggleSwearFilter", REQD_LEVEL, "<on|off> -- Toggles Swear Mod On or Off" )
register_clcmd( "amx_swearmenu", "AttachMenuToAdmin", REQD_LEVEL, "Toggle Switch For Admins To See Menu" )
register_clcmd( "amx_namecheck", "RunNameCheck", REQD_LEVEL, "Runs A Name Check On All Clients" )
register_clcmd( "amx_sf_ungag", "UngagPlayer", REQD_LEVEL, "Ungags a Player Gagged by Swear Punishment" )
register_clcmd( "say", "CheckSay" )
register_clcmd( "say_team", "CheckSay" )
// Client Message Indexes
g_nMsgDamage = get_user_msgid( "Damage" )
}
public plugin_cfg()
{
if( !ConnectDB() )
{
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
if( !LoadBlackList() )
{
DisconnectDB()
PluginEnabled( OFF )
return PLUGIN_CONTINUE
}
g_bLoadErrWL = !LoadWhiteList()
g_bLoadErrPunish = !LoadPunishments()
DisconnectDB()
return PLUGIN_CONTINUE
}
public plugin_precache()
{
g_sprSmoke = precache_model( "sprites/steam1.spr" )
g_sprMFlash = precache_model( "sprites/muzzleflash.spr" )
g_sprLight = precache_model( "sprites/lgtning.spr" )
precache_sound( g_szSndScream )
precache_sound( g_szSndFlames )
precache_sound( g_szSndThunder )
return PLUGIN_CONTINUE
}
public client_authorized( id )
{
if( PluginEnabled( NULL ) )
{
AdminRanks( id )
CheckName( id )
}
return PLUGIN_CONTINUE
}
public client_putinserver( id )
{
if( PluginEnabled( NULL ) )
{
client_print_color( id, print_chat, "^4%s ^3%s ^4Plugin Enabled! ^#Do Not Swear!", PLUGIN_MOD, PLUGIN_NAME )
if( HelpEnabled( NULL ) )
client_print( id, print_chat, "%s To See the List of Swear Words, Say /swear", PLUGIN_MOD )
}
return PLUGIN_CONTINUE
}
public client_disconnect( id )
{
if( PluginEnabled( NULL ) )
{
ResetPlayer( id )
ResetAdmin( id )
}
return PLUGIN_CONTINUE
}
public client_infochanged( id )
{
if ( !PluginEnabled( NULL ) || !is_user_connected( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szNewName[MAX_NAME_LEN]
new szOldName[MAX_NAME_LEN]
get_user_info( id, "name", szNewName, MAX_NAME_LEN-1 )
get_user_name( id, szOldName, MAX_NAME_LEN-1 )
if( !equal( szNewName, szOldName ) )
return CheckName( id )
return PLUGIN_CONTINUE
}
////////////////////////////////////////////////////////////////////////////////////////////
// Client Commands Section
////////////////////////////////////////////////////////////////////////////////////////////
public ToggleSwearFilter( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new i, szArg[32]
read_argv( 1, szArg, 31 )
new bool:nOnOff = InputSwitch( szArg )
PluginEnabled( (nOnOff)?ON:OFF )
console_print( id, "%s %s %s!", PLUGIN_MOD, PLUGIN_NAME, (nOnOff)?"Enabled":"Disabled" )
for( i = 1; i < MAX_PLAYERS+1; i++ )
{
ResetPlayer( i )
ResetAdmin( i )
}
if( nOnOff ) AdminRanks( id )
return PLUGIN_HANDLED
}
public AttachMenuToAdmin( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
if( g_nShowAdmin > OFF )
{
if( g_nShowAdmin != id )
{
new szAdminName[32]
get_user_name( g_nShowAdmin, szAdminName, 31 )
client_print_color( id, print_chat, "^4%s ^3ADMIN: ^4%s ^3Already has the Swear Menu attached!", PLUGIN_MOD, szAdminName )
}else
{
g_nShowAdmin = OFF
client_print_color( id, print_chat, "^4%s ^3You Have Unattached ^4The Swear Menu!", PLUGIN_MOD )
}
}else
{
g_nShowAdmin = id
client_print_color( id, print_chat, "^4%s ^3The Swear Menu is now attached to you!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
public RunNameCheck( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
for( new i = 1; i < MAX_PLAYERS+1; i++ )
CheckName( i )
return PLUGIN_HANDLED
}
public UngagPlayer( id, lvl, cid )
{
if( !cmd_access( id, lvl, cid, 1 ) )
return PLUGIN_HANDLED
new szTarget[STR_T]
read_args( szTarget, STR_T-1 )
new nUserID = cmd_target( id, szTarget, 2 )
if( nUserID > 0 && nUserID < 33 )
{
g_bUserGagged[nUserID-1] = false
remove_task( TASK_PLAYER_GAG + nUserID )
client_print_color( nUserID, print_chat, "^4%s ^3You have been ^4Ungagged ^3by an Admin! ^4Watch Your Language!", PLUGIN_MOD )
}
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Swear Menu Section
////////////////////////////////////////////////////////////////////////////////////////////
public ShowMenuToAdmin( aID, vID )
{
new szUser[STR_T], szMenuBody[STR_X], szPunFlags[MAX_PUNISHMENTS+1]
new i, j = 0, nLen, nPunBits, nKeys = (1<<9)
// Get CVAR of Enabled Punishments
get_cvar_string( "sv_menu_options", szPunFlags, MAX_PUNISHMENTS )
nPunBits = ReadPunFlags( szPunFlags )
// Current Offender
g_nCurrClientID = vID
get_user_name( vID, szUser, STR_T-1 )
// Build Menu String
nLen = format( szMenuBody, (STR_X-1), "\rSwear Menu^n\w%s (%s)\w^n^n", szUser, g_szBadWord[vID-1] )
for( i = 0; i < MAX_PUNISHMENTS; i++ )
{
if( nPunBits & (1<<i) )
{
nLen += format( szMenuBody[nLen], (STR_X-1)-nLen, "\w%d. \y%s^n", (j+1), g_szPunTitle[i] )
nKeys |= (1<<j++)
}
}
format( szMenuBody[nLen], (STR_X-1)-nLen, "^n\w0. Take No Action" )
// Show Menu to Admin
show_menu( aID, nKeys, szMenuBody )
}
public SwearMenuCommand( id, key )
{
IssuePunishment( g_nCurrClientID, key )
return PLUGIN_HANDLED
}
////////////////////////////////////////////////////////////////////////////////////////////
// Name & Chat Text Filter Section
////////////////////////////////////////////////////////////////////////////////////////////
public CheckSay( id )
{
if ( !PluginEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
// Commented to test against self
//if( g_nShowAdmin == id ) return PLUGIN_CONTINUE
// Prevent Double-Checking
if( g_bUserSwore[id-1] )
{
g_bUserSwore[id-1] = false
return PLUGIN_CONTINUE
}
// Get User Chat Text/Command (say/say_team)
read_argv( 0, g_szUserCmd[id-1], 31 )
read_args( g_szUserSpeech[id-1], MAX_CHAT_LEN-1 )
remove_quotes( g_szUserSpeech[id-1] )
if( containi( g_szUserSpeech[id-1], "/swear" ) > NULL )
{
SwearWordsHelp( id )
return PLUGIN_HANDLED
}
if( g_bUserGagged[id-1] )
{
client_print_color( id, print_chat, "^4%s ^3You Have Been ^4Gagged for Swearing...^3You Must Wait!", PLUGIN_MOD )
if( HelpEnabled( NULL ) )
client_print_color( id, print_chat, "^4%s ^3Say ^4/swear ^3for a list of Offensive Words!", PLUGIN_MOD )
return PLUGIN_HANDLED
}
if( FilterText( id, g_szUserSpeech[id-1] ) > 0 )
{
g_bUserSwore[id-1] = true
new aID[2], Float:fDelay = get_cvar_float("amx_flood_time") + 0.05
aID[0] = id
set_task( fDelay, "RunSayFilter", (TASK_SAY_FILTER + id), aID, 1 )
PunishPlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public CheckName( id )
{
if ( !PluginEnabled( NULL ) || !NameFilterEnabled( NULL ) || is_user_bot( id ) || IsPlayerImmune( id ) )
return PLUGIN_CONTINUE
new szUserName[MAX_NAME_LEN]
get_user_info( id, "name", szUserName, MAX_NAME_LEN-1 )
if( FilterText( id, szUserName ) > 0 )
{
PunishPlayer( id )
RenamePlayer( id )
new szUsername[STR_T], szMsg[STR_M]
get_user_name( id, szUsername, 31 )
format( szMsg, STR_M-1, "%s User '%s' has been Punished for Name-Swearing (%s)!!", PLUGIN_MOD, szUsername, g_szBadWord[id-1] )
WriteLog( szMsg )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public RunSayFilter( nArgs[] )
{
new nID = nArgs[0]
client_cmd( nID, "%s ^"%s^"", g_szUserCmd[nID-1], g_szUserSpeech[nID-1] )
if( task_exists( TASK_SAY_FILTER + nID ) )
remove_task( TASK_SAY_FILTER + nID )
return
}
e kto a munesh me bo me ngjyra ?
[info]Ke prek diqka spom bon me bo spe di ku o problemi se sdi qa ke prek kur e ke marr ti scripting je munu me bo ngjyra po nese don ni asi swear tmir ta gjej.[/info]
walla qashtu e kam gjet naper internet se :S ajt a munesh pra me ma gjet njo te mir qeshtu swear qe o ama me denime edhe me ngjyra mu kon ? qeshtu mu kon dicka
Thanks given by:
Thanks given by:
Thanks given by:
|