Posts: 42
Threads: 1
%%TYL_NUMTHANKEDLIKED%%
Joined: May 2011
Reputation:
0
Thanks: 0
Given 0 thank(s) in 0 post(s)
#include <amxmodx>
#include <engine>
new const Version[] = "0.3";
enum BombSites
{
BOMBSITE_A,
BOMBSITE_B
}
new g_iBombSiteEntity[ BombSites ];
new bool:g_bBombSiteStatus[ BombSites ];
new g_iPlayerWithBomb;
new bool:g_bPlayerHoldingBomb;
new g_iHUDEntity;
new g_pCVarAllowPlantNum;
new g_pCVarLockSiteNum;
new g_pCVarLockSite;
public plugin_init( )
{
register_plugin( "BombSite Lock" , Version , "bugsy" );
register_concmd( "bl_setbombsite" , "SetBombSiteConsole" , ADMIN_KICK );
register_concmd( "bl_bombsitemenu" , "ShowBombSiteMenu" , ADMIN_KICK );
register_event( "CurWeapon" , "fw_EvCurWeapon" , "b" , "1=1" );
register_event( "WeapPickup", "fw_EvWeapPickup" , "be" , "1=6" );
register_event( "BombDrop" , "fw_EvBombDrop" , "bc" );
register_logevent( "fw_EvRoundStart" , 2 , "1=Round_Start" );
g_pCVarAllowPlantNum = register_cvar( "bl_allowplantctnum" , "0" );
g_pCVarLockSiteNum = register_cvar( "bl_locksitectnum" , "2" );
g_pCVarLockSite = register_cvar( "bl_locksite" , "b" );
g_iHUDEntity = create_entity( "info_target" );
entity_set_string( g_iHUDEntity , EV_SZ_classname , "bl_hud_entity" );
register_think( "bl_hud_entity" , "fw_HUDEntThink" );
new szMap[ 11 ] , BombSites:bsBombSiteA , BombSites:bsBombSiteB;
get_mapname( szMap , charsmax( szMap ) );
if ( equal( szMap , "de_chateau" ) || equal( szMap , "de_dust2" ) || equal( szMap , "de_train" ) )
{
bsBombSiteA = BOMBSITE_B;
bsBombSiteB = BOMBSITE_A;
}
else
{
bsBombSiteA = BOMBSITE_A;
bsBombSiteB = BOMBSITE_B;
}
g_iBombSiteEntity[ bsBombSiteA ] = find_ent_by_class( -1 , "func_bomb_target" );
g_iBombSiteEntity[ bsBombSiteB ] = find_ent_by_class( g_iBombSiteEntity[ bsBombSiteA ] , "func_bomb_target" );
}
public client_disconnect( id )
{
if ( g_iPlayerWithBomb == id )
{
g_iPlayerWithBomb = 0;
g_bPlayerHoldingBomb = false;
}
}
public fw_EvCurWeapon( id )
{
if ( id == g_iPlayerWithBomb )
{
if ( read_data( 2 ) == CSW_C4 )
{
g_bPlayerHoldingBomb = true;
entity_set_float( g_iHUDEntity , EV_FL_nextthink , ( get_gametime() + 1.0 ) );
}
else
{
g_bPlayerHoldingBomb = false;
}
}
}
public fw_EvWeapPickup( id )
{
g_iPlayerWithBomb = id;
}
public fw_EvBombDrop()
{
g_iPlayerWithBomb = 0;
g_bPlayerHoldingBomb = false;
}
public fw_EvRoundStart()
{
new iAllowPlantNum = get_pcvar_num( g_pCVarAllowPlantNum );
new iLockSiteNum = get_pcvar_num( g_pCVarLockSiteNum );
new iPlayers[ 32 ] , iNum , iCTCount;
get_players( iPlayers , iNum , "h" );
for ( new i = 0 ; i < iNum ; i++ )
if ( get_user_team( iPlayers[ i ] ) == 2 )
iCTCount++;
if ( iCTCount < iAllowPlantNum )
{
SetBombSiteLock( BOMBSITE_A , true );
SetBombSiteLock( BOMBSITE_B , true );
client_print( 0 , print_chat , "* BombSites A & B are both locked since there are less than %d CTs." , iAllowPlantNum );
}
else if ( iCTCount < iLockSiteNum )
{
new szSite[ 2 ];
get_pcvar_string( g_pCVarLockSite , szSite , charsmax( szSite ) );
szSite[ 0 ] = toupper( szSite[ 0 ] );
if ( !( 'A' <= szSite[ 0 ] <= 'B' ) )
return PLUGIN_CONTINUE;
SetBombSiteLock( ( szSite[ 0 ] == 'A' ) ? BOMBSITE_A : BOMBSITE_B , true );
SetBombSiteLock( ( szSite[ 0 ] == 'A' ) ? BOMBSITE_B : BOMBSITE_A , false );
client_print( 0 , print_chat , "* BombSite %s has been locked since there are less than %d CTs." , szSite , iLockSiteNum );
}
else
{
SetBombSiteLock( BOMBSITE_A , false );
SetBombSiteLock( BOMBSITE_B , false );
}
return PLUGIN_CONTINUE;
}
public SetBombSiteConsole( id , AdminLevel )
{
if ( !( get_user_flags( id ) & AdminLevel ) )
{
console_print( id , "* You do not have access to this command." );
return PLUGIN_HANDLED;
}
if ( !g_iBombSiteEntity[ BOMBSITE_A ] || !g_iBombSiteEntity[ BOMBSITE_B ] )
{
console_print( id , "* BombSite Lock: Sorry, this map is not supported." );
return PLUGIN_HANDLED;
}
new szSite[ 3 ] , szState[ 3 ] , iState , BombSites:bsSite;
read_argv( 1 , szSite , charsmax( szSite ) );
read_argv( 2 , szState , charsmax( szState ) );
iState = str_to_num( szState );
if ( ( strlen( szSite ) > 1 ) || !is_str_num( szState ) || !( 0 <= iState <= 1 ) )
szSite[ 0 ] = 'X';
else
szSite[ 0 ] = toupper( szSite[ 0 ] );
switch ( szSite[ 0 ] )
{
case 'A':
{
bsSite = BOMBSITE_A;
}
case 'B':
{
bsSite = BOMBSITE_B;
}
default:
{
console_print( id , "* BombSite Lock: Invalid arguments, use format: 'fb_setbombsite a\b 0\1'" );
return PLUGIN_HANDLED;
}
}
SetBombSiteLock( bsSite , bool:iState );
console_print( id , "* BombSite %s has been %socked" , szSite , iState ? "L" : "Unl" );
set_hudmessage( 255 , 255 , 255 , -1.0 , 0.65 , 0 , 3.0 , 3.0 , .channel = -1 );
show_hudmessage( 0 , "BombSite %s has been %socked" , szSite , iState ? "L" : "Unl" );
return PLUGIN_HANDLED;
}
public ShowBombSiteMenu( id , AdminLevel )
{
if ( !( get_user_flags( id ) & AdminLevel ) )
{
console_print( id , "* You do not have access to this command." );
return PLUGIN_HANDLED;
}
if ( !g_iBombSiteEntity[ BOMBSITE_A ] || !g_iBombSiteEntity[ BOMBSITE_B ] )
{
console_print( id , "* BombSite Lock: Sorry, this map is not supported." );
return PLUGIN_HANDLED;
}
new iMenu = menu_create( "BombSite Lock Menu" , "MenuHandler" );
new iCallBack = menu_makecallback( "MenuCallBack" );
menu_additem( iMenu , "Lock A" , .callback = iCallBack );
menu_additem( iMenu , "Lock B" , .callback = iCallBack );
menu_additem( iMenu , "Unlock A" , .callback = iCallBack );
menu_additem( iMenu , "Unlock B" , .callback = iCallBack );
menu_additem( iMenu , "Lock A & B" , .callback = iCallBack );
menu_additem( iMenu , "Unlock A & B" , .callback = iCallBack );
menu_display( id , iMenu );
return PLUGIN_HANDLED;
}
public MenuCallBack( id , iMenu, iItem )
{
new iRetVal;
switch ( iItem )
{
case 0: iRetVal = g_bBombSiteStatus[ BOMBSITE_A ] ? ITEM_DISABLED : ITEM_ENABLED;
case 1: iRetVal = g_bBombSiteStatus[ BOMBSITE_B ] ? ITEM_DISABLED : ITEM_ENABLED;
case 2: iRetVal = g_bBombSiteStatus[ BOMBSITE_A ] ? ITEM_ENABLED : ITEM_DISABLED;
case 3: iRetVal = g_bBombSiteStatus[ BOMBSITE_B ] ? ITEM_ENABLED : ITEM_DISABLED;
case 4: iRetVal = g_bBombSiteStatus[ BOMBSITE_A ] && g_bBombSiteStatus[ BOMBSITE_B ] ? ITEM_DISABLED : ITEM_ENABLED;
case 5: iRetVal = g_bBombSiteStatus[ BOMBSITE_A ] || g_bBombSiteStatus[ BOMBSITE_B ] ? ITEM_ENABLED : ITEM_DISABLED;
}
return iRetVal;
}
public MenuHandler( id , iMenu , iItem )
{
if( iItem == MENU_EXIT )
{
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
set_hudmessage( 255 , 255 , 255 , -1.0 , 0.65 , 0 , 3.0 , 3.0 , .channel = -1 );
switch ( iItem )
{
case 0:
{
SetBombSiteLock( BOMBSITE_A , true );
show_hudmessage( 0 , "BombSite A has been Locked" );
}
case 1:
{
SetBombSiteLock( BOMBSITE_B , true );
show_hudmessage( 0 , "BombSite B has been Locked" );
}
case 2:
{
SetBombSiteLock( BOMBSITE_A , false );
show_hudmessage( 0 , "BombSite A has been Unlocked" );
}
case 3:
{
SetBombSiteLock( BOMBSITE_B , false );
show_hudmessage( 0 , "BombSite B has been Unlocked" );
}
case 4:
{
SetBombSiteLock( BOMBSITE_A , true );
SetBombSiteLock( BOMBSITE_B , true );
show_hudmessage( 0 , "BombSites A & B have both been Locked" );
}
case 5:
{
SetBombSiteLock( BOMBSITE_A , false );
SetBombSiteLock( BOMBSITE_B , false );
show_hudmessage( 0 , "BombSites A & B have both been Unlocked" );
}
}
menu_destroy( iMenu );
return PLUGIN_HANDLED;
}
public fw_HUDEntThink( iEntity )
{
if( g_bPlayerHoldingBomb && ( g_bBombSiteStatus[ BOMBSITE_A ] || g_bBombSiteStatus[ BOMBSITE_B ] ) && ( iEntity == g_iHUDEntity ) && is_user_alive( g_iPlayerWithBomb ) )
{
set_hudmessage( 255 , 255 , 255 , -1.0 , 0.87 , 0 , 1.0 , 1.0 , .channel = -1 );
show_hudmessage( g_iPlayerWithBomb , "BombSite%s %s%s%s %s Currently Locked!" , g_bBombSiteStatus[ BOMBSITE_A ] && g_bBombSiteStatus[ BOMBSITE_B ] ? "s" : "" ,
g_bBombSiteStatus[ BOMBSITE_A ] ? "A" : "" ,
g_bBombSiteStatus[ BOMBSITE_A ] && g_bBombSiteStatus[ BOMBSITE_B ] ? " & " : "" ,
g_bBombSiteStatus[ BOMBSITE_B ] ? "B" : "" ,
g_bBombSiteStatus[ BOMBSITE_A ] && g_bBombSiteStatus[ BOMBSITE_B ] ? "are" : "is" );
entity_set_float( g_iHUDEntity , EV_FL_nextthink , ( get_gametime() + 1.0 ) );
}
}
SetBombSiteLock( BombSites:bsBombSite , bool:bLockState )
{
entity_set_int( g_iBombSiteEntity[ bsBombSite ] , EV_INT_solid , bLockState ? SOLID_NOT : SOLID_TRIGGER );
g_bBombSiteStatus[ bsBombSite ] = bLockState;
if ( bLockState )
entity_set_float( g_iHUDEntity , EV_FL_nextthink , ( get_gametime() + 1.0 ) );
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
qe shoki edhe qeto qe munesh me ma kthy me ngjyra ama krejt ku ka color print jo do po do jo qe munes
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:ej njeri edhe qeto me mujt me ma bo me ngjyra se kjo tjetera supper o
client_print_color(id, print_chat, "[HPK] Ping checking disabled due to immunity...")
dmth edhe kjo kur te del me dal me ngjyra ngjyrat boni si kjo tjetra qe i ke bo :S btw flmm shumm 
http://www.mediafire.com/download/x0t0db...ghPing.zip Qe ku e ki
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:ej njeri edhe qeto me mujt me ma bo me ngjyra se kjo tjetera supper o
client_print_color(id, print_chat, "[HPK] Ping checking disabled due to immunity...")
dmth edhe kjo kur te del me dal me ngjyra ngjyrat boni si kjo tjetra qe i ke bo :S btw flmm shumm 
http://www.mediafire.com/download/x0t0db...ghPing.zip Qe ku e ki
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: /*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-08
*
* ============
* Changelog:
* ============
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/
#define VERSION "1.4d"
#include <amxmodx>
#include <amxmisc>
#define MAX_NOMINATED 20
#define MAX_TRIES 50
new configfile[200]
new menu[2000]
new keys
new g_teamScore[2]
new bool:voting
new votes[10]
new maps[9][32]
new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]
new mp_winlimit
new mp_maxrounds
new mp_timelimit
new extended_pcvar
new extendtime_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new extended
new cur_nextmap[32]
new cstrike
new bool:rtv[33]
new rtvtotal
new Float:voterocked
new bool:voterocked2
new num
new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}
new say_commands2[][32] =
{
"nominate",
"/nominate"
}
new lastmap[32]
new lastlastmap[32]
new currentmap[32]
public plugin_init()
{
register_plugin("Custom NextMap Chooser",VERSION,"GHW_Chronic")
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
register_cvar("map_enabled","1")
if(file_exists(configfile) && get_cvar_num("map_enabled"))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"Starts a vote for nextmap [1=allow extend(Default) | 0=Don't allow extend] [1=Change Now(Default) | 0=Change at End")
register_clcmd("say nextmap","saynextmap")
register_clcmd("say_team nextmap","saynextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")
cstrike = cstrike_running()
if(cstrike) register_event("TeamScore", "team_score", "a")
register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")
set_task(15.0,"Check_Endround",1337,"",0,"b")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
mp_timelimit = get_cvar_pointer("mp_timelimit")
extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","5")
lastmap_pcvar = register_cvar("map_lastmap_show","1")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","1")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","50")
rtv_wait_pcvar = register_cvar("map_rtv_wait","180")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","6")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","15")
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")
if(!cvar_exists("amx_nextmap")) register_cvar("amx_nextmap","")
get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}
public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}
public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
if(!voting)
{
num = get_pcvar_num(delay_time_pcvar)
if(num<1) num=1
new arg1[8] = "1"
new arg2[8] = "1"
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
}
}
client_print(0,print_chat,"[AMXX] An admin has started a nextmap vote! Vote starting in %d seconds.",num)
if(str_to_num(arg2)) voterocked2=true
else voterocked2=false
make_menu(str_to_num(arg1))
}
else
{
client_print(id,print_chat,"[AMXX] There is already a nextmap vote in progress.")
}
return PLUGIN_HANDLED
}
public make_menu(add_extend)
{
num = get_pcvar_num(delay_time_pcvar)
if(num<1) num=1
for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")
format(menu,1999,"^n")
new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]
for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1
format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}
new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && !equali(read,currentmap) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}
if(add_extend)
{
new mapname[32]
get_mapname(mapname,31)
if(extended<get_pcvar_num(extended_pcvar))
{
format(menu,1999,"%s^n^n9. Extend %s",menu,mapname)
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. I don't care",menu)
set_hudmessage(255,0,0,0.03,0.40,0,6.0,1.0,0.0,0.0,3)
show_hudmessage(0,"Vote for Next Map in %d seconds:",num)
set_hudmessage(255,255,255,0.03,0.40,0,6.0,1.0,0.0,0.0,4)
show_hudmessage(0,menu)
set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)
voting=true
voterocked=-1.0
}
public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,1.0,0.0,0.0,3)
show_hudmessage(0,"Vote for Next Map in %d seconds:",num-1)
set_hudmessage(255,255,255,0.03,0.40,0,6.0,1.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,"Vote for Next Map:%s",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}
public saynextmap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"[AMXX] --Nextmap: %s",cur_nextmap)
else client_print(0,print_chat,"[AMXX] --Nextmap not chosen yet.")
}
public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)
new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}
for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}
if(is_map_valid2(text)) return saynominate(id,text);
return PLUGIN_CONTINUE
}
public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"[AMXX] Voting Currently in Process.")
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"[AMXX] You have already voted to Rock the Vote.")
}
else
{
rtv[id]=true
rtvtotal++
new num2, players[32]
get_players(players,num2,"ch")
new name[32]
get_user_name(id,name,31)
new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)
if(num3<=0)
{
client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote.",name)
client_print(0,print_chat,"[AMXX] The Vote has been Rocked!")
make_menu(1)
voterocked2=true
}
else
{
if(num3!=1) client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote. Need %d more players.",name,num3)
else client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote. Need 1 more player.",name)
}
}
}
else
{
client_print(id,print_chat,"[AMXX] Rock the Vote is disabled.")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"[AMXX] Cannot Rock the Vote again for another %d seconds.",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"[AMXX] Cannot Rock the Vote till %d seconds after map start. (%d more seconds)",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}
return PLUGIN_CONTINUE
}
public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"[AMXX] You have already nominated a map.")
}
else if(is_map_valid2(nom_map))
{
if(equali(nom_map,currentmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the current map.")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the previous map.")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the previous to previous map.")
return PLUGIN_CONTINUE
}
for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(0,print_chat,"[AMXX] That map has already been nominated.")
return PLUGIN_CONTINUE
}
}
format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"[AMXX] %s nominated %s.",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(0,print_chat,"[AMXX] That map does not exist on this server.")
}
return PLUGIN_CONTINUE
}
public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;
return 0;
}
public Check_Endround()
{
if(voterocked==-1.0)
return ;
new bool:continuea=false
if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
continuea=true
}
}
new maxrounds = get_pcvar_num(mp_maxrounds)
if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
continuea=true
}
}
}
new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
{
continuea=true
}
if(!continuea)
return ;
remove_task(1337)
make_menu(1)
return ;
}
public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s voted for map extension.",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s didn't vote.",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s voted for %s.",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}
public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
if(!voterocked2)
{
new mapname[32]
get_cvar_string("qq_lastmap",mapname,31)
set_cvar_string("qq_lastlastmap",mapname)
get_mapname(mapname,31)
set_cvar_string("qq_lastmap",mapname)
client_print(0,print_chat,"[AMXX] No one voted. Random Map coming.")
}
else
{
client_print(0,print_chat,"[AMXX] No one voted.")
voterocked=get_gametime()
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"[AMXX] Map extending won. Extending map for %d minutes.",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"Check_Endround",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"[AMXX] Map extending won. No new map.")
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_cvar_string("qq_lastmap",mapname,31)
set_cvar_string("qq_lastlastmap",mapname)
get_mapname(mapname,31)
set_cvar_string("qq_lastmap",mapname)
client_print(0,print_chat,"[AMXX] Voting Over. Nextmap will be %s!",maps[winner[0]])
if(!voterocked2)
{
set_cvar_string("amx_nextmap",maps[winner[0]])
set_task(1.0,"change_level",winner[0],"",0,"d")
}
else
{
set_task(5.0,"change_level",winner[0])
}
format(cur_nextmap,31,"%s",maps[winner[0]])
}
for(new i=0;i<=32;i++) rtv[i]=false
voterocked2=false
}
public change_level(map)
{
server_cmd("amx_map %s",maps[map])
}
//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}
qe edhe kjo qe munesh me e bo te client_print ama te krejt dmth me kon me ngjyra  rrespekt je i madh nese i bon kto
[edit] KUJDES Ta ndreqa postin, tjera her e shti ne code scriptin jo kshtu si e ki postu, ose te fshihet[/edit]
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: /*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 05-16-08
*
* ============
* Changelog:
* ============
*
* v1.4e
* -is_map_valid() broken, hardcoded a bug fix.
*
* v1.4d
* -Bug Fixes
*
* v1.4c
* -nominate command changed
*
* v1.4b
* -GG Compadability Beta
*
* v1.4
* -Added Nominating
*
* v1.1 - 1.3
* -Bug Fixes
* -Added RTV
*
* v1.0
* -Initial Release
*
*/
#define VERSION "1.4d"
#include <amxmodx>
#include <amxmisc>
#define MAX_NOMINATED 20
#define MAX_TRIES 50
new configfile[200]
new menu[2000]
new keys
new g_teamScore[2]
new bool:voting
new votes[10]
new maps[9][32]
new num_nominated = 0
new nominated[MAX_NOMINATED][32]
new bool:has_nominated[33]
new mp_winlimit
new mp_maxrounds
new mp_timelimit
new extended_pcvar
new extendtime_pcvar
new lastmap_pcvar
new lastmap_was_pcvar
new lastlastmap_pcvar
new lastlastmap_was_pcvar
new showvotes_pcvar
new rtv_percent_pcvar
new rtv_wait_pcvar
new delay_time_pcvar
new delay_tally_time_pcvar
new extended
new cur_nextmap[32]
new cstrike
new bool:rtv[33]
new rtvtotal
new Float:voterocked
new bool:voterocked2
new num
new say_commands[][32] =
{
"rockthevote",
"rock the vote",
"rtv",
"/rockthevote",
"/rock the vote",
"/rtv"
}
new say_commands2[][32] =
{
"nominate",
"/nominate"
}
new lastmap[32]
new lastlastmap[32]
new currentmap[32]
public plugin_init()
{
register_plugin("Custom NextMap Chooser",VERSION,"GHW_Chronic")
get_configsdir(configfile,199)
format(configfile,199,"%s/custom_nextmaps.ini",configfile)
register_cvar("map_enabled","1")
if(file_exists(configfile) && get_cvar_num("map_enabled"))
{
register_concmd("amx_nextmap_vote","cmd_nextmap",ADMIN_MAP,"Starts a vote for nextmap [1=allow extend(Default) | 0=Don't allow extend] [1=Change Now(Default) | 0=Change at End")
register_clcmd("say nextmap","saynextmap")
register_clcmd("say_team nextmap","saynextmap")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")
cstrike = cstrike_running()
if(cstrike) register_event("TeamScore", "team_score", "a")
register_menucmd(register_menuid("CustomNextMap"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"VoteCount")
set_task(15.0,"Check_Endround",1337,"",0,"b")
if(cstrike)
{
mp_winlimit = get_cvar_pointer("mp_winlimit")
mp_maxrounds = get_cvar_pointer("mp_maxrounds")
}
mp_timelimit = get_cvar_pointer("mp_timelimit")
extended_pcvar = register_cvar("map_extend_max","3")
extendtime_pcvar = register_cvar("map_extend_time","5")
lastmap_pcvar = register_cvar("map_lastmap_show","1")
lastlastmap_pcvar = register_cvar("map_lastlastmap_show","1")
showvotes_pcvar = register_cvar("map_show_votes","1")
rtv_percent_pcvar = register_cvar("map_rtv_percent","50")
rtv_wait_pcvar = register_cvar("map_rtv_wait","180")
lastmap_was_pcvar = register_cvar("qq_lastmap","")
lastlastmap_was_pcvar = register_cvar("qq_lastlastmap","")
delay_time_pcvar = register_cvar("map_delay_time","6")
delay_tally_time_pcvar = register_cvar("map_tally_delay_time","15")
if(is_plugin_loaded("Nextmap Chooser")!=-1) pause("acd","mapchooser.amxx")
if(!cvar_exists("amx_nextmap")) register_cvar("amx_nextmap","")
get_pcvar_string(lastmap_was_pcvar,lastmap,31)
get_pcvar_string(lastlastmap_was_pcvar,lastlastmap,31)
get_mapname(currentmap,31)
}
}
public client_disconnect(id)
{
if(rtv[id])
{
rtv[id]=false
has_nominated[id]=false
rtvtotal--
}
}
public cmd_nextmap(id,level,cid)
{
if(!cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}
if(!voting)
{
num = get_pcvar_num(delay_time_pcvar)
if(num<1) num=1
new arg1[8] = "1"
new arg2[8] = "1"
if(read_argc()>=2)
{
read_argv(1,arg1,7)
if(read_argc()>=3)
{
read_argv(2,arg2,7)
}
}
client_print(0,print_chat,"[AMXX] An admin has started a nextmap vote! Vote starting in %d seconds.",num)
if(str_to_num(arg2)) voterocked2=true
else voterocked2=false
make_menu(str_to_num(arg1))
}
else
{
client_print(id,print_chat,"[AMXX] There is already a nextmap vote in progress.")
}
return PLUGIN_HANDLED
}
public make_menu(add_extend)
{
num = get_pcvar_num(delay_time_pcvar)
if(num<1) num=1
for(new i=0;i<10;i++) votes[i]=0
for(new i=0;i<9;i++) format(maps[i],31,"")
format(menu,1999,"^n")
new Fsize = file_size(configfile,1)
new read[32], trash, string[8]
new numbers[17]
for(new i=1;i<9;i++)
{
numbers[i]=0
numbers[17-i]=0
for(new i2=0;i2<Fsize;i2++)
{
read_file(configfile,i2,read,31,trash)
format(string,7,"[%d]",i)
if(equali(read,string)) numbers[i]=i2+1
format(string,7,"[/%d]",i)
if(equali(read,string)) numbers[17-i]=i2-1
}
}
new tries
keys = (1<<9)
new j
for(new i=1;i<9;i++)
{
format(maps[i],31,"")
if(numbers[i] && numbers[17-i] && numbers[17-i]-numbers[i]>=0)
{
tries=0
while(tries<MAX_TRIES)
{
read_file(configfile,random_num(numbers[i],numbers[17-i]),read,31,trash)
if(containi(read,"%nominated%")==0 && num_nominated>0) format(read,31,"%s",nominated[random_num(0,num_nominated - 1)])
if(is_map_valid(read) && !equali(read,currentmap) && (get_pcvar_num(lastmap_pcvar) || !equali(read,lastmap)) && (get_pcvar_num(lastlastmap_pcvar) || !equali(read,lastlastmap)))
{
for(j=1;j<i;j++)
{
if(equali(read,maps[j]))
{
j = 0
break;
}
}
if(!j) break;
format(maps[i],31,"%s",read)
format(menu,1999,"%s^n%d. %s",menu,i,read)
switch(i)
{
case 1: keys |= (1<<0)
case 2: keys |= (1<<1)
case 3: keys |= (1<<2)
case 4: keys |= (1<<3)
case 5: keys |= (1<<4)
case 6: keys |= (1<<5)
case 7: keys |= (1<<6)
case 8: keys |= (1<<7)
}
break;
}
tries++
}
}
}
if(add_extend)
{
new mapname[32]
get_mapname(mapname,31)
if(extended<get_pcvar_num(extended_pcvar))
{
format(menu,1999,"%s^n^n9. Extend %s",menu,mapname)
keys |= (1<<8)
}
}
format(menu,1999,"%s^n0. I don't care",menu)
set_hudmessage(255,0,0,0.03,0.40,0,6.0,1.0,0.0,0.0,3)
show_hudmessage(0,"Vote for Next Map in %d seconds:",num)
set_hudmessage(255,255,255,0.03,0.40,0,6.0,1.0,0.0,0.0,4)
show_hudmessage(0,menu)
set_task(1.0,"Send_Menu",0,"",0,"a",num)
set_task(get_pcvar_float(delay_tally_time_pcvar) + float(num),"VoteTally",0)
voting=true
voterocked=-1.0
}
public Send_Menu()
{
if(num!=1)
{
set_hudmessage(255,0,0,0.03,0.40,0,6.0,1.0,0.0,0.0,3)
show_hudmessage(0,"Vote for Next Map in %d seconds:",num-1)
set_hudmessage(255,255,255,0.03,0.40,0,6.0,1.0,0.0,0.0,4)
show_hudmessage(0,menu)
num--
}
else
{
client_cmd(0,"spk Gman/Gman_Choose2")
format(menu,1999,"Vote for Next Map:%s",menu)
show_menu(0,keys,menu,get_pcvar_num(delay_tally_time_pcvar),"CustomNextMap")
}
}
public saynextmap(id)
{
if(strlen(cur_nextmap)) client_print(0,print_chat,"[AMXX] --Nextmap: %s",cur_nextmap)
else client_print(0,print_chat,"[AMXX] --Nextmap not chosen yet.")
}
public say_hook(id)
{
new text[64]
read_args(text,63)
remove_quotes(text)
new string[32]
for(new i=0;i<sizeof(say_commands);i++)
{
format(string,31,"%s",say_commands[i])
if(containi(text,string)==0) return sayrockthevote(id);
}
for(new i=0;i<sizeof(say_commands2);i++)
{
format(string,31,"%s ",say_commands2[i])
if(containi(text,string)==0)
{
replace(text,63,string,"")
return saynominate(id,text);
}
}
if(is_map_valid2(text)) return saynominate(id,text);
return PLUGIN_CONTINUE
}
public sayrockthevote(id)
{
if(voterocked==-1.0)
{
client_print(id,print_chat,"[AMXX] Voting Currently in Process.")
}
else if((!voterocked && get_gametime()>get_pcvar_num(rtv_wait_pcvar)) || (get_gametime() - voterocked) > get_pcvar_num(rtv_wait_pcvar))
{
if(get_pcvar_num(rtv_percent_pcvar)>0 && get_pcvar_num(rtv_percent_pcvar)<=100)
{
if(rtv[id])
{
client_print(id,print_chat,"[AMXX] You have already voted to Rock the Vote.")
}
else
{
rtv[id]=true
rtvtotal++
new num2, players[32]
get_players(players,num2,"ch")
new name[32]
get_user_name(id,name,31)
new num3 = floatround((num2 * get_pcvar_float(rtv_percent_pcvar) / 100.0) - rtvtotal,floatround_ceil)
if(num3<=0)
{
client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote.",name)
client_print(0,print_chat,"[AMXX] The Vote has been Rocked!")
make_menu(1)
voterocked2=true
}
else
{
if(num3!=1) client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote. Need %d more players.",name,num3)
else client_print(0,print_chat,"[AMXX] %s has voted to Rock the Vote. Need 1 more player.",name)
}
}
}
else
{
client_print(id,print_chat,"[AMXX] Rock the Vote is disabled.")
}
}
else if(voterocked>0.0)
{
client_print(id,print_chat,"[AMXX] Cannot Rock the Vote again for another %d seconds.",get_pcvar_num(rtv_wait_pcvar) - (floatround(get_gametime()) - floatround(voterocked)))
}
else
{
client_print(id,print_chat,"[AMXX] Cannot Rock the Vote till %d seconds after map start. (%d more seconds)",get_pcvar_num(rtv_wait_pcvar),get_pcvar_num(rtv_wait_pcvar) - floatround(get_gametime()))
}
return PLUGIN_CONTINUE
}
public saynominate(id,nom_map[64])
{
if(has_nominated[id])
{
client_print(id,print_chat,"[AMXX] You have already nominated a map.")
}
else if(is_map_valid2(nom_map))
{
if(equali(nom_map,currentmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the current map.")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastmap_pcvar) && equali(nom_map,lastmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the previous map.")
return PLUGIN_CONTINUE
}
else if(!get_pcvar_num(lastlastmap_pcvar) && equali(nom_map,lastlastmap))
{
client_print(0,print_chat,"[AMXX] Cannot nominated the previous to previous map.")
return PLUGIN_CONTINUE
}
for(new i=0;i<num_nominated;i++)
{
if(equali(nominated[i],nom_map))
{
client_print(0,print_chat,"[AMXX] That map has already been nominated.")
return PLUGIN_CONTINUE
}
}
format(nominated[num_nominated],31,"%s",nom_map)
num_nominated++
new name[32]
get_user_name(id,name,31)
client_print(0,print_chat,"[AMXX] %s nominated %s.",name,nom_map)
has_nominated[id] = true
}
else
{
client_print(0,print_chat,"[AMXX] That map does not exist on this server.")
}
return PLUGIN_CONTINUE
}
public is_map_valid2(map[])
{
if(is_map_valid(map) &&
containi(map,"<")==-1 &&
containi(map,"\")==-1 &&
containi(map,"/")==-1 &&
containi(map,">")==-1 &&
containi(map,"?")==-1 &&
containi(map,"|")==-1 &&
containi(map,"*")==-1 &&
containi(map,":")==-1 &&
containi(map,"^"")==-1
)
return 1;
return 0;
}
public Check_Endround()
{
if(voterocked==-1.0)
return ;
new bool:continuea=false
if(cstrike)
{
new winlimit = get_pcvar_num(mp_winlimit)
if(winlimit)
{
new c = winlimit - 2
if(!((c> g_teamScore[0]) && (c>g_teamScore[1]) ))
{
continuea=true
}
}
new maxrounds = get_pcvar_num(mp_maxrounds)
if(maxrounds)
{
if(!((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1])))
{
continuea=true
}
}
}
new timeleft = get_timeleft()
if(!(timeleft < 1 || timeleft > 129))
{
continuea=true
}
if(!continuea)
return ;
remove_task(1337)
make_menu(1)
return ;
}
public VoteCount(id,key)
{
if(voting)
{
new name[32]
get_user_name(id,name,31)
if(key==8)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s voted for map extension.",name)
votes[9]++
}
else if(key==9)
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s didn't vote.",name)
}
else if(strlen(maps[key+1]))
{
if(get_pcvar_num(showvotes_pcvar)) client_print(0,print_chat,"[AMXX] %s voted for %s.",name,maps[key+1])
votes[key+1]++
}
else
{
show_menu(id,keys,menu,-1,"CustomNextMap")
}
}
return PLUGIN_HANDLED
}
public VoteTally(num)
{
voting=false
new winner[2]
for(new i=1;i<10;i++)
{
if(votes[i]>winner[1])
{
winner[0]=i
winner[1]=votes[i]
}
votes[i]=0
}
if(!winner[1])
{
if(!voterocked2)
{
new mapname[32]
get_cvar_string("qq_lastmap",mapname,31)
set_cvar_string("qq_lastlastmap",mapname)
get_mapname(mapname,31)
set_cvar_string("qq_lastmap",mapname)
client_print(0,print_chat,"[AMXX] No one voted. Random Map coming.")
}
else
{
client_print(0,print_chat,"[AMXX] No one voted.")
voterocked=get_gametime()
}
}
else if(winner[0]==9)
{
if(!voterocked2)
{
client_print(0,print_chat,"[AMXX] Map extending won. Extending map for %d minutes.",get_pcvar_num(extendtime_pcvar))
set_pcvar_float(mp_timelimit,get_pcvar_float(mp_timelimit) + get_pcvar_num(extendtime_pcvar))
set_task(15.0,"Check_Endround",1337,"",0,"b")
extended++
}
else
{
client_print(0,print_chat,"[AMXX] Map extending won. No new map.")
}
voterocked=get_gametime()
}
else
{
new mapname[32]
get_cvar_string("qq_lastmap",mapname,31)
set_cvar_string("qq_lastlastmap",mapname)
get_mapname(mapname,31)
set_cvar_string("qq_lastmap",mapname)
client_print(0,print_chat,"[AMXX] Voting Over. Nextmap will be %s!",maps[winner[0]])
if(!voterocked2)
{
set_cvar_string("amx_nextmap",maps[winner[0]])
set_task(1.0,"change_level",winner[0],"",0,"d")
}
else
{
set_task(5.0,"change_level",winner[0])
}
format(cur_nextmap,31,"%s",maps[winner[0]])
}
for(new i=0;i<=32;i++) rtv[i]=false
voterocked2=false
}
public change_level(map)
{
server_cmd("amx_map %s",maps[map])
}
//From the AMXX nextmap base file
public team_score()
{
new team[2]
read_data(1,team,1)
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}
qe edhe kjo qe munesh me e bo te client_print ama te krejt dmth me kon me ngjyra  rrespekt je i madh nese i bon kto
[edit] KUJDES Ta ndreqa postin, tjera her e shti ne code scriptin jo kshtu si e ki postu, ose te fshihet[/edit]
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 qe ku e ki edhe .amxx edhe .sma
http://www.mediafire.com/download/ae7e3q...extMap.rar Me ngjyra osht , qa ki najsen problem kallzo
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 qe ku e ki edhe .amxx edhe .sma
http://www.mediafire.com/download/ae7e3q...extMap.rar Me ngjyra osht , qa ki najsen problem kallzo
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 & http://www.amxmodx.org/forums for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621
*
* 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 kishtit mujt me bo complie qeshtu qysh o te krejt color_prit se spo bon complie kurrqysh me bo ?
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 & http://www.amxmodx.org/forums for lots of
* information, and good advice!!
*
* Plugin Topic:
* [AMX] http://djeyl.net/forum/index.php?showtopic=27801
* [AMXX] http://www.amxmodx.org/forums/viewtopic.php?t=621
*
* 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 kishtit mujt me bo complie qeshtu qysh o te krejt color_prit se spo bon complie kurrqysh me bo ?
Thanks given by:
Thanks given by:
Thanks given by:
|