#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#define PLUGIN "Anti-Rush"
#define AUTHOR "Kiki33"
#define VERSION "1.0"
#define PREFIX "S~T~G"
#define TASK 500743
#define TASK2 541246
new bool:rushmehet
new g_screenfade, MessageSay;
new kor_indult=0;
new Float:TESZTELES=0.1
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("Rush Vedo", "By kiki33", FCVAR_SERVER)
g_screenfade = get_user_msgid("ScreenFade")
MessageSay = get_user_msgid ("SayText")
new mapname[10]
get_mapname(mapname,9)
if(equali(mapname, "de_dust2")) {
register_logevent( "eRound_start", 2, "1=Round_Start" );
register_event("SendAudio", "bomb_planted", "a", "2&%!MRAD_BOMBPL")
register_logevent("eRoundEnd", 2, "1=Round_End")
set_task(TESZTELES, "kordinata", TASK, "", 0, "b")
}
}
public eRoundEnd() {
kor_indult=0
rushmehet=false
if(task_exists(TASK2)) remove_task(TASK2)
}
public eRound_start() {
kor_indult=0
rushmehet=false;
kor_indult++
if(task_exists(TASK2)) remove_task(TASK2)
set_task(60.0, "rush_mehet", TASK2)
new players[32], num
get_players(players,num)
for(new i = 0; i < num; i++) {
if(cs_get_user_team(players[i]) == CS_TEAM_CT) colored_print(players[i], "!g[%s] !tTilos !ya rusholás 60 másodpercig!", PREFIX)
}
}
public bomb_planted() {
remove_task(TASK2)
rush_mehet()
rushmehet=true;
}
public kordinata() {
if(rushmehet == true) return
new playerek[32], pnum,tt_num,ct_num
get_players(playerek,pnum)
for(new i=0;i<pnum;i++) {
if(is_user_alive(playerek[i])) {
if(cs_get_user_team(playerek[i])==CS_TEAM_T) tt_num++
else if(cs_get_user_team(playerek[i])==CS_TEAM_CT) ct_num++
}
}
if (tt_num<=2) {
rush_mehet()
return
}
if (ct_num<=2) {
rush_mehet()
return
}
new players[32], num
get_players(players,num)
for(new i = 0; i < num; i++) {
new origin[3];
get_user_origin(players[i], origin, 0)
if(cs_get_user_team(players[i]) == CS_TEAM_CT && kor_indult==1 && is_user_alive(players[i])) {
if(origin[0] <= -144 && origin[0] >= -500 && origin[1] <= 800 && origin[1] >= 700 && origin[2] >= -150 && origin[2] <= 900 ||
origin[0] <= 720 && origin[0] >= 500 && origin[1] <= 744 && origin[1] >= 610 && origin[2] >= 1 && origin[2] <= 200 ||
origin[0] <= -1610 && origin[0] >= -1720 && origin[1] <= 948 && origin[1] >= 848 && origin[2] >= 50 && origin[2] <= 200)
{
new Float: velocity[3]
new Float: DW
pev(players[i],pev_velocity,velocity)
DW=vector_length ( velocity )+0.0001
velocity[0]=(velocity[0]/DW)*(-500.0)
velocity[1]=(velocity[1]/DW)*(-500.0)
if(velocity[2]<0) velocity[2]=velocity[2]*(-1.0)+15.0
set_pev(players[i],pev_velocity,velocity)
message_begin(MSG_ONE_UNRELIABLE, g_screenfade, {0,0,0}, players[i])
write_short(1<<12)
write_short(5)
write_short(0x0000)
write_byte(255)
write_byte(255)
write_byte(255)
write_byte(255)
message_end()
}
if(origin[0] <= -144 && origin[0] >= -500 && origin[1] <= 640 && origin[1] >= 540 && origin[2] >= -150 && origin[2] <= 900 ||
origin[0] <= 720 && origin[0] >= 500 && origin[1] <= 584 && origin[1] >= 450 && origin[2] >= 1 && origin[2] <= 200 ||
origin[0] <= -1610 && origin[0] >= -1720 && origin[1] <= 798 && origin[1] >= 698 && origin[2] >= 50 && origin[2] <= 200)
{
user_silentkill(players[i])
client_print(players[i], print_chat, "TILOS a bug, ezért meghaltál!");
}
}
}
}
public rush_mehet() {
if(kor_indult<1) return
remove_task(TASK2)
kor_indult=0
rushmehet = true;
new players[32], num
get_players(players,num)
for(new i = 0; i < num; i++) {
if(is_user_connected(players[i])) colored_print(players[i], "!g[%s] !yA !tCounter-Terroristák !yrusholhatnak.", PREFIX)
}
}
public client_disconnect(id) {
remove_task(id)
return PLUGIN_HANDLED
}
stock colored_print ( const index, const input [ ], any:... )
{
new sz_Message [ 191 ]
vformat ( sz_Message, charsmax ( sz_Message ), input, 3 )
replace_all ( sz_Message, charsmax ( sz_Message ), "!g", "^4" )
replace_all ( sz_Message, charsmax ( sz_Message ), "!t", "^3" )
replace_all ( sz_Message, charsmax ( sz_Message ), "!y", "^1" )
new i_Players [ 32 ]
new i_Count
i_Count = 1
if ( index )
{
i_Players [ 0 ] = index
}
else
{
get_players ( i_Players, i_Count, "ch" )
}
new i_Number
for ( i_Number = 0; i_Number < i_Count; i_Number ++ )
{
if ( is_user_connected ( i_Players [ i_Number ] ) )
{
message_begin ( MSG_ONE_UNRELIABLE, MessageSay, _, i_Players [ i_Number ] )
write_byte ( i_Players [ i_Number ] )
write_string ( sz_Message )
message_end ( )
}
}
}