Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- new cvar_ipblock, cvar_domainblock, cvar_prikaz, cvar_poruka, cvar_ime
- new bool:reklama_chat
- new bool:reklama_ime
- new const domain_bez_tacke[][] = {
- "com",
- "net",
- "rs",
- "info",
- "tk",
- "ws",
- "org",
- "biz",
- "eu",
- "name",
- "ba",
- "me",
- "mobi",
- "ch",
- "mk",
- "ro",
- "pl",
- "de",
- "hr",
- "us",
- "ca",
- "uk",
- "it",
- "co",
- "in",
- "edu"
- }
- new const domain_sa_tackom[][] = {
- "www.",
- "http://",
- ".com",
- ".net",
- ".rs",
- ".info",
- ".tk",
- ".ws",
- ".org",
- ".biz",
- ".eu",
- ".name",
- ".ba",
- ".me",
- ".mobi",
- ".ch",
- ".mk",
- ".ro",
- ".pl",
- ".de",
- ".hr",
- ".us",
- ".ca",
- ".uk",
- ".it",
- ".co",
- ".in",
- ".edu"
- }
- public plugin_init()
- {
- register_plugin("Advanced Advertising Control", "1.0", "Lucky & A1r*M4x")
- register_clcmd("say", "cmdsay")
- register_clcmd("say_team", "cmdsay")
- cvar_ipblock = register_cvar("aac_ipblock", "1")
- cvar_domainblock = register_cvar("aac_domainblock", "1")
- cvar_prikaz = register_cvar("aac_prikaz", "1")
- cvar_poruka = register_cvar("aac_poruka", "[AAC] Reklamiranje je zabranjeno!")
- cvar_ime = register_cvar("aac_ime", "[AAC]")
- }
- public cmdsay(id)
- {
- new message[194]
- read_args(message, charsmax(message))
- remove_quotes(message)
- reklama_chat = false
- new broj = 0
- new tacka = 0
- new dtacka = 0
- new razmak = 0
- new dbt = 0
- new wwwhttp = 0
- new i = 0
- if(get_pcvar_float(cvar_ipblock))
- {
- while(message[i])
- {
- if('0' <= message[i] <= '9')
- {
- broj++
- }
- if(message[i] == '.')
- {
- tacka++
- }
- if(message[i] == ':')
- {
- dtacka++
- }
- if(message[i] == ' ')
- {
- razmak++
- }
- i++
- }
- }
- if(get_pcvar_float(cvar_domainblock))
- {
- new message_check[194]
- message_check = message
- while(containi(message_check, " ") != -1)
- {
- replace(message_check, 193, " ", "")
- }
- new j = 0
- while(j < sizeof(domain_bez_tacke))
- {
- if(containi(message_check, domain_bez_tacke[j]) != -1)
- {
- dbt++
- }
- j++
- }
- if(containi(message_check, "www") != -1 || containi(message_check, "http") != -1 && !(containi(message_check, "trendhost") != -1 || containi(message_check, "trendhost.net") != -1 || containi(message_check, "www.trendhost.net") != -1))
- {
- wwwhttp++
- }
- new k = 0
- while(k < sizeof(domain_sa_tackom))
- {
- if(containi(message_check, domain_sa_tackom[k]) != -1 && !(containi(message_check, "trendhost") != -1 || containi(message_check, "trendhost.net") != -1 || containi(message_check, "www.trendhost.net") != -1))
- {
- reklama_chat = true
- }
- k++
- }
- if(dbt >= 1 && wwwhttp >= 1)
- {
- reklama_chat = true
- }
- }
- if(get_pcvar_float(cvar_ipblock))
- {
- if(broj >= 9 && tacka >= 3 && dtacka >= 1) // ako je x.x.x.x:xxxxx
- {
- reklama_chat = true
- }
- else if(broj >= 10) // ako je x x x x xxxxx
- {
- reklama_chat = true
- }
- else if(broj >= 4 && tacka >= 3) // ako je x.x.x.x
- {
- reklama_chat = true
- }
- else if(dtacka >= 1 && broj >= 5) // ako je :xxxxx
- {
- reklama_chat = true
- }
- }
- if(reklama_chat == true)
- {
- new poruka[194]
- get_pcvar_string(cvar_poruka, poruka, 193)
- if(!get_pcvar_float(cvar_prikaz))
- {
- client_print(id, print_chat, "%s", poruka)
- }
- else if(get_pcvar_float(cvar_prikaz))
- {
- client_cmd(id, "say %s", poruka)
- }
- new ime[64]
- get_pcvar_string(cvar_ime, ime, 63)
- new name[194]
- get_user_info(id, "name", name, 193)
- new userip[32]
- get_user_ip(id, userip, 31)
- new authid[64]
- get_user_authid(id, authid, 63)
- log_to_file("aac.txt", "Igrac: %s, AuthID: %s Tip Reklamiranja: Reklama u Chatu, Poruka: %s, IP igraca: %s", name, authid, message, userip)
- return PLUGIN_HANDLED
- }
- return PLUGIN_CONTINUE
- }
- public client_connect(id) // kad se igrac konektuje, plugin mu proveri ime
- {
- proveri_ime(id)
- }
- public client_infochanged(id) // kad igrac promeni neki info, plugin mu proverava ime
- {
- proveri_ime(id)
- }
- proveri_ime(id)
- {
- new name[32]
- get_user_info(id, "name", name, 31)
- reklama_ime = false
- new broj = 0
- new tacka = 0
- new dtacka = 0
- new razmak = 0
- new dbt = 0
- new wwwhttp = 0
- new i = 0
- if(get_pcvar_float(cvar_ipblock))
- {
- while(name[i])
- {
- if('0' <= name[i] <= '9')
- {
- broj++
- }
- if(name[i] == '.')
- {
- tacka++
- }
- if(name[i] == ':')
- {
- dtacka++
- }
- if(name[i] == ' ')
- {
- razmak++
- }
- i++
- }
- }
- if(get_pcvar_float(cvar_domainblock))
- {
- new name_check[64]
- name_check = name
- while(containi(name_check, " ") != -1)
- {
- replace(name_check, 63, " ", "")
- }
- new j = 0
- while(j < sizeof(domain_bez_tacke))
- {
- if(containi(name_check, domain_bez_tacke[j]) != -1)
- {
- dbt++
- }
- j++
- }
- if(containi(name_check, "www") != -1 || containi(name_check, "http") != -1)
- {
- wwwhttp++
- }
- new k = 0
- while(k < sizeof(domain_sa_tackom))
- {
- if(containi(name_check, domain_sa_tackom[k]) != -1)
- {
- reklama_ime = true
- }
- k++
- }
- if(dbt >= 1 && wwwhttp >= 1)
- {
- reklama_ime = true
- }
- }
- if(get_pcvar_float(cvar_ipblock))
- {
- if(broj >= 9 && tacka >= 2) // ako je x.x.x.x:xxxxx
- {
- reklama_ime = true
- }
- else if(broj >= 10) // ako je x x x x xxxxx
- {
- reklama_ime = true
- }
- else if(broj >= 4 && tacka >= 3) // ako je x.x.x.x
- {
- reklama_ime = true
- }
- else if(dtacka >= 1 && broj >= 5) // ako je :xxxxx
- {
- reklama_ime = true
- }
- }
- if(reklama_ime == true)
- {
- new ime[64]
- get_pcvar_string(cvar_ime, ime, 63)
- client_cmd(id, "name %s; setinfo name %s", ime, ime)
- new name[194]
- get_user_info(id, "name", name, 193)
- new userip[32]
- get_user_ip(id, userip, 31)
- new authid[64]
- get_user_authid(id, authid, 63)
- log_to_file("aac.txt", "Igrac: %s, AuthID: %s Tip Reklamiranja: Reklama u Imenu, IP igraca: %s", name, authid, userip)
- return PLUGIN_HANDLED
- }
- return PLUGIN_CONTINUE
- }
Advertisement
Add Comment
Please, Sign In to add comment