Merhaba arkadaşlar,
Küfür edince otomatik gaglama plugini gerek bana örnegin 1 uyarıda 120 saniye 2 uyarıda 300 saniye 3 uyarıda 600 saniye gibi
var ise benle paylaşırmısnız uyarısızda olur farketmez
@'GAREZ
@By.Dehset
@CSmiLeFaCe
Otomatik Gag
Moderatör: Moderatörler
-
Konu Sahibi - Mesajlar: 333
- Kayıt: Sal Mar 08, 2016 5:15 pm
-
- Mesajlar: 39
- Kayıt: Prş Haz 30, 2016 3:16 pm
-
- Mesajlar: 624
- Kayıt: Çrş Nis 06, 2016 7:40 pm
- Konum: Tekirdağ İlçesi
- Server Ip/DNS: cs11.csduragi.net
- Clan İsmi: HospitaL 卍 KLan
Otomatik Gag
@PASA kardeşim herşeyi otomatiğe bağlarsak adminlere ne görev kalıyo 

Link: | |
Linklerini gizle |
-
Konu Sahibi - Mesajlar: 333
- Kayıt: Sal Mar 08, 2016 5:15 pm
Otomatik Gag
@uzman59
Herşeyi otomatiğe bağlamıyoruz, surf klanım var ve jaile veya proya benzemiyor adminlerimiz saat başı serverde değiller
Herşeyi otomatiğe bağlamıyoruz, surf klanım var ve jaile veya proya benzemiyor adminlerimiz saat başı serverde değiller

