// // Team Flash Notification and Logger // *XYZ*SaYnt // block config { // duration of a flash under which a player is not considered blind. // in seconds. es_xsetinfo TF_DURATIONLIMIT 0.75 } //====================do not edit below this line=========================== block load { es_xsetinfo TF_VERSION 1.1 // import the user's configs es_xdoblock tflash/config es_keygroupcreate TF_FLASHED es_xsetinfo TF_ALPHA 0 es_xsetinfo TF_TEAM 0 es_xsetinfo TF_DURATION 0 es_xsetinfo TF_FLASHED_PLAYER 0 es_xsetinfo TF_FLASHED_NAME 0 es_xsetinfo TF_DEAD 0 es_msg TFlash server_var(TF_VERSION) "by *XYZ*SaYnt loaded." } block unload { es_keygroupdelete TF_FLASHED } // ASSUMPTION.....FLASHBANG DETONATE HAPPENS VERY QUICKLY AFTER PLAYER BLIND. event player_blind { // add blinded players to a keygroup; userid is the key, // store: team, flash magnitude, and flash duration. // and only store if flash magnitude is high (255) es_getplayerprop TF_DEAD event_var(userid) "CCSPlayer.baseclass.pl.deadflag" if (server_var(TF_DEAD) == 0) do { es_getplayerprop TF_ALPHA event_var(userid) "CCSPlayer.m_flFlashMaxAlpha" if (server_var(TF_ALPHA) == 255) do { es_getplayerprop TF_DURATION event_var(userid) "CCSPlayer.m_flFlashDuration" if (server_var(TF_DURATION) > server_var(TF_DURATIONLIMIT)) do { es_keycreate TF_FLASHED event_var(userid) es_keysetvalue TF_FLASHED event_var(userid) team event_var(es_userteam) es_keysetvalue TF_FLASHED event_var(userid) duration server_var(TF_DURATION) } } } // as a check, loop through the keygroup here. //es_foreachkey TF_FLASHED_PLAYER in TF_FLASHED "es_xdoblock tflash/tfreport" } event flashbang_detonate { // we already have a list of players that were just blinded, so we loop through // that list and see if any were on our team. es_foreachkey TF_FLASHED_PLAYER in TF_FLASHED "es_xdoblock tflash/tfcheck" es_keygroupdelete TF_FLASHED es_keygroupcreate TF_FLASHED } block tfcheck { es_keygetvalue TF_TEAM TF_FLASHED server_var(TF_FLASHED_PLAYER) team if (event_var(es_userteam) == server_var(TF_TEAM)) do { es_keygetvalue TF_DURATION TF_FLASHED server_var(TF_FLASHED_PLAYER) duration if (event_var(userid) == server_var(TF_FLASHED_PLAYER)) do { es_tell server_var(TF_FLASHED_PLAYER) "[FT] You just flashed yourself for " server_var(TF_DURATION) " seconds." es statlog event_var(userid) Self_Flasher } else do { // tattle. es_tell server_var(TF_FLASHED_PLAYER) "[FT] You were just teamflashed for " server_var(TF_DURATION) " seconds by " event_var(es_username) es_getplayername TF_FLASHED_NAME server_var(TF_FLASHED_PLAYER) es_tell event_var(userid) "[FT] You just teamflashed " server_var(TF_FLASHED_NAME) " for " server_var(TF_DURATION) "seconds." es statlog event_var(userid) Team_Flasher es statlog server_var(TF_FLASHED_PLAYER) Team_Flashee } } } block tfreport { es_msg REPORT: server_var(TF_FLASHED_PLAYER) has been blinded }