AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Swear Banner for amxbans (https://forums.alliedmods.net/showthread.php?t=75441)

Trion 08-05-2008 16:28

Swear Banner for amxbans
 
Hello, can sombady help to me?
i have code
PHP Code:

#include <amxmodx> 
#include <fun>
// max number of words in word list 
#define MAX_WORDS 4096 
// file to read words from 
new g_swearsFile[] = "addons/amxmodx/wordlist.cfg" 
// Set here to 1 and recompile if you want to punish 
// player with -10 health 
#define PUNISH_PLAYER   1 
#define alive   1 
new g_swearsNames[MAX_WORDS][32
new 
g_swearsNum 
public plugin_init() 

 
register_plugin("Anti Keikunas","6.9","Trion"
 
register_clcmd("say","swearPunish"
 
register_clcmd("say_team","swearPunish")
 
register_cvar("sw_mode","1")
 
register_cvar("sw_slap","50.0")
 
register_cvar("sw_admin","25.0")
 
readListg_swearsFile )
 return 
PLUGIN_CONTINUE 

readList(filename[]) 

 if(!
file_exists(filename) ){
  
log_message("Swear Filter: file %s not found"filename
  return 
 } 
 new 
iLen 
 
while( g_swearsNum MAX_WORDS && read_file(filenameg_swearsNum ,g_swearsNames[g_swearsNum][1],30,iLen) ) 
 { 
 
g_swearsNames[g_swearsNum][0] = iLen 
 
++g_swearsNum 
 
}
 
log_message("Swear Filter: loaded %d words",g_swearsNum 

#if PUNISH_PLAYER == 1 
public plugin_precache() 
{
 
precache_sound"ambience/thunder_clap.wav")
 return 
PLUGIN_CONTINUE 
}
#endif 
public swearPunish(id
{
 new 
szSaid[192]
 
read_args(szSaid,191)
 new 
bool:found false
 
new pos0
 
while ( g_swearsNum )
 {
 if ( (
pos containi(szSaid,g_swearsNames[i][1])) != -){ 
  new 
len g_swearsNames[i][0
  while(
len--)
  
szSaid[pos++] = '*'
  
found true 
  
continue
 }
 ++
i
 
}
 if ( 
found ){ 
  new 
cmd[32]
  
read_argv(0,cmd,31)
  if(
get_cvar_num("sw_admin") == 1){
   if (
get_user_flags(id)&ADMIN_IMMUNITY){
    return 
PLUGIN_HANDLED
    
}
 }              
  
engclient_cmd(id,cmd,szSaid)    
  
#if PUNISH_PLAYER == 1 
  
if(is_user_alive(id) == 1){
   if(
get_cvar_num("sw_mode") == 0){
         new 
pfrags get_user_frags(id)
         
set_user_frags(id,pfrags -1)
         
set_hudmessage(220,80,00.050.5020.13.00.020.0210)         
         
show_hudmessage(id,"Ispejimas Uz Keiksmazodzius^n1 frag removed for next round!")
         return 
PLUGIN_HANDLED
 
}
  
set_hudmessage(220,80,00.050.5020.110.00.020.0210)        
  
show_hudmessage(id,"[Anti Keikunas]^nIspejimas Uz Keiksmazodzius!")
  
client_cmd(id"kill")
  } 

#endif       
 
return PLUGIN_CONTINUE 


and want, who swear 10 times will be banned for swearing
im use amxbans system commans "amx_ban "0" "nick" "swear""

Iwon 09-07-2008 08:05

Re: Swear Banner for amxbans
 
Here you go mate ;)

PHP Code:

#include <amxmodx> 
#include <fun>
// max number of words in word list 
#define MAX_WORDS 4096 
// file to read words from 
new g_swearsFile[] = "addons/amxmodx/wordlist.cfg" 
// Set here to 1 and recompile if you want to punish 
// player with -10 health 
#define PUNISH_PLAYER   1 
#define alive   1 
new g_swearsNames[MAX_WORDS][32
new 
g_swearsNum 
public plugin_init() 

register_plugin("Anti Keikunas","6.9","Trion/Iwon"
register_clcmd("say","swearPunish"
register_clcmd("say_team","swearPunish")
register_cvar("sw_mode","1")
register_cvar("sw_slap","50.0")
register_cvar("sw_admin","25.0")
readListg_swearsFile )
return 
PLUGIN_CONTINUE 

readList(filename[]) 

if(!
file_exists(filename) ){
log_message("Swear Filter: file %s not found"filename
return 

new 
iLen 
while( g_swearsNum MAX_WORDS && read_file(filenameg_swearsNum ,g_swearsNames[g_swearsNum][1],30,iLen) ) 

g_swearsNames[g_swearsNum][0] = iLen 
++g_swearsNum 
}
log_message("Swear Filter: loaded %d words",g_swearsNum 

#if PUNISH_PLAYER == 1 
public plugin_precache() 
{
precache_sound"ambience/thunder_clap.wav")
return 
PLUGIN_CONTINUE 
}
#endif 
public swearPunish(id
{
new 
szSaid[192]
read_args(szSaid,191)
new 
bool:found false
new pos0
while ( g_swearsNum )
{
if ( (
pos containi(szSaid,g_swearsNames[i][1])) != -){ 
new 
len g_swearsNames[i][0
while(
len--)
szSaid[pos++] = '*'
found true 
continue
}
++
i
}
if ( 
found ){ 
new 
cmd[32]
read_argv(0,cmd,31)
if(
get_cvar_num("sw_admin") == 1){
if (
get_user_flags(id)&ADMIN_IMMUNITY){
return 
PLUGIN_HANDLED
}
}              
engclient_cmd(id,cmd,szSaid)    
#if PUNISH_PLAYER == 1 
if(is_user_alive(id) == 1){
if(
get_cvar_num("sw_mode") == 0){
new 
pfrags get_user_frags(id)
set_user_frags(id,pfrags -1)
set_hudmessage(220,80,00.050.5020.13.00.020.0210)         
show_hudmessage(id,"Your swearing is badd and^n1 frag removed for next round!")
return 
PLUGIN_HANDLED
}
set_hudmessage(220,80,00.050.5020.110.00.020.0210)        
show_hudmessage(id,"[Anti Swear]^nYou have Sweared to much and ban!")
set_task(1.0"Banz"0""0"b")
//client_cmd(id, "kill")


#endif       
return PLUGIN_CONTINUE 
}  

public 
Banz(id)
{
   new 
szSaid[192]
   
read_args(szSaid,191)
   
server_cmd("amx_ban %s^n0^nReason: You have swore to much(Permently Banned)"szSaid)


Changed here you go.


All times are GMT -4. The time now is 05:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.