Help with my Anti Team Flash Script
I was wondering if someone could help me out with this script, all it does it remove the ability to team flash admins in the server.
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta>
#define PLUGIN "No Admin Flash" #define VERSION "1.0" #define AUTHOR "Grim" /* credit to KRoT@L */
#define GOT_ACCES ADMIN_LEVEL_B
new g_msgScreenFade, grenade[32], last; new Float:g_gametime, g_owner; new g_sync_check_data = 0; new Float:g_gametime2; new bool:g_track[33] = false; new bool:g_track_enemy = false;
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199") register_event("TextMsg", "fire_in_the_hole", "b", "2&#Game_radio", "4&#Fire_in_the_hole") register_event("TextMsg", "fire_in_the_hole2", "b", "3&#Game_radio", "5&#Fire_in_the_hole") register_event("99", "grenade_throw", "b") }
/// NoFlash Blinding - Start public bad_fix2() { new Float:gametime = get_gametime() if(gametime - g_gametime2 > 2.5) { for(new i = 0; i < 32; i++) { grenade[i] = 0 } } }
public eventFlash(id) { new Float:gametime = get_gametime() if(gametime != g_gametime) { g_owner = get_grenade_owner() g_gametime = gametime for(new i = 0; i < 33; i++) { g_track[i] = false } g_track_enemy = false } if(is_user_connected(g_owner) && get_user_flags(id) & GOT_ACCES) { g_track_enemy = true
message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id) write_short(1) write_short(1) write_short(1) write_byte(0) write_byte(0) write_byte(0) write_byte(255) message_end() } }
public flash_delay() { if(g_track_enemy == false) for(new i = 0; i < 33; i++) if(g_track[i] == true && is_user_connected(i)) { message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, i) write_short(1) write_short(1) write_short(1) write_byte(0) write_byte(0) write_byte(0) write_byte(255) message_end() } }
public grenade_throw() { if(g_sync_check_data == 0) return PLUGIN_CONTINUE g_sync_check_data--; if(read_datanum() < 2) return PLUGIN_HANDLED_MAIN
if(read_data(1) == 11 && (read_data(2) == 0 || read_data(2) == 1)) { add_grenade_owner(last) }
return PLUGIN_CONTINUE }
public fire_in_the_hole() { new name[32] read_data(3, name, 31) new temp_last = get_user_index(name) new junk if((temp_last == 0) || (!is_user_connected(temp_last))) return PLUGIN_CONTINUE; if(get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) { last = temp_last g_sync_check_data = 2; } return PLUGIN_CONTINUE }
public fire_in_the_hole2() { new name[32] read_data(4, name, 31) new temp_last = get_user_index(name) new junk if((temp_last == 0) || (!is_user_connected(temp_last))) return PLUGIN_CONTINUE; if(get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) { last = temp_last g_sync_check_data = 2; } return PLUGIN_CONTINUE }
add_grenade_owner(owner) { new Float:gametime = get_gametime() g_gametime2 = gametime for(new i = 0; i < 32; i++) { if(grenade[i] == 0) { grenade[i] = owner return } } }
get_grenade_owner() { new which = grenade[0] for(new i = 1; i < 32; i++) { grenade[i-1] = grenade[i] } grenade[31] = 0 return which }
//from XxAvalanchexX "Flashbang Dynamic Light" public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) { // not a flashbang exploding if(!equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav")) return FMRES_IGNORED;
new Float:gametime = get_gametime()
//in case no one got flashed, the sound happens after all the flashes, same game time if(gametime != g_gametime) { g_owner = get_grenade_owner() return FMRES_IGNORED; }
return FMRES_IGNORED; }
|