Link: | |
Linklerini gizle |
-
- Mesajlar: 1958
- Kayıt: Sal Tem 05, 2016 2:27 pm
- Server Ip/DNS: -
- Clan İsmi: -
- İletişim:
Otomatik Gag
Pluginin yapımcısı: Exolent[jNr]'dir
Cvar komutları:
swear_filter_warning "uyari" // Uyarı mesajı
swear_filter_log <0/1> // Log kayıtı tutup tutmaması için
swear_filter_times <sure1> [sure2] [sure3] // Sırasıyla kaç dakika gaglansın
Bu yasaklı kelimeler için;
Altta yazdığı şekilde istediğin yasaklı kelimeyi ekleyebilirisn.
;"string" "kelime"
ini dosyasının adı: swear_filters.ini
Buna kısaca koruma listesi diyebiliriz. Oto gagdan kimlerin gag yememesin istiyorsan buna nickini ekle;
ini dosyasının adı: swear_whitelist.ini
Pluginin kodu ise aşağıdadır;
Adı: swear_filter.sma
Not: Ayrıca ekte verdiğim 2 dosyayıda eklemen gerekiyor
.ini dosyaları buraya: /addons/amxmodx/configs
.inc dosyası buraya: /addons/amxmodx/scripting/include
Öncelikle yabancı bir kaynaktan baktığım için belki hata yapmış olabilirim şimdiden affola. Eğer olumlu,olumsuz pluginin çalışmasıyla ilgili sorun olursa burdan bilgilendirirsen elimden geleni yaparım.
Cvar komutları:
swear_filter_warning "uyari" // Uyarı mesajı
swear_filter_log <0/1> // Log kayıtı tutup tutmaması için
swear_filter_times <sure1> [sure2] [sure3] // Sırasıyla kaç dakika gaglansın
Bu yasaklı kelimeler için;
Altta yazdığı şekilde istediğin yasaklı kelimeyi ekleyebilirisn.
;"string" "kelime"
ini dosyasının adı: swear_filters.ini
Kod: Tümünü seç
; Lines starting with a ';' are comments and are ignored
// These are also comments and are ignored
; Blank lines are okay to have too
; Format of adding a swear filter:
;"filter type" "filter to check again" "match index for regex"
;
; Filter types can be:
; "regex" - The filter being checked is a RegEx pattern
; "string" - The filter being checked is a string to check
;
; If you need to use " in your patterns or strings, be sure to put a \ in front of them.
;
; The match index is not required for "string" types
; The match index is the position in the RegEx pattern to compare the matched text with the white lists
; If you do not want to match white lists, omit the match index
;
; If you don't want to warn players, but still hide the message from chat
; You can add "hide" to the end of the line
;
; Example blocking IP addresses:
; "regex" "(((1[0-9]|[1-9]|2[0-4])?[0-9]|25[0-5])\.){3}((1[0-9]|[1-9]|2[0-4])?[0-9]|25[0-5])"
;
; Example blocking bad words:
; "regex" "ass|dick|fuck|shit" ; etc.
; or
; "string" "ass"
; "string" "dick"
; "string" "fuck"
; "string" "shit"
;
; Example hiding some commands from chat
; "string" "timeleft" "hide"
; "regex" "^\/\S+(\s+((\"[^\"]*\")|([^\s\"]*)))" "hide"
ini dosyasının adı: swear_whitelist.ini
Kod: Tümünü seç
; Lines starting with a ';' are comments and are ignored
// These are also comments and are ignored
; Blank lines are okay to have too
; Format of adding a swear white list:
;/regex pattern/
Adı: swear_filter.sma
Kod: Tümünü seç
#include <amxmodx>
#include <amxmisc>
#include <regex>
// Comment out this line to only block the messages from chat
#define GAG_PLAYER
#if defined GAG_PLAYER
#include <nvault>
#include <unixtime>
#endif
// max length of the pattern
// if it seems that it cuts off when loading, increase this value appropriately
#define MAX_PATTERN_LEN 128
enum _:FilterData {
Filter_IsRegex,
Filter_Pattern,
Filter_String[MAX_PATTERN_LEN + 1],
Filter_MatchIndex,
Filter_HideOnly
};
new Array:gFilterData;
new gNumFilters;
new Array:gWhiteLists;
new gNumWhiteLists;
new gReturnFromRegex;
#if defined GAG_PLAYER
new Array:gGagTimes;
new gNumTimes;
new const gDefaultTimes[] = {
5, 10, 15
};
new gCvarWarning;
new gVault;
#endif
new gCvarLog;
new gLogDir[64];
new gCvarHideHard;
public plugin_init() {
new const VERSION[] = "0.0.6";
#if defined GAG_PLAYER
register_plugin("Swear Filter [+Gag]", VERSION, "Exolent");
#else
register_plugin("Swear Filter", VERSION, "Exolent");
#endif
// load the swear pattern before anything
// so we can stop the plugin in case there are no words
LoadPattern();
// load white lists
LoadWhiteLists();
#if defined GAG_PLAYER
register_srvcmd("swear_filter_times", "CmdSetTimes");
#endif
register_clcmd("say", "CmdSay");
register_clcmd("say_team", "CmdSay");
#if defined GAG_PLAYER
gCvarWarning = register_cvar("swear_filter_warning", "* WARNING! You will be gagged next time you swear!");
gGagTimes = ArrayCreate();
// default times
for(new i = 0; i < sizeof(gDefaultTimes); i++) {
ArrayPushCell(gGagTimes, gDefaultTimes[i]);
}
gNumTimes = sizeof(gDefaultTimes);
// prepare our vault
gVault = nvault_open("swear_filter");
// grab this time's info
new year, month, day, hour, minute, second;
UnixToTime(get_systime(), year, month, day, hour, minute, second);
// prune from the beginning of time to the start of the day
nvault_prune(gVault, 0, TimeToUnix(year, month, day, 0, 0, 0));
#endif
gCvarLog = register_cvar("swear_filter_log", "1");
gCvarHideHard = register_cvar("swear_filter_hide_hard", "0");
get_localinfo("amxx_logs", gLogDir, charsmax(gLogDir));
add(gLogDir, charsmax(gLogDir), "/swear_filter");
if(!dir_exists(gLogDir)) {
mkdir(gLogDir);
}
}
public plugin_end() {
new filterData[FilterData];
for(new i = 0; i < gNumFilters; i++) {
ArrayGetArray(gFilterData, i, filterData);
if(filterData[Filter_IsRegex]) {
regex_free(Regex:filterData[Filter_Pattern]);
}
}
ArrayDestroy(gFilterData);
#if defined GAG_PLAYER
ArrayDestroy(gGagTimes);
nvault_close(gVault);
#endif
new Regex:pattern;
for(new i = 0; i < gNumWhiteLists; i++) {
pattern = ArrayGetCell(gWhiteLists, i);
regex_free(pattern);
}
ArrayDestroy(gWhiteLists);
}
#if defined GAG_PLAYER
public CmdSetTimes() {
new numArgs = read_argc() - 1;
if(numArgs < 1) {
log_amx("No times provided to swear_filter_times command.");
return PLUGIN_HANDLED;
}
new arg[12];
for(new i = 1; i <= numArgs; i++) {
read_argv(i, arg, charsmax(arg));
ArrayPushCell(gGagTimes, str_to_num(arg));
}
gNumTimes = numArgs;
log_amx("Gag times set.");
return PLUGIN_HANDLED;
}
#endif
public CmdSay(id) {
new args[194];
read_args(args, charsmax(args));
remove_quotes(args);
new filterData[FilterData], match[192], bool:matched;
for(new i = 0, j, Regex:pattern; i < gNumFilters; i++) {
ArrayGetArray(gFilterData, i, filterData);
// check if this matched a swear filter or contained a bad word
if(filterData[Filter_IsRegex] ? (regex_match_c(args, Regex:filterData[Filter_Pattern], gReturnFromRegex) > 0) : (containi(args, filterData[Filter_String]) >= 0)) {
// if we matched a swear filter and we need to check for white list
if(filterData[Filter_IsRegex] && filterData[Filter_MatchIndex] >= 0) {
// make sure we have valid match index
if(filterData[Filter_MatchIndex] >= gReturnFromRegex) {
log_amx("Could not check white list for this pattern ^"%s^" because the match index is too high.");
} else {
// let's check for white lists
regex_substr(Regex:filterData[Filter_Pattern], filterData[Filter_MatchIndex], match, charsmax(match));
matched = false;
for(j = 0; j < gNumWhiteLists; j++) {
pattern = ArrayGetCell(gWhiteLists, j);
if(regex_match_c(match, pattern, gReturnFromRegex) > 0) {
matched = true;
break;
}
}
if(matched) {
continue;
}
}
}
// if this is just to hide from chat
if(filterData[Filter_HideOnly]) {
return get_pcvar_num(gCvarHideHard) ? PLUGIN_HANDLED : PLUGIN_HANDLED_MAIN;
}
if(get_pcvar_num(gCvarLog)) {
new dateString[11];
get_time("%Y-%m-%d", dateString, charsmax(dateString));
new fileName[128];
formatex(fileName, charsmax(fileName), "%s/%s.log", gLogDir, dateString);
new f = fopen(fileName, "a+");
if(f) {
new timeString[9];
get_time("%H:%M:%S", timeString, charsmax(timeString));
new name[32], steamID[35];
get_user_name(id, name, charsmax(name));
get_user_authid(id, steamID, charsmax(steamID));
fprintf(f, "Player: %s <%s>^n", name, steamID);
fprintf(f, "Time: %s^n", timeString);
fprintf(f, "Message: ^"%s^"^n", args);
if(filterData[Filter_IsRegex]) {
fprintf(f, "Matched pattern: ^"%s^"^n", filterData[Filter_String]);
fputs(f, "Matches:^n");
for(new i = 0; i < gReturnFromRegex; i++) {
regex_substr(Regex:filterData[Filter_Pattern], i, args, charsmax(args));
fprintf(f, "- ^"%s^"^n", args);
}
} else {
fprintf(f, "Contained string: ^"%s^"^n", filterData[Filter_String]);
}
fputs(f, "^n=======================================^n^n");
fclose(f);
} else {
log_amx("Failed to open log file for writing: %s", fileName);
}
}
#if defined GAG_PLAYER
new steamID[35];
get_user_authid(id, steamID, charsmax(steamID));
new gagIndex = nvault_get(gVault, steamID);
if(gagIndex) {
server_cmd("amx_gag #%d %d", get_user_userid(id), ArrayGetCell(gGagTimes, min(gagIndex, gNumTimes) - 1));
} else {
get_pcvar_string(gCvarWarning, args, charsmax(args));
client_print(id, print_chat, "%s", args);
}
num_to_str(gagIndex + 1, args, charsmax(args));
nvault_set(gVault, steamID, args);
#else
client_print(id, print_chat, "* Your message was caught by the swear filter!");
#endif
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
LoadPattern() {
new fileName[64];
get_configsdir(fileName, charsmax(fileName));
add(fileName, charsmax(fileName), "/swear_filters.ini");
new f = fopen(fileName, "rt");
if(f) {
gFilterData = ArrayCreate(FilterData);
new data[64 + MAX_PATTERN_LEN], type[8], filterData[FilterData], indexString[12], hideString[12];
new quoteIndex, i;
new const quoteReplacements[][] = {
""", "\'", "%'", "!qu'"
};
while(!feof(f)) {
fgets(f, data, charsmax(data));
trim(data);
quoteIndex = -1;
if(contain(data, "\^"") >= 0) {
for(i = 0; i < sizeof(quoteReplacements); i++) {
if(contain(data, quoteReplacements[i]) == -1) {
quoteIndex = i;
replace_all(data, charsmax(data), "\^"", quoteReplacements[i]);
break;
}
}
}
if(!data[0] || data[0] == ';' || data[0] == '/' && data[1] == '/'
|| parse(data, type, charsmax(type), filterData[Filter_String], charsmax(filterData[Filter_String]), indexString, charsmax(indexString), hideString, charsmax(hideString)) < 2) {
continue;
}
strtolower(type);
if(!equal(type, "regex") && !equal(type, "string")) {
continue;
}
if(quoteIndex != -1) {
replace_all(filterData[Filter_String], charsmax(filterData[Filter_String]), quoteReplacements[quoteIndex], "^"");
}
if((filterData[Filter_IsRegex] = (type[0] == 'r'))) {
if(!indexString[0] || !is_str_num(indexString) || (filterData[Filter_MatchIndex] = str_to_num(indexString)) < 0) {
filterData[Filter_MatchIndex] = -1;
}
filterData[Filter_Pattern] = _:regex_compile(filterData[Filter_String], gReturnFromRegex, data, charsmax(data), "i");
if(Regex:filterData[Filter_Pattern] < REGEX_OK) {
log_amx("Error with Regex pattern ^"%s^": %d %s", filterData[Filter_String], gReturnFromRegex, data);
continue;
}
}
filterData[Filter_HideOnly] = _:(equali(indexString, "hide") || equali(hideString, "hide"));
ArrayPushArray(gFilterData, filterData);
gNumFilters++;
}
fclose(f);
if(!gNumFilters) {
ArrayDestroy(gFilterData);
set_fail_state("No swear words to block. Disabling plugin");
}
} else {
log_amx("Unable to open %s", fileName);
set_fail_state("No swear filter file found.");
}
}
LoadWhiteLists() {
gWhiteLists = ArrayCreate();
new fileName[64];
get_configsdir(fileName, charsmax(fileName));
add(fileName, charsmax(fileName), "/swear_whitelist.ini");
new f = fopen(fileName, "rt");
if(f) {
new data[MAX_PATTERN_LEN + 8], Regex:pattern, patternString[MAX_PATTERN_LEN + 1], len;
new Regex:patternForPatterns = regex_compile("^^\/.+\/$", gReturnFromRegex, data, charsmax(data));
if(patternForPatterns < REGEX_OK) {
log_amx("Could not create pattern to find white lists: (%d) %s", gReturnFromRegex, data);
fclose(f);
return;
}
while(!feof(f)) {
len = fgets(f, data, charsmax(data)) - trim(data);
if(regex_match_c(data, patternForPatterns, gReturnFromRegex) <= 0) {
continue;
}
copy(patternString, min(charsmax(patternString), len - 2), data[1]);
pattern = regex_compile(patternString, gReturnFromRegex, data, charsmax(data), "i");
if(pattern < REGEX_OK) {
log_amx("Could not create pattern for ^"%s^": (%d) %s", patternString, gReturnFromRegex, data);
continue;
}
ArrayPushCell(gWhiteLists, pattern);
gNumWhiteLists++;
}
fclose(f);
} else {
log_amx("Unable to open %s", fileName);
}
}
.ini dosyaları buraya: /addons/amxmodx/configs
.inc dosyası buraya: /addons/amxmodx/scripting/include
Öncelikle yabancı bir kaynaktan baktığım için belki hata yapmış olabilirim şimdiden affola. Eğer olumlu,olumsuz pluginin çalışmasıyla ilgili sorun olursa burdan bilgilendirirsen elimden geleni yaparım.
Bu mesaja eklenen dosyaları görüntülemek için gerekli izinlere sahip değilsiniz.
Link: | |
Linklerini gizle |
-
Yasaklı Üye - Mesajlar: 12
- Kayıt: Pzt Ağu 15, 2016 4:30 pm