
Стаж: 13 лет
Сообщений: 727
Благодарностей: 408
Полезность: 504
|
Ниже под спойлер я прикреплю разные версии из соответствующих источников исходные коды... Вновь заинтересовался для админов авто-помошником для админов, где они могли бы подглядывать за ВХ. Подскажите в чем отличия и какая лучше для PUBLIC? Т.е. более стабильная, оптимизированная и тд. Или это всё старьё и лучше переписать заного...? Нужны советы только опытных скриптеров/кодеров, флудеров просьба мимо... 1. версия, не помню в каком посту её обновили до 1.5b: Тема 1.3 на Оленях.Код:
AMX Mod X - Script * * Admin Spectator ESP v1.4_beta * Copyright © 2006 by KoST * * this plugin along with its compiled version can de downloaded here: * http://forums.alliedmods.net/showthread.php?t=23691 * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * or download here: http://www.gnu.org/licenses/gpl.txt * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ //--------------------------------------------------------------------------------------------------
#include <amxmodx> #include <fakemeta>
// Here you can adjust the required admin level if needed // there is a list of all levels http://www.amxmodx.org/funcwiki.php?go=mod...d=1#const_admin
#define REQUIRED_ADMIN_LEVEL ADMIN_BAN
//--------------------------------------------------------------------------------------------------
#define PLUGIN "Admin ESP" #define VERSION "1.5b_mini" #define AUTHOR "KoST"
#define OFFSET_TEAM 114
new const g_szPlugin[] = PLUGIN; // Global this since it is used throughout new pcvar_esp, pcvar_esp_timer, pcvar_esp_allow_all, pcvar_esp_disable_default_keys; new team_colors[4][3] = {{0,0,0}, {150,0,0}, {0,0,150}, {0,150,0}}; new esp_colors[5][3] = {{0,255,0}, {100,60,60}, {60,60,100}, {255,0,255}, {128,128,128}}; new bool:admin[33]; // is/is not admin new bool:first_person[33]; // is/is not in first person view new bool:ducking[33]; // is/is not player ducked new bool:mode[33]; // 0 = line, 1 = box new bool:enabled[33]; // has esp on new spec[33]; // spec[player_id]=the players id if new laser; // precached model new max_players; // if you start hlds with +maxplayers 20 for example this would be 20 new damage_done_to[33]; // damage_done_to[p1]=p2 // p1 has hit p2 new view_target[33]; // attackers victim
public plugin_precache() { laser = precache_model("sprites/laserbeam.spr"); }
public plugin_init() { register_plugin(g_szPlugin, VERSION, AUTHOR); server_print("^n^t%s v%s, Copyright © 2006 by %s^n", g_szPlugin, VERSION, AUTHOR);
// cvars pcvar_esp = register_cvar("esp", "1"); pcvar_esp_timer = register_cvar("esp_timer", "0.4"); pcvar_esp_allow_all = register_cvar("esp_allow_all", "0"); pcvar_esp_disable_default_keys = register_cvar("esp_disable_default_keys", "0"); register_cvar("aesp_version", VERSION, FCVAR_SERVER|FCVAR_UNLOGGED|FCVAR_SPONLY);
// client commands register_clcmd("esp_mode", "cmd_esp_mode", REQUIRED_ADMIN_LEVEL, "Toggle ESP type: line/box"); register_clcmd("say /esp_mode", "cmd_esp_mode", REQUIRED_ADMIN_LEVEL, "Toggle ESP type: line/box"); register_clcmd("esp_toggle", "cmd_esp_toggle", REQUIRED_ADMIN_LEVEL, "Toggle ESP on/off"); register_clcmd("say /esp_toggle", "cmd_esp_toggle", REQUIRED_ADMIN_LEVEL, "Toggle ESP on/off");
// events register_event("StatusValue", "spec_target", "bd", "1=2"); register_event("SpecHealth2", "spec_target", "bd"); register_event("TextMsg", "spec_mode", "b", "2&#Spec_Mode"); register_event("Damage", "event_Damage", "b", "2!0", "3=0", "4!0"); register_event("ResetHUD", "reset_hud_alive", "be");
register_forward(FM_PlayerPreThink, "fwdPlayerPreThink"); max_players = get_maxplayers(); // start esp_timer for the first time set_task(1.0, "esp_timer"); }
public client_putinserver(id) { first_person[id] = false; new args[1]; args[0] = id; set_task(4.0, "delayed_putinserver", id + 100, args, 1); }
public delayed_putinserver(args[0]) { new id = args[0]; if (!is_user_connected(id)) { return PLUGIN_HANDLED; } if ((get_user_flags(id) & REQUIRED_ADMIN_LEVEL) || get_pcvar_num(pcvar_esp_allow_all) == 1) { admin[id] = true; init_admin_options(id); } else { admin[id] = false; } return PLUGIN_CONTINUE; }
public client_disconnect(id) { save2vault(id); admin[id] = false; spec[id] = 0; remove_task(id + 100); }
public reset_hud_alive(id) { spec[id] = 0; }
public cmd_esp_toggle(id) { if (admin[id] && get_pcvar_num(pcvar_esp) == 1) { change_esp_status(id, !enabled[id]); } }
public cmd_esp_mode(id) { if (admin[id] && get_pcvar_num(pcvar_esp) == 1) { change_esp_mode(id, !mode[id]); } }
public event_Damage(id) { if (id>0) { new attacker = get_user_attacker(id) if (attacker > 0 && attacker <= max_players) { if (view_target[attacker] == id) { damage_done_to[attacker] = id; } } } return PLUGIN_CONTINUE; }
public spec_mode(id) { // discover if in first_person_view new specMode[12] read_data(2, specMode, 11); if(equal(specMode, "#Spec_Mode4")) { first_person[id] = true; } else { first_person[id] = false; } return PLUGIN_CONTINUE; }
public spec_target(id) { if (id > 0) { new target = read_data(2); if (target != 0) { spec[id] = target; } } return PLUGIN_CONTINUE; }
init_admin_options(id) { mode[id] = false; enabled[id] = true; load_vault_data(id); }
save2vault(id) { if (admin[id]) { new authid[35]; get_user_authid (id,authid,34); new tmp[3]; tmp[0] = (mode[id]) ? '1' : '0'; tmp[1] = (enabled[id]) ? '1' : '0'; //server_print("STEAMID: %s OPTIONS: %s", authid, tmp); new key[41]; formatex(key, 40, "AESPmini_%s", authid); set_vaultdata(key, tmp); } }
load_vault_data(id) { if (admin[id]) { new data[3]; new authid[35]; get_user_authid (id,authid,34); new key[41]; formatex(key,40, "AESPmini_%s", authid); get_vaultdata(key,data,2); if (strlen(data) > 0) { mode[id] = (data[0]=='1'); enabled[id] = (data[1]=='1'); } } }
change_esp_status(id, bool:on) { if (on) { enabled[id] = true; client_print(id, print_chat, "[%s] ON", g_szPlugin); } else { enabled[id] = false; client_print(id, print_chat, "[%s] OFF", g_szPlugin); } }
change_esp_mode(id, bool:on) { if (on) { mode[id] = true; client_print(id, print_chat, "[%s] Mode: Box", g_szPlugin); } else { mode[id] = false; client_print(id, print_chat, "[%s] Mode: Line", g_szPlugin); } }
public fwdPlayerPreThink(id) { if (!is_user_connected(id)) return FMRES_IGNORED; static button; button = pev(id, pev_button); if (button==0) return FMRES_IGNORED; // saves a lot of cpu static oldbutton; oldbutton = pev(id, pev_oldbuttons); if (button & IN_DUCK) { ducking[id] = true; } else { ducking[id] = false; } if ((get_pcvar_num(pcvar_esp) == 1) && (get_pcvar_num(pcvar_esp_disable_default_keys) != 1)) { if (admin[id]) { if (first_person[id] && !is_user_alive(id)) { if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD)) { cmd_esp_mode(id); } if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD) && !enabled[id]) { change_esp_status(id, true); } if ((button & IN_BACK) && !(oldbutton & IN_BACK) && enabled[id]) { change_esp_status(id, false); } } } } return FMRES_HANDLED; }
public esp_timer() { if (get_pcvar_num(pcvar_esp) != 1) { // if esp is not 1, it is off set_task(1.0, "esp_timer"); // check for reactivation in 1 sec intervals return PLUGIN_CONTINUE; }
static spec_id, Float:my_origin[3], my_team, s, target_team, Float:target_origin[3], Float:distance, width, Float:v_middle[3], Float:v_hitpoint[3], Float:distance_to_hitpoint, Float:scaled_bone_len, Float:scaled_bone_width, Float:v_bone_start[3], Float:v_bone_end[3], Float:offset_vector[3], Float:eye_level[3], Float:distance_target_hitpoint, actual_bright, color
for (new i = 1; i <= max_players; i++) { // loop through players if (enabled[i] && first_person[i] && is_user_connected(i) && admin[i] && (!is_user_alive(i)) && (spec[i] > 0) && is_user_alive(spec[i])) { // <img src='http://forum.myarena.ru/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' /> spec_id = spec[i]; pev(i, pev_origin, my_origin); // get origin of spectating admin // get team of spectated <img src='http://forum.myarena.ru/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' /> my_team = get_pdata_int(spec_id, OFFSET_TEAM); for (s = 1; s <= max_players; s++) { // loop through the targets if (is_user_alive(s)) { // target must be alive // get team of target target_team = get_pdata_int(s, OFFSET_TEAM); if (!(target_team == 3)) { //if not spectator if (spec_id != s) { // do not target myself // if the target is in the other team and not spectator if (((my_team != target_team && (target_team == 1 || target_team == 2)) )) { // get origin of target pev(s, pev_origin, target_origin); // get distance from me to target distance = vector_distance(my_origin, target_origin); if (!mode[i]) { // Draw LINE? // calculate width according to distance width = (distance < 2040.0) ? ( (255 - floatround(distance / 8.0) ) / 3 ) : 1;
// create temp_ent make_TE_BEAMENTPOINT(i, target_origin, width, target_team); }
// get vector from me to target subVec(target_origin, my_origin, v_middle);
// trace from me to target, getting hitpoint engfunc(EngFunc_TraceLine, my_origin, target_origin, 1, -1, 0); get_tr2(0, TR_vecEndPos, v_hitpoint);
// get distance from me to hitpoint (nearest wall) distance_to_hitpoint = vector_distance(my_origin, v_hitpoint);
// scale if (ducking[spec_id]) { scaled_bone_len = distance_to_hitpoint / distance * (50.0-18.0); } else { scaled_bone_len = distance_to_hitpoint / distance * 50.0; } scaled_bone_len = distance_to_hitpoint / distance * 50.0; scaled_bone_width = distance_to_hitpoint / distance * 150.0;
// get the point 10.0 units away from wall normalize(v_middle, offset_vector, distance_to_hitpoint - 10.0); // offset from wall
// set to eye level copyVec(my_origin, eye_level); if (ducking[spec_id]) { eye_level[2] += 12.3 } else { eye_level[2] += 17.5 }
addVec(offset_vector, eye_level);
// start and end of green box copyVec(offset_vector, v_bone_start); copyVec(offset_vector, v_bone_end); v_bone_end[2] -= scaled_bone_len;
distance_target_hitpoint = distance - distance_to_hitpoint; actual_bright = 255;
if (mode[i]) { // Draw BOX? // this is to make green box darker if distance is larger if (distance_target_hitpoint < 2040.0) { actual_bright = (255 - floatround(distance_target_hitpoint / 12.0)); } else { actual_bright = 85; } if (distance_to_hitpoint != distance) { // if no line of sight color = 0; } else { // if line of sight color = target_team; } if (damage_done_to[spec_id] == s) { color = 3; damage_done_to[spec_id] = 0; } make_TE_BEAMPOINTS(i, color, v_bone_start, v_bone_end, floatround(scaled_bone_width), actual_bright); } } } } } } // inner player loop end } } set_task(get_pcvar_float(pcvar_esp_timer), "esp_timer"); // keep it going return PLUGIN_CONTINUE; }
// Vector Operations -------------------------------------------------------------------------------
Float:getVecLen(Float:Vec[3]) { new Float:VecNull[3] = {0.0,0.0,0.0}; new Float:len = vector_distance(Vec, VecNull); return len; }
normalize(Float:Vec[3], Float:Ret[3], Float:multiplier) { new Float:len = getVecLen(Vec); copyVec(Vec, Ret); Ret[0] /= len; Ret[1] /= len; Ret[2] /= len; Ret[0] *= multiplier; Ret[1] *= multiplier; Ret[2] *= multiplier; }
copyVec(Float:Vec[3], Float:Ret[3]) { Ret[0] = Vec[0]; Ret[1] = Vec[1]; Ret[2] = Vec[2]; }
subVec(Float:Vec1[3], Float:Vec2[3], Float:Ret[3]) { Ret[0] = Vec1[0] - Vec2[0]; Ret[1] = Vec1[1] - Vec2[1]; Ret[2] = Vec1[2] - Vec2[2]; }
addVec(Float:Vec1[3], Float:Vec2[3]) { Vec1[0] += Vec2[0]; Vec1[1] += Vec2[1]; Vec1[2] += Vec2[2]; }
// Temporary Entities ------------------------------------------------------------------------------ // there is a list of much more temp entities at: http://djeyl.net/forum/index.php?act=Attac...t&id=290870 // all messages are sent with MSG_ONE_UNRELIABLE flag to avoid overflow in case of very low esp_timer setting and much targets
make_TE_BEAMPOINTS(id,color, Float:Vec1[3], Float:Vec2[3], width, brightness) { message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0,0,0}, id); //message begin write_byte(0); write_coord(floatround(Vec1[0])); // start position write_coord(floatround(Vec1[1])); write_coord(floatround(Vec1[2])); write_coord(floatround(Vec2[0])); // end position write_coord(floatround(Vec2[1])); write_coord(floatround(Vec2[2])); write_short(laser); // sprite index write_byte(3); // starting frame write_byte(0); // frame rate in 0.1's write_byte(floatround(get_pcvar_float(pcvar_esp_timer) * 10)); // life in 0.1's write_byte(width); // line width in 0.1's write_byte(0); // noise amplitude in 0.01's write_byte(esp_colors[color][0]); write_byte(esp_colors[color][1]); write_byte(esp_colors[color][2]); write_byte(brightness); // brightness) write_byte(0); // scroll speed in 0.1's message_end(); }
make_TE_BEAMENTPOINT(id, Float:target_origin[3], width, target_team) { message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0,0,0}, id); write_byte(1); write_short(id); write_coord(floatround(target_origin[0])); write_coord(floatround(target_origin[1])); write_coord(floatround(target_origin[2])); write_short(laser); write_byte(1); write_byte(1); write_byte(floatround(get_pcvar_float(pcvar_esp_timer) * 10)); write_byte(width); write_byte(0); write_byte(team_colors[target_team][0]); write_byte(team_colors[target_team][1]); write_byte(team_colors[target_team][2]); write_byte(255); write_byte(0); message_end(); } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par } */ 2. от ConnorMcLeod: Пост 519 от ConnorMcLeod в теме 1.3 на Оленях.версия до 800 строк + добавлены со строк 85-90 какие-то оружия Код:
/* AMX Mod X - Script * * Admin Spectator ESP v1.4_beta * Copyright © 2006 by KoST * * this plugin along with its compiled version can de downloaded here: * http://forums.alliedmods.net/showthread.php?t=23691 * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * or download here: http://www.gnu.org/licenses/gpl.txt * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ //--------------------------------------------------------------------------------------------------
#include <amxmodx> #include <fakemeta>
// Here you can adjust the required admin level if needed // there is a list of all levels http://www.amxmodx.org/funcwiki.php?go=mod...d=1#const_admin
#define REQUIRED_ADMIN_LEVEL ADMIN_RCON
//--------------------------------------------------------------------------------------------------
#define PLUGIN "Admin Spectator ESP" #define VERSION "fm_1.5_beta" #define AUTHOR "KoST"
#define OFFSET_TEAM 114
enum { ESP_ON=0, ESP_LINE, ESP_BOX, ESP_NAME, ESP_HEALTH_ARMOR, ESP_WEAPON, ESP_CLIP_AMMO, ESP_DISTANCE, ESP_TEAM_MATES, ESP_AIM_VEC, }
new bool:admin[33] // is/is not admin new bool:first_person[33] //is/is not in first person view new spec[33] // spec[player_id]=the players id if new laser // precached model new max_players // if you start hlds with +maxplayers 20 for example this would be 20 new team_colors[4][3]={{0,0,0},{150,0,0},{0,0,150},{0,150,0}} new esp_colors[5][3]={{0,255,0},{100,60,60},{60,60,100},{255,0,255},{128,128,128}} new bool:ducking[33] //is/is not player ducked new damage_done_to[33] //damage_done_to[p1]=p2 // p1 has hit p2 new view_target[33] // attackers victim new bool:admin_options[33][10] // individual esp options new bool:is_in_menu[33] // has esp menu open new pcvar_esp new pcvar_esp_timer new pcvar_esp_allow_all new pcvar_esp_disable_default_keys
// weapon strings new weapons[30][10]={"None","P228","Scout","HE","XM1014","C4", "MAC-10","AUG","Smoke","Elite","Fiveseven", "UMP45","SIG550","Galil","Famas","USP", "Glock","AWP","MP5","M249","M3","M4A1", "TMP","G3SG1","Flash","Deagle","SG552", "AK47","Knife","P90"}
public plugin_precache(){ laser=precache_model("sprites/laserbeam.spr") }
public plugin_init(){ register_plugin(PLUGIN,VERSION,AUTHOR) server_print("^n^t%s v%s, Copyright © 2006 by %s^n",PLUGIN,VERSION,AUTHOR) // cvars pcvar_esp=register_cvar("esp","1") pcvar_esp_timer=register_cvar("esp_timer","0.3") pcvar_esp_allow_all=register_cvar("esp_allow_all","0") pcvar_esp_disable_default_keys=register_cvar("esp_disable_default_keys","0") register_cvar("aesp_version",VERSION,FCVAR_SERVER|FCVAR_UNLOGGED|FCVAR_SPONLY) // client commands register_clcmd("esp_menu","cmd_esp_menu",REQUIRED_ADMIN_LEVEL,"Shows ESP Menu") register_clcmd("esp_toggle","cmd_esp_toggle",REQUIRED_ADMIN_LEVEL,"Toggle ESP on/off") register_clcmd("say /esp_menu","cmd_esp_menu",REQUIRED_ADMIN_LEVEL,"Shows ESP Menu") register_clcmd("say /esp_toggle","cmd_esp_toggle",REQUIRED_ADMIN_LEVEL,"Toggle ESP on/off") register_clcmd("esp_settings","cmd_esp_settings",REQUIRED_ADMIN_LEVEL," ESP adasdsassdasd") // events register_event("StatusValue","spec_target","bd","1=2") register_event("SpecHealth2","spec_target","bd") register_event("TextMsg","spec_mode","b","2&#Spec_Mode") register_event("Damage", "event_Damage", "b", "2!0", "3=0", "4!0") register_event("ResetHUD", "reset_hud_alive", "be")
register_forward(FM_PlayerPreThink, "fwdPlayerPreThink") // menu new keys=MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_ 6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9 register_menucmd(register_menuid("Admin Specator ESP"),keys,"menu_esp") max_players=get_maxplayers() // start esp_timer for the first time set_task(1.0,"esp_timer") }
public reset_hud_alive(id){ spec[id]=0 }
public cmd_esp_settings(id){ if (admin[id]){ new out[11] read_argv(1,out,10) new len=strlen(out) for (new i=0;i<len;i++){ if (out[i]=='1'){ admin_options[id][i]=true }else{ admin_options[id][i]=false } } } }
public cmd_esp_menu(id){ if (admin[id] && get_pcvar_num(pcvar_esp)==1){ show_esp_menu(id) } }
public cmd_esp_toggle(id){ if (admin[id] && get_pcvar_num(pcvar_esp)==1){ change_esp_status(id,!admin_options[id][0]) } }
show_esp_menu(id){ is_in_menu[id]=true new menu[301] new keys=MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_ 6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9 new onoff[2][]={{"\roff\w"},{"\yon\w"}} // \r=red \y=yellow \w white new text[2][]={{"(use move forward/backward to switch on/off)"},{"(use esp_toggle command to toggle)"}} // \r=red \y=yellow \w white new text_index=get_pcvar_num(pcvar_esp_disable_default_keys) if (text_index!=1) text_index=0 formatex(menu, 300, "Admin Specator ESP^nis %s %s^n^n1. Line is %s^n2. Box is %s^n3. Name is %s^n4. Health/Armor is %s^n5. Weapon is %s^n6. Clip/Ammo is %s^n7. Distance is %s^n8. Show TeamMates is %s^n9. Show AimVector is %s^n^n0. Exit", onoff[admin_options[id][ESP_ON]], text[text_index], onoff[admin_options[id][ESP_LINE]], onoff[admin_options[id][ESP_BOX]], onoff[admin_options[id][ESP_NAME]], onoff[admin_options[id][ESP_HEALTH_ARMOR]], onoff[admin_options[id][ESP_WEAPON]], onoff[admin_options[id][ESP_CLIP_AMMO]], onoff[admin_options[id][ESP_DISTANCE]], onoff[admin_options[id][ESP_TEAM_MATES]], onoff[admin_options[id][ESP_AIM_VEC]]) show_menu(id,keys,menu) return PLUGIN_HANDLED }
public menu_esp(id,key){ if (key==9){ // exit is_in_menu[id]=false return PLUGIN_HANDLED } // toggle esp options if (admin_options[id][key+1]){ admin_options[id][key+1]=false }else{ admin_options[id][key+1]=true } show_esp_menu(id) return PLUGIN_HANDLED }
public event_Damage(id){ if (id>0) { new attacker=get_user_attacker(id) if (attacker>0 && attacker<=max_players){ if (view_target[attacker]==id){ damage_done_to[attacker]=id } } } return PLUGIN_CONTINUE }
public spec_mode(id){ // discover if in first_person_view new specMode[12] read_data(2,specMode,11) if(equal(specMode,"#Spec_Mode4")){ first_person[id]=true }else{ first_person[id]=false } return PLUGIN_CONTINUE }
public spec_target(id){ if (id>0){ new target=read_data(2) if (target!=0){ spec[id]=target } } return PLUGIN_CONTINUE }
public client_putinserver(id){ first_person[id]=false if ((get_user_flags(id) & REQUIRED_ADMIN_LEVEL) || get_pcvar_num(pcvar_esp_allow_all)==1){ admin[id]=true init_admin_options(id) }else{ admin[id]=false } }
init_admin_options(id){ for (new i=0;i<10;i++){ admin_options[id][i]=true } admin_options[id][ESP_TEAM_MATES]=false load_vault_data(id) }
save2vault(id){ if (admin[id]){ new authid[35] get_user_authid (id,authid,34) new tmp[11] for (new s=0;s<10;s++){ if (admin_options[id][s]){ tmp[s]='1'; }else{ tmp[s]='0'; } } tmp[10]=0
//server_print("STEAMID: %s OPTIONS: %s",authid,tmp); new key[41] formatex(key,40,"AESP_%s",authid) set_vaultdata(key,tmp) } }
load_vault_data(id){ if (admin[id]){ new data[11] new authid[35] get_user_authid (id,authid,34) new key[41] formatex(key,40,"AESP_%s",authid) get_vaultdata(key,data,10) if (strlen(data)>0){ for (new s=0;s<10;s++){ if (data[s]=='1'){ admin_options[id][s]=true }else{ admin_options[id][s]=false } } } } }
public client_disconnect(id){ save2vault(id) admin[id]=false spec[id]=0 }
change_esp_status(id,bool:on){ if (on){ admin_options[id][0]=true if (!is_in_menu[id]) client_print(id,print_chat,"[%s] ON",PLUGIN) if (is_in_menu[id]) show_esp_menu(id) }else{ admin_options[id][0]=false if (!is_in_menu[id]) client_print(id,print_chat,"[%s] OFF",PLUGIN) if (is_in_menu[id]) show_esp_menu(id) } }
public fwdPlayerPreThink(id){ if (!is_user_connected(id)) return FMRES_IGNORED static button button=pev(id, pev_button) if (button==0) return FMRES_IGNORED // saves a lot of cpu static oldbutton oldbutton=pev(id, pev_oldbuttons) if (button & IN_DUCK){ ducking[id]=true }else{ ducking[id]=false } if ((get_pcvar_num(pcvar_esp)==1) && (get_pcvar_num(pcvar_esp_disable_default_keys)!=1)){ if (admin[id]){ if (first_person[id] && !is_user_alive(id)){ if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD)){ show_esp_menu(id) } if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD) && !admin_options[id][0]){ change_esp_status(id,true) } if ((button & IN_BACK) && !(oldbutton & IN_BACK) && admin_options[id][0]){ change_esp_status(id,false) } } } } return FMRES_HANDLED }
draw_aim_vector(i,s,len){ new Float:endpoint[3] new tmp[3] new Float:vec1[3] get_user_origin(s, tmp, 1) IVecFVec(tmp,vec1) vec1[2]-=6.0 velocity_by_aim(s,len,endpoint) // get aim vector addVec(endpoint,vec1) // add origin to get absolute coordinates make_TE_BEAMPOINTS(i,4,vec1,endpoint,10,255) return PLUGIN_CONTINUE }
public esp_timer(){ if (get_pcvar_num(pcvar_esp)!=1) { // if esp is not 1, it is off set_task(1.0,"esp_timer") // check for reactivation in 1 sec intervals return PLUGIN_CONTINUE }
static spec_id, Float:my_origin[3], my_team, Float:smallest_angle, smallest_id, Float:xp, Float:yp, Float:dist,
s, target_team, Float:target_origin[3], Float:distance, width, Float:v_middle[3], Float:v_hitpoint[3], Float:distance_to_hitpoint, Float:scaled_bone_len, Float:scaled_bone_width, Float:v_bone_start[3], Float:v_bone_end[3], Float:offset_vector[3], Float:eye_level[3], Float:distance_target_hitpoint, actual_bright, color, Float:ret[2], Float:x_angle, name[37], tmp[33], health[25], hp, armor, clip_ammo[22], clip, ammo, weapon_id, weapon_name[21]
for (new i=1;i<=max_players;i++){ // loop through players if (admin_options[i][ESP_ON] && first_person[i] && is_user_connected(i) && admin[i] && (!is_user_alive(i)) && (spec[i]>0) && is_user_alive(spec[i])){ // :) spec_id=spec[i] pev(i,pev_origin,my_origin) // get origin of spectating admin // get team of spectated :) my_team = get_pdata_int(spec_id, OFFSET_TEAM) smallest_angle=180.0 smallest_id=0 // x,y of hudmessage xp=2.0 yp=2.0 for (s=1;s<=max_players;s++){ // loop through the targets if (is_user_alive(s)){ // target must be alive // get team of target target_team = get_pdata_int(s, OFFSET_TEAM) if (!(target_team==3)){ //if not spectator if (spec_id!=s){ // do not target myself // if the target is in the other team and not spectator if (((my_team!=target_team && (target_team==1 || target_team==2)) || admin_options[i][ESP_TEAM_MATES])){ // get origin of target pev(s,pev_origin,target_origin) // get distance from me to target distance=vector_distance(my_origin,target_origin) if (admin_options[i][ESP_LINE]){ if (distance<2040.0){ // calculate width according to distance width=(255-floatround(distance/8.0))/3 }else{ width=1 } // create temp_ent make_TE_BEAMENTPOINT(i,target_origin,width,target_team) } // get vector from me to target subVec(target_origin,my_origin,v_middle) // trace from me to target, getting hitpoint engfunc(EngFunc_TraceLine, my_origin, target_origin, 1, -1, 0) get_tr2(0, TR_vecEndPos, v_hitpoint) // get distance from me to hitpoint (nearest wall) distance_to_hitpoint=vector_distance(my_origin,v_hitpoint)
// scale if (ducking[spec_id]){ scaled_bone_len=distance_to_hitpoint/distance*(50.0-18.0) }else{ scaled_bone_len=distance_to_hitpoint/distance*50.0 } scaled_bone_len=distance_to_hitpoint/distance*50.0 scaled_bone_width=distance_to_hitpoint/distance*150.0 // get the point 10.0 units away from wall normalize(v_middle,offset_vector,distance_to_hitpoint-10.0) // offset from wall // set to eye level copyVec(my_origin,eye_level) if (ducking[spec_id]){ eye_level[2]+=12.3 }else{ eye_level[2]+=17.5 } addVec(offset_vector,eye_level) // start and end of green box copyVec(offset_vector,v_bone_start) copyVec(offset_vector,v_bone_end) v_bone_end[2]-=scaled_bone_len distance_target_hitpoint=distance-distance_to_hitpoint actual_bright=255 if (admin_options[i][ESP_BOX]){ // this is to make green box darker if distance is larger if (distance_target_hitpoint<2040.0){ actual_bright=(255-floatround(distance_target_hitpoint/12.0)) }else{ actual_bright=85 } if (distance_to_hitpoint!=distance){ // if no line of sight color=0 }else{ // if line of sight color=target_team } if (damage_done_to[spec_id]==s) { color=3 damage_done_to[spec_id]=0 } make_TE_BEAMPOINTS(i,color,v_bone_start,v_bone_end,floatround(scaled_bone_width) ,actual_bright) } if (admin_options[i][ESP_AIM_VEC] || admin_options[i][ESP_NAME] || admin_options[i][ESP_HEALTH_ARMOR] || admin_options[i][ESP_WEAPON] || admin_options[i][ESP_CLIP_AMMO] || admin_options[i][ESP_DISTANCE]){ x_angle=get_screen_pos(spec_id,v_middle,ret) // find target with the smallest distance to crosshair (on x-axis) if (smallest_angle>floatabs(x_angle)){ if (floatabs(x_angle)!=0.0){ smallest_angle=floatabs(x_angle) view_target[spec_id]=s smallest_id=s // store nearest target id.. xp=ret[0] // and x,y coordinates of hudmessage yp=ret[1] dist=distance } } } } } } } } // inner player loop end if (!is_user_alive(smallest_id)) { smallest_id=0 xp=-1.0 } if (smallest_id>0 && admin_options[i][ESP_AIM_VEC]){ draw_aim_vector(i,smallest_id,2000) } if (xp>0.0 && xp<=1.0 && yp>0.0 && yp<=1.0){ // if in visible range // show the player info set_hudmessage(255, 255, 0, floatabs(xp), floatabs(yp), 0, 0.0, get_pcvar_float(pcvar_esp_timer), 0.0, 0.0, -1)
name[0] = '^0' get_user_name(smallest_id,tmp,32) if (admin_options[i][ESP_NAME]){ formatex(name,36,"[%s]^n",tmp) } health[0] = '^0' if (admin_options[i][ESP_HEALTH_ARMOR]){ //new hp=get_user_health(smallest_id) hp=get_user_health(smallest_id) //new armor=get_user_armor(smallest_id) armor=get_user_armor(smallest_id) formatex(health,24,"health: %d armor: %d^n",hp,armor) }
clip_ammo[0] = '^0' weapon_id=get_user_weapon(smallest_id,clip,ammo) if (admin_options[i][ESP_CLIP_AMMO]){ formatex(clip_ammo,21,"clip: %d ammo: %d^n",clip,ammo) } weapon_name[0] = '^0' if (admin_options[i][ESP_WEAPON]){ if ((weapon_id-1)<0 || (weapon_id-1)>29) weapon_id=1 formatex(weapon_name,20,"weapon: %s^n",weapons[weapon_id-1])
} new str_dist[19] if (admin_options[i][ESP_DISTANCE]){ formatex(str_dist,18,"distance: %d^n",floatround(dist)) } show_hudmessage(i, "%s%s%s%s%s",name,health,weapon_name,clip_ammo,str_dist) } } } set_task(get_pcvar_float(pcvar_esp_timer),"esp_timer") // keep it going return PLUGIN_CONTINUE }
Float:get_screen_pos(id,Float:v_me_to_target[3],Float:Ret[2]){ new Float:v_aim[3] velocity_by_aim(id,1,v_aim) // get aim vector new Float:aim[3] copyVec(v_aim,aim) // make backup copy of v_aim v_aim[2]=0.0 // project aim vector vertically to x,y plane new Float:v_target[3] copyVec(v_me_to_target,v_target) v_target[2]=0.0 // project target vector vertically to x,y plane // both v_aim and v_target are in the x,y plane, so angle can be calculated.. new Float:x_angle new Float:x_pos=get_screen_pos_x(v_target,v_aim,x_angle) // get the x coordinate of hudmessage.. new Float:y_pos=get_screen_pos_y(v_me_to_target,aim) // get the y coordinate of hudmessage.. Ret[0]=x_pos Ret[1]=y_pos return x_angle }
Float:get_screen_pos_x(Float:target[3],Float:aim[3],&Float:xangle){ new Float:x_angle=floatacos(vectorProduct(aim,target)/(getVecLen(aim)*getVecLen(target)),1) // get angle between vectors new Float:x_pos //this part is a bit tricky.. //the problem is that the 'angle between vectors' formula returns always positive values //how can be determined if the target vector is on the left or right side of the aim vector? with only positive angles? //the solution: //the scalar triple product returns the volume of the parallelepiped that is created by three input vectors // //i used the aim and target vectors as the first two input parameters //and the third one is a vector pointing straight upwards [0,0,1] //if now the target is on the left side of spectator origin the created parallelepipeds volume is negative //and on the right side positive //now we can turn x_angle into a signed value.. if (scalar_triple_product(aim,target)<0.0) x_angle*=-1 // make signed if (x_angle>=-45.0 && x_angle<=45.0){ // if in fov of 90 x_pos=1.0-(floattan(x_angle,degrees)+1.0)/2.0 // calulate y_pos of hudmessage xangle=x_angle return x_pos } xangle=0.0 return -2.0 }
Float:get_screen_pos_y(Float:v_target[3],Float:aim[3]){ new Float:target[3] // rotate vector about z-axis directly over the direction vector (to get height angle) rotateVectorZ(v_target,aim,target) // get angle between aim vector and target vector new Float:y_angle=floatacos(vectorProduct(aim,target)/(getVecLen(aim)*getVecLen(target)),1) // get angle between vectors new Float:y_pos new Float:norm_target[3],Float:norm_aim[3] // get normalized target and aim vectors normalize(v_target,norm_target,1.0) normalize(aim,norm_aim,1.0) //since the 'angle between vectors' formula returns always positive values if (norm_target[2]<norm_aim[2]) y_angle*=-1 //make signed if (y_angle>=-45.0 && y_angle<=45.0){ // if in fov of 90 y_pos=1.0-(floattan(y_angle,degrees)+1.0)/2.0 // calulate y_pos of hudmessage if (y_pos>=0.0 && y_pos<=1.0) return y_pos } return -2.0 }
// Vector Operations -------------------------------------------------------------------------------
Float:getVecLen(Float:Vec[3]){ new Float:VecNull[3]={0.0,0.0,0.0} new Float:len=vector_distance(Vec,VecNull) return len }
Float:scalar_triple_product(Float:a[3],Float:b[3]){ new Float:up[3]={0.0,0.0,1.0} new Float:Ret[3] Ret[0]=a[1]*b[2]-a[2]*b[1] Ret[1]=a[2]*b[0]-a[0]*b[2] Ret[2]=a[0]*b[1]-a[1]*b[0] return vectorProduct(Ret,up) }
normalize(Float:Vec[3],Float:Ret[3],Float:multiplier){ new Float:len=getVecLen(Vec) copyVec(Vec,Ret) Ret[0]/=len Ret[1]/=len Ret[2]/=len Ret[0]*=multiplier Ret[1]*=multiplier Ret[2]*=multiplier }
rotateVectorZ(Float:Vec[3],Float:direction[3],Float:Ret[3]){ // rotates vector about z-axis new Float:tmp[3] copyVec(Vec,tmp) tmp[2]=0.0 new Float:dest_len=getVecLen(tmp) copyVec(direction,tmp) tmp[2]=0.0 new Float:tmp2[3] normalize(tmp,tmp2,dest_len) tmp2[2]=Vec[2] copyVec(tmp2,Ret) }
Float:vectorProduct(Float:Vec1[3],Float:Vec2[3]){ return Vec1[0]*Vec2[0]+Vec1[1]*Vec2[1]+Vec1[2]*Vec2[2] }
copyVec(Float:Vec[3],Float:Ret[3]){ Ret[0]=Vec[0] Ret[1]=Vec[1] Ret[2]=Vec[2] }
subVec(Float:Vec1[3],Float:Vec2[3],Float:Ret[3]){ Ret[0]=Vec1[0]-Vec2[0] Ret[1]=Vec1[1]-Vec2[1] Ret[2]=Vec1[2]-Vec2[2] }
addVec(Float:Vec1[3],Float:Vec2[3]){ Vec1[0]+=Vec2[0] Vec1[1]+=Vec2[1] Vec1[2]+=Vec2[2] }
// Temporary Entities ------------------------------------------------------------------------------ // there is a list of much more temp entities at: http://djeyl.net/forum/index.php?act=Attac...t&id=290870 // all messages are sent with MSG_ONE_UNRELIABLE flag to avoid overflow in case of very low esp_timer setting and much targets
make_TE_BEAMPOINTS(id,color,Float:Vec1[3],Float:Vec2[3],width,brightness){ message_begin(MSG_ONE_UNRELIABLE ,SVC_TEMPENTITY,{0,0,0},id) //message begin write_byte(0) write_coord(floatround(Vec1[0])) // start position write_coord(floatround(Vec1[1])) write_coord(floatround(Vec1[2])) write_coord(floatround(Vec2[0])) // end position write_coord(floatround(Vec2[1])) write_coord(floatround(Vec2[2])) write_short(laser) // sprite index write_byte(3) // starting frame write_byte(0) // frame rate in 0.1's write_byte(floatround(get_pcvar_float(pcvar_esp_timer)*10)) // life in 0.1's write_byte(width) // line width in 0.1's write_byte(0) // noise amplitude in 0.01's write_byte(esp_colors[color][0]) write_byte(esp_colors[color][1]) write_byte(esp_colors[color][2]) write_byte(brightness) // brightness) write_byte(0) // scroll speed in 0.1's message_end() }
make_TE_BEAMENTPOINT(id,Float:target_origin[3],width,target_team){ message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,{0,0,0},id) write_byte(1) write_short(id) write_coord(floatround(target_origin[0])) write_coord(floatround(target_origin[1])) write_coord(floatround(target_origin[2])) write_short(laser) write_byte(1) write_byte(1) write_byte(floatround(get_pcvar_float(pcvar_esp_timer)*10)) write_byte(width) write_byte(0) write_byte(team_colors[target_team][0]) write_byte(team_colors[target_team][1]) write_byte(team_colors[target_team][2]) write_byte(255) write_byte(0) message_end() }
3. от leonard19941: Пост 606 от leonard19941 в теме 1.3 на Оленях.версия до 900 строк + также добавлены со строк 97-101 какие-то оружия Код:
/* AMX Mod X - Script * * Admin Spectator ESP v1.5 * Copyright © 2006 by KoST * * This plugin along with its compiled version can de downloaded here: * http://forums.alliedmods.net/showthread.php?t=23691 * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * or download here: http://www.gnu.org/licenses/gpl.txt * * In addition, as a special exception, the author gives permission to * link the code of this program with the Half-Life Game Engine ("HL * Engine") and Modified Game Libraries ("MODs") developed by Valve, * L.L.C ("Valve"). You must obey the GNU General Public License in all * respects for all of the code used other than the HL Engine and MODs * from Valve. If you modify this file, you may extend this exception * to your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ //----------------------------------------------------------------------------------------------------------------------------
#include <amxmodx> #include <fakemeta>
#define VERSION "1.5"
#define OFFSET_TEAM 114
// Feel free to change this flag. #define ASESP_LEVEL_RCON ADMIN_RCON
enum { ESP_ON = 0, ESP_LINE, ESP_BOX, ESP_NAME, ESP_HEALTH_ARMOR, ESP_WEAPON, ESP_CLIP_AMMO, ESP_DISTANCE, ESP_TEAM_MATES, ESP_AIM_VEC };
new bool: bAdminOptions[ 33 ][ 10 ];
new bool: bAdmin[ 33 ], bool: bFirstPerson[ 33 ], bool: bDucking[ 33 ], bool: bIsInMenu[ 33 ];
new g_pCvarESPEnabled, g_pCvarESPTimer, g_pCvarESPAllowAll, g_pCvarESPDisableDefaultKeys;
new iTeamColors[ 4 ][ 3 ] = { { 0, 0, 0 }, { 150, 0, 0 }, { 0, 0, 150 }, { 0, 150 ,0 } };
new iEspColors[ 5 ][ 3 ] = { { 0, 255, 0 }, { 100, 60, 60 }, { 60, 60, 100 }, { 255, 0, 255 }, { 128, 128, 128 } };
new iLaser;
new g_iDamageDoneTo[ 33 ], g_iViewTarget[ 33 ], g_iSpectator[ 33 ]; new g_iMsgSayText;
new g_iMaxPlayers;
new iWeapons[ 30 ][ 10 ] = { "None", "P228", "Scout", "HE", "XM1014", "C4", "MAC-10", "AUG", "Smoke", "Elite", "Fiveseven", "UMP45", "SIG550", "Galil", "Famas", "USP", "Glock", "AWP", "MP5", "M249", "M3", "M4A1", "TMP", "G3SG1", "Flash", "Deagle", "SG552", "AK47", "Knife", "P90" };
public plugin_init( ) { register_plugin( "Admin Spectator ESP", VERSION, "KoST" ); server_print( "^n^tAdmin Spectator ESP v%s, Copyright © 2006 by KoST^n", VERSION ); register_clcmd( "esp_menu", "ESP_Menu", ASESP_LEVEL_RCON, "Show ESP Menu" ) register_clcmd( "say /esp_menu", "ESP_Menu", ASESP_LEVEL_RCON, "Show ESP Menu" ) register_clcmd( "esp_toggle", "ESP_Toggle", ASESP_LEVEL_RCON, "Toggle ESP On/Off" ) register_clcmd( "say /esp_toggle", "ESP_Toggle", ASESP_LEVEL_RCON, "Toggle ESP On/Off" ) register_clcmd( "esp_settings", "ESP_Settings", ASESP_LEVEL_RCON, " ESP Settings" ) g_pCvarESPEnabled = register_cvar( "esp_enabled", "1" ) g_pCvarESPTimer = register_cvar( "esp_timer", "0.3" ) g_pCvarESPAllowAll = register_cvar( "esp_allow_all", "0" ) g_pCvarESPDisableDefaultKeys = register_cvar( "esp_disable_default_keys", "0" ) new g_pCvar = register_cvar( "esp_version", VERSION, FCVAR_SERVER | FCVAR_UNLOGGED | FCVAR_SPONLY ) set_pcvar_string( g_pCvar, VERSION ) register_forward( FM_PlayerPreThink, "Fw_PlayerPreThink" ) register_event( "StatusValue", "SpecTarget", "bd", "1=2" ) register_event( "SpecHealth2", "SpecTarget", "bd" ) register_event( "TextMsg", "SpecMode", "b", "2&#Spec_Mode" ) register_event( "Damage", "Damage", "b", "2!0", "3=0", "4!0" ) register_event( "ResetHUD", "ResetHUD", "be") new iKeys = MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_9 register_menucmd( register_menuid( "Admin Specator ESP" ), iKeys, "AdminSpectatorESP_Menu" ) g_iMsgSayText = get_user_msgid( "SayText" ); g_iMaxPlayers = get_maxplayers( ) // Start esp_timer for the first time. set_task( 1.0, "ESP_Timer" ) }
public plugin_precache( ) iLaser = precache_model( "sprites/laserbeam.spr" ); public client_putinserver( id ) { bFirstPerson[ id ] = false if( ( get_user_flags( id ) & ASESP_LEVEL_RCON ) || get_pcvar_num( g_pCvarESPAllowAll ) == 1 ) { bAdmin[ id ] = true AdminOptions( id ) } else bAdmin[id]=false }
AdminOptions( id ) { for( new i = 0; i < 10; i++ ) bAdminOptions[ id ][ i ] = true bAdminOptions[ id ][ ESP_TEAM_MATES ] = false LoadData( id ) }
public ESP_Menu( id ) { if( bAdmin[ id ] && get_pcvar_num( g_pCvarESPEnabled ) == 1 ) ShowESP_Menu( id ) }
ShowESP_Menu( id ) { bIsInMenu[ id ] = true new iOnOff[ 2 ][ ] = { { "\rOff\w" }, { "\yOn\w" } }; new iText[ 2 ][ ] = { { "(use move forward/backward to switch On/Off)" }, { "(use esp_toggle command to toggle)" } }; new iTextIndex = get_pcvar_num( g_pCvarESPDisableDefaultKeys ) if( iTextIndex!= 1 ) iTextIndex = 0 new iMenu[ 301 ]; new iKeys = MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_3 | MENU_KEY_4 | MENU_KEY_5 | MENU_KEY_6 | MENU_KEY_7 | MENU_KEY_8 | MENU_KEY_9 formatex( iMenu, charsmax( iMenu ), "Admin Specator ESP^nis %s %s^n^n1. Line is %s^n2. Box is %s^n3. Name is %s^n4. Health/Armor is %s^n5. Weapon is %s^n6. Clip/Ammo is %s^n7. Distance is %s^n8. Show TeamMates is %s^n9. Show AimVector is %s^n^n0. Exit", iOnOff[ bAdminOptions[ id ][ ESP_ON ] ], iText[ iTextIndex ], iOnOff[ bAdminOptions[ id ][ ESP_LINE ] ], iOnOff[ bAdminOptions[ id ][ ESP_BOX]], iOnOff[ bAdminOptions[ id ][ ESP_NAME ] ], iOnOff[ bAdminOptions[ id ][ ESP_HEALTH_ARMOR ] ], iOnOff[ bAdminOptions[ id ][ ESP_WEAPON ] ], iOnOff[ bAdminOptions[ id ][ ESP_CLIP_AMMO ] ], iOnOff[ bAdminOptions[ id ][ ESP_DISTANCE ] ], iOnOff[ bAdminOptions[ id ][ ESP_TEAM_MATES ] ], iOnOff[ bAdminOptions[ id ][ ESP_AIM_VEC ] ] ) show_menu( id, iKeys, iMenu ) return PLUGIN_HANDLED; }
public ESP_Toggle( id ) { if( bAdmin[ id ] && get_pcvar_num( g_pCvarESPEnabled ) == 1 ) ESP_Status( id, !bAdminOptions[ id ][ 0 ] ) }
ESP_Status( id, bool: bOn ) { if( bOn ) { bAdminOptions[ id ][ 0 ] = true if( !bIsInMenu[ id ] ) ChatColor( id, "!g[ Admin Spectator ESP v%s ] !yStatus: !gON!y.", VERSION ) if( bIsInMenu[ id ] ) ShowESP_Menu( id ) } else { bAdminOptions[ id ][ 0 ] = false if( !bIsInMenu[ id ] ) ChatColor( id, "!g[ Admin Spectator ESP v%s ] !yStatus: !gOFF!y.", VERSION ) if( bIsInMenu[ id ] ) ShowESP_Menu( id ) } }
public ESP_Settings( id ) { if( bAdmin[ id ] ) { new iOut[ 11 ]; read_argv( 1, iOut, charsmax( iOut ) ) new iLen = strlen( iOut ) for( new i = 0; i < iLen; i++ ) { if( iOut[ i ] == '1' ) bAdminOptions[ id ][ i ] = true else bAdminOptions[ id ][ i ] = false } } }
public Fw_PlayerPreThink( id ) { if( !is_user_connected( id ) ) return FMRES_IGNORED; static iButton; iButton = pev( id, pev_button ) if( iButton == 0 ) return FMRES_IGNORED; static iOldButton; iOldButton = pev( id, pev_oldbuttons ) if( iButton & IN_DUCK ) bDucking[ id ] = true else bDucking[ id ] = false if( ( get_pcvar_num( g_pCvarESPEnabled ) ==1 ) && ( get_pcvar_num( g_pCvarESPDisableDefaultKeys )!= 1 ) ) { if( bAdmin[ id ] ) { if( bFirstPerson[ id ] && !is_user_alive( id ) ) { if( ( iButton & IN_RELOAD ) && !( iOldButton & IN_RELOAD ) ) ShowESP_Menu( id ) if( ( iButton & IN_FORWARD ) && !( iOldButton & IN_FORWARD ) && !bAdminOptions[ id ][ 0 ] ) ESP_Status( id, true ) if( ( iButton & IN_BACK ) && !( iOldButton & IN_BACK ) && bAdminOptions[ id ][ 0 ] ) ESP_Status( id, false ) } } } return FMRES_HANDLED; }
public SpecTarget( id ) { if( id > 0 ) { new iTarget = read_data( 2 ) if( iTarget!= 0 ) g_iSpectator[ id ] = iTarget } return PLUGIN_CONTINUE; }
public SpecMode( id ) { new iSpecMode[ 12 ]; read_data( 2, iSpecMode, charsmax( iSpecMode ) ); if( equal( iSpecMode, "#Spec_Mode4" ) ) bFirstPerson[ id ] = true else bFirstPerson[ id ] = false return PLUGIN_CONTINUE; }
public Damage( id ) { if( id > 0 ) { new iAttacker = get_user_attacker( id ) if( iAttacker > 0 && iAttacker <= g_iMaxPlayers ) { if( g_iViewTarget[ iAttacker ] == id ) g_iDamageDoneTo[ iAttacker ] = id } } return PLUGIN_CONTINUE; }
public ResetHUD( id ) g_iSpectator[ id ] = 0
public AdminSpectatorESP_Menu( id, iKey ) { if( iKey == 9 ) { bIsInMenu[ id ] = false return PLUGIN_HANDLED; } if( bAdminOptions[ id ][ iKey + 1 ] ) bAdminOptions[ id ][ iKey + 1 ] = false else bAdminOptions[ id ][ iKey + 1 ] = true ShowESP_Menu( id ) return PLUGIN_HANDLED; }
SaveData( id ) { if( bAdmin[ id ] ) { new uAuthId[ 35 ]; get_user_authid( id, uAuthId, charsmax( uAuthId ) ); new iTmp[ 11 ]; for( new s = 0; s < 10; s++ ) { if( bAdminOptions[ id ][ s ] ) iTmp[ s ] = '1'; else iTmp[ s ] = '0'; } iTmp[ 10 ] = 0
// server_print( "STEAM-ID: %s OPTIONS: %s", uAuthId, iTmp ); new iKey[ 41 ]; formatex( iKey, charsmax( iKey ), "ESP_%s", uAuthId ) set_vaultdata( iKey, iTmp ) } }
LoadData( id ) { if( bAdmin[ id ] ) { new iData[ 11 ], uAuthId[ 35 ]; get_user_authid( id, uAuthId, charsmax( uAuthId ) ); new iKey[ 41 ]; formatex( iKey, charsmax( iKey ), "ESP_%s", uAuthId ) get_vaultdata( iKey, iData, charsmax( iData ) ) if( strlen( iData ) > 0 ) { for( new s = 0; s < 10; s++ ) { if( iData[ s ] == '1' ) bAdminOptions[ id ][ s ] = true else bAdminOptions[ id ][ s ] = false } } } }
public DrawAimVector( i, s, iLen ) { new iTmp[ 3 ]; get_user_origin( s, iTmp, 1 ) new Float: fVec[ 3 ]; new Float: fEndPoint[ 3 ]; IVecFVec( iTmp, fVec ) fVec[ 2 ]-= 6.0 velocity_by_aim( s, iLen, fEndPoint ) AddVec( fEndPoint, fVec ) Make_TE_BEAMPOINTS( i, 4, fVec, fEndPoint, 10, 255 ) return PLUGIN_CONTINUE; }
public ESP_Timer( ) { if( get_pcvar_num( g_pCvarESPEnabled )!= 1 ) { set_task( 1.0, "ESP_Timer" ) // Check for reactivation in 1 sec intervals. return PLUGIN_CONTINUE; } static iSpectatorId, Float: fMyOrigin[ 3 ], iMyTeam, Float: fSmallestAngle, iSmallestId, Float: fX_Pos, Float: fY_Pos, Float: fDist, iTargetTeam, Float: fTargetOrigin[ 3 ], Float: fDistance, iWidth, Float: fMiddle[ 3 ], Float: fHitPoint[ 3 ], Float: fDistanceToHitPoint, Float: fScaledBoneLen, Float: fScaledBoneWidth, Float: fBone_Start[ 3 ], Float: fBone_End[ 3 ], Float: fOffSet_Vector[ 3 ], Float: fEyeLevel[ 3 ], Float: fDistanceTargetHitPoint, iActualBright, iColor, Float: fRet[ 2 ], Float: fX_Angle, iName[ 37 ], iHealthAndArmor[ 25 ], iClipAndAmmo[ 22 ], iWeaponId, iWeaponName[21];
for( new i = 1; i <= g_iMaxPlayers; i++ ) { if( bAdminOptions[ i ][ ESP_ON ] && bFirstPerson[ i ] && is_user_connected( i ) && bAdmin[ i ] && ( !is_user_alive( i ) ) && ( g_iSpectator[ i ] > 0 ) && is_user_alive( g_iSpectator[ i ] ) ) { iSpectatorId = g_iSpectator[ i ]; pev( i, pev_origin, fMyOrigin ) // Get origin of spectating admin. // Get team of spectated. iMyTeam = get_pdata_int( iSpectatorId, OFFSET_TEAM ) iSmallestId = 0; fSmallestAngle = 180.0; // X,Y of hudmessage. fX_Pos = 2.0 fY_Pos = 2.0 for( new s = 1; s <= g_iMaxPlayers; s++ ) { if( is_user_alive( s ) ) { iTargetTeam = get_pdata_int( s, OFFSET_TEAM ) if( !( iTargetTeam == 3 ) ) { if( iSpectatorId!= s ) { if( ( ( iMyTeam != iTargetTeam && ( iTargetTeam == 1 || iTargetTeam == 2 ) ) || bAdminOptions[ i ][ ESP_TEAM_MATES ] ) ) { // Get origin of target. pev( s, pev_origin, fTargetOrigin ) // Get distance from me to target. fDistance = vector_distance( fMyOrigin, fTargetOrigin ) if( bAdminOptions[ i ][ ESP_LINE ] ) { if( fDistance < 2040.0 ) iWidth = ( 255 - floatround( fDistance / 8.0 ) ) / 3 else iWidth = 1 Make_TE_BEAMENTPOINT( i, fTargetOrigin, iWidth, iTargetTeam ) } // Get vector from me to target. SubVec( fTargetOrigin, fMyOrigin, fMiddle ) // Trace from me to target, getting hitpoint. engfunc( EngFunc_TraceLine, fMyOrigin, fTargetOrigin, 1, -1, 0 ) get_tr2( 0, TR_vecEndPos, fHitPoint ) // Get distance from me to hitpoint (nearest wall). fDistanceToHitPoint = vector_distance( fMyOrigin, fHitPoint ) // Scale. if( bDucking[ iSpectatorId ] ) fScaledBoneLen = fDistanceToHitPoint / fDistance * ( 50.0 - 18.0 ) else fScaledBoneLen = fDistanceToHitPoint / fDistance * 50.0 fScaledBoneLen = fDistanceToHitPoint / fDistance * 50.0 fScaledBoneWidth = fDistanceToHitPoint / fDistance * 150.0 // Get the point 10.0 units away from wall. Normalize( fMiddle, fOffSet_Vector, fDistanceToHitPoint - 10.0 ) // Offset from wall. // Set to eye level. CopyVec( fMyOrigin, fEyeLevel ) if( bDucking[ iSpectatorId ] ) fEyeLevel[ 2 ]+= 12.3 else fEyeLevel[ 2 ]+= 17.5 AddVec( fOffSet_Vector, fEyeLevel ) // Start and end of green box. CopyVec( fOffSet_Vector, fBone_Start ) CopyVec( fOffSet_Vector, fBone_End ) fBone_End[ 2 ]-= fScaledBoneLen fDistanceTargetHitPoint = fDistance - fDistanceToHitPoint; iActualBright = 255; if( bAdminOptions[ i ][ ESP_BOX ] ) { if( fDistanceTargetHitPoint < 2040.0 ) iActualBright = ( 255 - floatround( fDistanceTargetHitPoint / 12.0 ) ) else iActualBright = 85 if( fDistanceToHitPoint!= fDistance ) iColor = 0 else iColor = iTargetTeam if( g_iDamageDoneTo[ iSpectatorId ] == s ) { iColor = 3 g_iDamageDoneTo[ iSpectatorId ] = 0 } Make_TE_BEAMPOINTS( i, iColor, fBone_Start, fBone_End, floatround( fScaledBoneWidth ), iActualBright ) } if( bAdminOptions[ i ][ ESP_AIM_VEC ] || bAdminOptions[ i ][ ESP_NAME ] || bAdminOptions[ i ][ ESP_HEALTH_ARMOR ] || bAdminOptions[ i ][ ESP_WEAPON ] || bAdminOptions[ i ][ ESP_CLIP_AMMO ] || bAdminOptions[ i ][ ESP_DISTANCE ] ) { fX_Angle = GetScreenPos( iSpectatorId, fMiddle, fRet ) // Find target with the smallest distance to crosshair (on x-axis). if( fSmallestAngle > floatabs( fX_Angle ) ) { if( floatabs( fX_Angle )!= 0.0 ) { fSmallestAngle = floatabs( fX_Angle ) g_iViewTarget[ iSpectatorId ] = s iSmallestId = s // Store nearest target id. fX_Pos = fRet[ 0 ] // And x, y coordinates of hudmessage. fY_Pos = fRet[ 1 ] fDist = fDistance } } } } } } } } if( !is_user_alive( iSmallestId ) ) { iSmallestId = 0 fX_Pos =-1.0 } if( iSmallestId > 0 && bAdminOptions[ i ][ ESP_AIM_VEC ] ) DrawAimVector( i, iSmallestId, 2000 ) if( fX_Pos > 0.0 && fX_Pos <= 1.0 && fY_Pos > 0.0 && fY_Pos <= 1.0 ) { set_hudmessage( 255, 255, 0, floatabs( fX_Pos ), floatabs( fY_Pos ), 0, 0.0, get_pcvar_float( g_pCvarESPTimer ), 0.0, 0.0, -1 ) iName[ 0 ] = '^0' if( bAdminOptions[ i ][ ESP_NAME ] ) { new uName[ 33 ]; get_user_name( iSmallestId, uName, charsmax( uName ) ) formatex( iName, charsmax( iName ), "[%s]^n", uName ) } iHealthAndArmor[ 0 ] = '^0' if( bAdminOptions[ i ][ ESP_HEALTH_ARMOR ] ) { new iHP = get_user_health( iSmallestId ) new iArmor = get_user_armor( iSmallestId ) formatex( iHealthAndArmor, charsmax( iHealthAndArmor ), "Health: %d Armor: %d^n", iHP, iArmor ) } iWeaponName[ 0 ] = '^0' if( bAdminOptions[ i ][ ESP_WEAPON ] ) { if( ( iWeaponId - 1 ) < 0 || ( iWeaponId - 1 ) > 29 ) iWeaponId = 1 formatex( iWeaponName, charsmax( iWeaponName ), "Weapon: %s^n", iWeapons[ iWeaponId - 1 ] ) } iClipAndAmmo[ 0 ] = '^0' if( bAdminOptions[ i ][ ESP_CLIP_AMMO ] ) { new iClip, iAmmo; iWeaponId = get_user_weapon( iSmallestId, iClip, iAmmo ) formatex( iClipAndAmmo, charsmax( iClipAndAmmo ), "Clip: %d Ammo: %d^n", iClip, iAmmo ) } new iStrDist[ 19 ]; if( bAdminOptions[ i ][ ESP_DISTANCE ] ) formatex( iStrDist, charsmax( iStrDist ), "Distance: %d^n", floatround( fDist ) ) show_hudmessage( i, "%s%s%s%s%s", iName, iHealthAndArmor, iWeaponName, iClipAndAmmo, iStrDist) } } } set_task( get_pcvar_float( g_pCvarESPTimer ), "ESP_Timer" ) // Keep it going. return PLUGIN_CONTINUE; }
Float: GetScreenPos( id, Float: fMeToTarget[ 3 ], Float: fRet[ 2 ] ) { new Float: fAim1[ 3 ]; velocity_by_aim( id, 1, fAim1 ) // Get aim vector. new Float: fAim2[ 3 ]; CopyVec( fAim1, fAim2 ) // Make backup copy of fAim1. fAim1[ 2 ] = 0.0 // Project aim vector vertically to x,y plane. new Float: fTarget[ 3 ]; CopyVec( fMeToTarget, fTarget ) fTarget[ 2 ] = 0.0 // Project target vector vertically to x,y plane. // Both fAim1 and fTarget are in the x,y plane, so angle can be calculated. new Float: fX_Angle; new Float: fX_Pos = GetScreenPos_X( fTarget, fAim1, fX_Angle ) // Get the x coordinate of hudmessage.. new Float: fY_Pos = GetScreenPos_Y( fMeToTarget, fAim2 ) // Get the y coordinate of hudmessage.. fRet[ 0 ]= fX_Pos fRet[ 1 ]= fY_Pos return fX_Angle; }
Float: GetScreenPos_X( Float: fTarget[ 3 ], Float: fAim[ 3 ], &Float: fX_Angle ) { new Float: fX_Angle1 = floatacos( VectorProduct( fAim, fTarget ) / ( GetVecLen ( fAim ) * GetVecLen( fTarget ) ), 1 ) // Get angle between vectors. new Float: fX_Pos; if( ScalarTripleProduct( fAim, fTarget ) < 0.0 ) fX_Angle1*=-1 if( fX_Angle1>=-45.0 && fX_Angle1<= 45.0 ) { fX_Pos = 1.0 - ( floattan( fX_Angle1, degrees ) + 1.0 ) / 2.0 fX_Angle = fX_Angle1 return fX_Pos; } fX_Angle = 0.0 return -2.0 }
Float: GetScreenPos_Y( Float: fTarget[ 3 ], Float: fAim[ 3 ] ) { new Float: fTarget1[ 3 ] // Rotate vector about z-axis directly over the direction vector (to get height angle); RotateVectorZ( fTarget, fAim, fTarget1 ) // Get angle between aim vector and target vector. new Float: fY_Angle = floatacos( VectorProduct( fAim, fTarget1 ) / ( GetVecLen( fAim ) * GetVecLen( fTarget1 ) ), 1 ) // Get angle between vectors. new Float: fY_Pos; new Float: fNormTarget[ 3 ], Float: fNormAim[ 3 ]; // Get normalized target and aim vectors. Normalize( fTarget, fNormTarget, 1.0 ) Normalize( fAim, fNormAim, 1.0 ) // Since the 'angle between vectors' formula returns always positive values. if( fNormTarget[ 2 ] < fNormAim[ 2 ] ) fY_Angle*=-1 if( fY_Angle>=-45.0 && fY_Angle<= 45.0 ) { fY_Pos = 1.0 - ( floattan( fY_Angle, degrees ) + 1.0 ) / 2.0 // Calulate fY_Pos of hudmessage. if( fY_Pos>= 0.0 && fY_Pos<= 1.0 ) return fY_Pos; } return -2.0 }
// Vector Operations ---------------------------------------------------------------------------------------------------------
Float: GetVecLen( Float: fVec[ 3 ] ) { new Float: fVecNull[ 3 ] = { 0.0, 0.0, 0.0 } new Float: fLen = vector_distance( fVec, fVecNull ) return fLen; }
Float: ScalarTripleProduct( Float: fA[ 3 ], Float: fB[ 3 ] ) { new Float: fUp[ 3 ] = { 0.0, 0.0, 1.0 } new Float: fRet[ 3 ]; fRet[ 0 ] = fA[ 1 ] * fB[ 2 ] - fA[ 2 ] * fB[ 1 ] fRet[ 1 ] = fA[ 2 ] * fB[ 0 ] - fA[ 0 ] * fB[ 2 ] fRet[ 2 ] = fA[ 0 ] * fB[ 1 ] - fA[ 1 ] * fB[ 0 ] return VectorProduct( fRet, fUp ) }
Normalize( Float: fVec[ 3 ], Float: fRet[ 3 ],Float: fMultiplier ) { new Float: fLen = GetVecLen( fVec ) CopyVec( fVec, fRet ) fRet[ 0 ]/= fLen fRet[ 1 ]/= fLen fRet[ 2 ]/= fLen fRet[ 0 ]*= fMultiplier fRet[ 1 ]*= fMultiplier fRet[ 2 ]*= fMultiplier }
RotateVectorZ( Float: fVec[ 3 ], Float: fDirection[ 3 ], Float: fRet[ 3 ] ) { // Rotates vector about z-axis. new Float: fTmp[ 3 ]; CopyVec( fVec, fTmp ) fTmp[ 2 ] = 0.0 new Float: fDestLen = GetVecLen( fTmp ) CopyVec( fDirection, fTmp ) fTmp[ 2 ] = 0.0 new Float: fTmp2[ 3 ]; Normalize( fTmp, fTmp2, fDestLen ) fTmp2[ 2 ] = fVec[ 2 ] CopyVec( fTmp2, fRet ) }
Float: VectorProduct( Float: fVec1[ 3 ], Float: fVec2[ 3 ] ) return fVec1[ 0 ] * fVec2[ 0 ] + fVec1[ 1 ] * fVec2[ 1 ] + fVec1[ 2 ] * fVec2[ 2 ]
CopyVec( Float: fVec[ 3 ], Float: fRet[ 3 ] ) { fRet[ 0 ] = fVec[ 0 ] fRet[ 1 ] = fVec[ 1 ] fRet[ 2 ] = fVec[ 2 ] }
SubVec( Float: fVec1[ 3 ], Float: fVec2[ 3 ], Float: fRet[ 3 ] ) { fRet[ 0 ] = fVec1[ 0 ] - fVec2[ 0 ] fRet[ 1 ] = fVec1[ 1 ] - fVec2[ 1 ] fRet[ 2 ] = fVec1[ 2 ] - fVec2[ 2 ] }
AddVec( Float: fVec1[ 3 ], Float: fVec2[ 3 ] ) { fVec1[ 0 ]+= fVec2[ 0 ] fVec1[ 1 ]+= fVec2[ 1 ] fVec1[ 2 ]+= fVec2[ 2 ] }
// Temporary Entities -------------------------------------------------------------------------------------------------------- // All messages are sent with MSG_ONE_UNRELIABLE flag to avoid overflow in case of very low esp_timer setting and much targets.
Make_TE_BEAMENTPOINT( id, Float: fTargetOrigin[ 3 ], iWidth, iTargetTeam ) { message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, { 0, 0, 0 }, id ) write_byte( 1 ) write_short( id ) write_coord( floatround( fTargetOrigin[ 0 ] ) ) write_coord( floatround( fTargetOrigin[ 1 ] ) ) write_coord( floatround( fTargetOrigin[ 2 ] ) ) write_short( iLaser ) // Sprite index. write_byte( 1 ) // Starting frame. write_byte( 1 ) // Frame rate in 0.1's. write_byte( floatround( get_pcvar_float( g_pCvarESPTimer ) *10 ) ) // Life in 0.1's. write_byte( iWidth ) // Line width in 0.1's. write_byte( 0 ) // Noise amplitude in 0.01's. write_byte( iTeamColors[ iTargetTeam ][ 0 ] ) write_byte( iTeamColors[ iTargetTeam ][ 1 ] ) write_byte( iTeamColors[ iTargetTeam ][ 2 ] ) write_byte( 255 ) write_byte( 0 )// Scroll speed in 0.1's. message_end( ) }
Make_TE_BEAMPOINTS( id, iColor, Float: fVec1[ 3 ], Float: fVec2[ 3 ], iWidth, iBrightness ) { message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, { 0, 0, 0 }, id ) write_byte( 0 ) write_coord( floatround( fVec1[ 0 ] ) ) // Start position. write_coord( floatround( fVec1[ 1 ] ) ) write_coord( floatround( fVec1[ 2 ] ) ) write_coord( floatround( fVec2[ 0 ] ) ) // End position. write_coord( floatround( fVec2[ 1 ] ) ) write_coord( floatround( fVec2[ 2 ] ) ) write_short( iLaser ) // Sprite index. write_byte( 3 ) // Starting frame. write_byte( 0 ) // Frame rate in 0.1's. write_byte( floatround( get_pcvar_float( g_pCvarESPTimer ) *10 ) ) // Life in 0.1's. write_byte( iWidth ) // Line width in 0.1's. write_byte( 0 ) // Noise amplitude in 0.01's. write_byte( iEspColors[ iColor ][ 0 ] ) write_byte( iEspColors[ iColor ][ 1 ] ) write_byte( iEspColors[ iColor ][ 2 ] ) write_byte( iBrightness ) // Brightness. write_byte( 0 ) // Scroll speed in 0.1's. message_end( ) }
public client_disconnect( id ) { SaveData( id ) bAdmin[ id ] = false g_iSpectator[ id ] = 0 }
stock ChatColor( id, szInput[ ], any:... ) { new iCount = 1, g_iPlayers[ 32 ]; static iMsgId[ 191 ]; vformat( iMsgId, 190, szInput, 3 );
replace_all( iMsgId, 190, "!y", "^1" ); // Default Color replace_all( iMsgId, 190, "!g", "^4" ); // Green Color replace_all( iMsgId, 190, "!team", "^3" ); // Team Color if( id ) g_iPlayers[ 0 ] = id; else get_players( g_iPlayers, iCount, "ch" ); { for( new i = 0; i < iCount; i++ ) { if( is_user_connected( g_iPlayers[ i ] ) ) { message_begin( MSG_ONE_UNRELIABLE, g_iMsgSayText, _, g_iPlayers[ i ] ); write_byte( g_iPlayers[ i ] ); write_string( iMsgId ); message_end( ); } } } } 4. sambo кидал какую-то версию во 2 спойлере 1.5b_m: Сообщение 2какая-то версия 1.5b_m до 400 строк Код:
#include <amxmodx> #include <fakemeta> // Here you can adjust the required admin level if needed // there is a list of all levels <a href="https://c-s.net.ua/url?u=http%3A%2F%2Fwww.amxmodx.org%2Ffuncwiki.php%3Fgo%3Dmodule%26amp%3Bid%3D1%23const_admin" target="_blank">http://www.amxmodx.org/funcwiki.php?go=mod...d=1#const_admin</a> #define REQUIRED_ADMIN_LEVEL ADMIN_BAN //-------------------------------------------------------------------------------------------------- #define PLUGIN "Admin <span class="searchlite">ESP</span>" #define VERSION "1.5b_m" #define AUTHOR "KoST" #define OFFSET_TEAM 114 new const g_szPlugin[] = PLUGIN; // Global this since it is used throughout new pcvar_esp, pcvar_esp_timer; new esp_colors[5][3] = {{0,255,0}, {100,60,60}, {60,60,100}, {255,0,255}, {128,128,128}}; new bool:admin[33]; // is/is not admin new bool:first_person[33]; // is/is not in first person view new bool:ducking[33]; // is/is not player ducked new bool:enabled[33]; // has <span class="searchlite">esp</span> on new spec[33]; // spec[player_id]=the players id if new laser; // precached model new max_players; // if you start hlds with +maxplayers 20 for example this would be 20 new damage_done_to[33]; // damage_done_to[p1]=p2 // p1 has hit p2 new view_target[33]; // attackers victim new ForwardCmdStart public plugin_precache() { laser = precache_model("sprites/laserbeam.spr"); } public plugin_init() { register_plugin(g_szPlugin, VERSION, AUTHOR); server_print("^n^t%s v%s, Copyright © 2006 by %s^n", g_szPlugin, VERSION, AUTHOR); // cvars pcvar_esp = register_cvar("<span class="searchlite">esp</span>", "1"); pcvar_esp_timer = register_cvar("esp_timer", "0.1"); register_cvar("aesp_version", VERSION, FCVAR_SERVER|FCVAR_UNLOGGED|FCVAR_SPONLY); // client commands register_clcmd("esp_toggle", "cmd_esp_toggle", REQUIRED_ADMIN_LEVEL, "Toggle <span class="searchlite">ESP</span> on/off"); register_clcmd("say /esp_toggle", "cmd_esp_toggle", REQUIRED_ADMIN_LEVEL, "Toggle <span class="searchlite">ESP</span> on/off"); // events register_event("StatusValue", "spec_target", "bd", "1=2"); register_event("SpecHealth2", "spec_target", "bd"); register_event("TextMsg", "spec_mode", "b", "2&#Spec_Mode"); register_event("Damage", "event_Damage", "b", "2!0", "3=0", "4!0"); register_event("ResetHUD", "reset_hud_alive", "be"); max_players = get_maxplayers(); // start esp_timer for the first time set_task(1.0, "esp_timer"); } public client_putinserver(id) { first_person[id] = false; new args[1]; args[0] = id; set_task(4.0, "delayed_putinserver", id + 100, args, 1); } public delayed_putinserver(args[0]) { new id = args[0]; if (!is_user_connected(id)) { return PLUGIN_HANDLED; } if (get_user_flags(id) & REQUIRED_ADMIN_LEVEL) { admin[id] = true; init_admin_options(id); } else { admin[id] = false; } return PLUGIN_CONTINUE; } public client_disconnect(id) { save2vault(id); admin[id] = false; spec[id] = 0; remove_task(id + 100); } public reset_hud_alive(id) { spec[id] = 0; } public cmd_esp_toggle(id) { if (admin[id] && get_pcvar_num(pcvar_esp) == 1) { change_esp_status(id, !enabled[id]); } } public event_Damage(id) { if (id>0) { new attacker = get_user_attacker(id) if (attacker > 0 && attacker <= max_players) { if (view_target[attacker] == id) { damage_done_to[attacker] = id; } } } return PLUGIN_CONTINUE; } public spec_mode(id) { // discover if in first_person_view new specMode[12] read_data(2, specMode, 11); if(equal(specMode, "#Spec_Mode4")) { first_person[id] = true; ForwardCmdStart = register_forward(FM_CmdStart,"cmdStart"); } else { first_person[id] = false; unregister_forward(FM_CmdStart,ForwardCmdStart); } return PLUGIN_CONTINUE; } public spec_target(id) { if (id > 0) { new target = read_data(2); if (target != 0) { spec[id] = target; } } return PLUGIN_CONTINUE; } init_admin_options(id) { enabled[id] = true; load_vault_data(id); } save2vault(id) { if (admin[id]) { new authid[35]; get_user_authid (id,authid,34); new tmp[3]; tmp[0] = (enabled[id]) ? '1' : '0'; new key[41]; formatex(key, 40, "AESPmini_%s", authid); set_vaultdata(key, tmp); } } load_vault_data(id) { if (admin[id]) { new data[3]; new authid[35]; get_user_authid (id,authid,34); new key[41]; formatex(key,40, "AESPmini_%s", authid); get_vaultdata(key,data,2); if (strlen(data) > 0) { enabled[id] = (data[0]=='1'); } } } change_esp_status(id, bool:on) { if (on) { enabled[id] = true; client_print(id, print_chat, "[%s] ON", g_szPlugin); } else { enabled[id] = false; client_print(id, print_chat, "[%s] OFF", g_szPlugin); } } public cmdStart(id) { if (!is_user_connected(id)) return FMRES_IGNORED; static button; button = pev(id, pev_button); if (button==0) return FMRES_IGNORED; // saves a lot of cpu static oldbutton; oldbutton = pev(id, pev_oldbuttons); if (button & IN_DUCK) { ducking[id] = true; } else { ducking[id] = false; } if (get_pcvar_num(pcvar_esp) == 1) { if (admin[id]) { if (first_person[id] && !is_user_alive(id)) { if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD) && !enabled[id]) { change_esp_status(id, true); } if ((button & IN_BACK) && !(oldbutton & IN_BACK) && enabled[id]) { change_esp_status(id, false); } } } } return FMRES_HANDLED; } public esp_timer() { if (get_pcvar_num(pcvar_esp) != 1) { // if <span class="searchlite">esp</span> is not 1, it is off set_task(1.0, "esp_timer"); // check for reactivation in 1 sec intervals return PLUGIN_CONTINUE; } static spec_id, Float:my_origin[3], my_team, s, target_team, Float:target_origin[3], Float:distance, Float:v_middle[3], Float:v_hitpoint[3], Float:distance_to_hitpoint, Float:scaled_bone_len, Float:scaled_bone_width, Float:v_bone_start[3], Float:v_bone_end[3], Float:offset_vector[3], Float:eye_level[3], Float:distance_target_hitpoint, actual_bright, color for (new i = 1; i <= max_players; i++) { // loop through players if (enabled[i] && first_person[i] && is_user_connected(i) && admin[i] && (!is_user_alive(i)) && (spec[i] > 0) && is_user_alive(spec[i])) { // :) spec_id = spec[i]; pev(i, pev_origin, my_origin); // get origin of spectating admin // get team of spectated :) my_team = get_pdata_int(spec_id, OFFSET_TEAM); for (s = 1; s <= max_players; s++) { // loop through the targets if (is_user_alive(s)) { // target must be alive // get team of target target_team = get_pdata_int(s, OFFSET_TEAM); if (!(target_team == 3)) { //if not spectator if (spec_id != s) { // do not target myself // if the target is in the other team and not spectator if (((my_team != target_team && (target_team == 1 || target_team == 2)) )) { // get origin of target pev(s, pev_origin, target_origin); // get distance from me to target distance = vector_distance(my_origin, target_origin); // get vector from me to target subVec(target_origin, my_origin, v_middle); // trace from me to target, getting hitpoint engfunc(EngFunc_TraceLine, my_origin, target_origin, 1, -1, 0); get_tr2(0, TR_vecEndPos, v_hitpoint); // get distance from me to hitpoint (nearest wall) distance_to_hitpoint = vector_distance(my_origin, v_hitpoint); // scale if (ducking[spec_id]) { scaled_bone_len = distance_to_hitpoint / distance * (50.0-18.0); } else { scaled_bone_len = distance_to_hitpoint / distance * 50.0; } scaled_bone_len = distance_to_hitpoint / distance * 50.0; scaled_bone_width = distance_to_hitpoint / distance * 150.0; // get the point 10.0 units away from wall normalize(v_middle, offset_vector, distance_to_hitpoint - 10.0); // offset from wall // set to eye level copyVec(my_origin, eye_level); if (ducking[spec_id]) { eye_level[2] += 12.3 } else { eye_level[2] += 17.5 } addVec(offset_vector, eye_level); // start and end of green box copyVec(offset_vector, v_bone_start); copyVec(offset_vector, v_bone_end); v_bone_end[2] -= scaled_bone_len; distance_target_hitpoint = distance - distance_to_hitpoint; actual_bright = 255; // Draw BOX // this is to make green box darker if distance is larger if (distance_target_hitpoint < 2040.0) { actual_bright = (255 - floatround(distance_target_hitpoint / 12.0)); } else { actual_bright = 72; } if (distance_to_hitpoint != distance) { // if no line of sight color = 0; } else { // if line of sight color = target_team; } if (damage_done_to[spec_id] == s) { color = 3; damage_done_to[spec_id] = 0; } make_TE_BEAMPOINTS(i, color, v_bone_start, v_bone_end, floatround(scaled_bone_width), actual_bright); } } } } } // inner player loop end } } set_task(get_pcvar_float(pcvar_esp_timer), "esp_timer"); // keep it going return PLUGIN_CONTINUE; } // Vector Operations ------------------------------------------------------------------------------- Float:getVecLen(Float:Vec[3]) { new Float:VecNull[3] = {0.0,0.0,0.0}; new Float:len = vector_distance(Vec, VecNull); return len; } normalize(Float:Vec[3], Float:Ret[3], Float:multiplier) { new Float:len = getVecLen(Vec); copyVec(Vec, Ret); Ret[0] /= len; Ret[1] /= len; Ret[2] /= len; Ret[0] *= multiplier; Ret[1] *= multiplier; Ret[2] *= multiplier; } copyVec(Float:Vec[3], Float:Ret[3]) { Ret[0] = Vec[0]; Ret[1] = Vec[1]; Ret[2] = Vec[2]; } subVec(Float:Vec1[3], Float:Vec2[3], Float:Ret[3]) { Ret[0] = Vec1[0] - Vec2[0]; Ret[1] = Vec1[1] - Vec2[1]; Ret[2] = Vec1[2] - Vec2[2]; } addVec(Float:Vec1[3], Float:Vec2[3]) { Vec1[0] += Vec2[0]; Vec1[1] += Vec2[1]; Vec1[2] += Vec2[2]; } // Temporary Entities ------------------------------------------------------------------------------ // there is a list of much more temp entities at: <a href="https://c-s.net.ua/url?u=http%3A%2F%2Fdjeyl.net%2Fforum%2Findex.php%3Fact%3DAttach%26amp%3Btype%3Dpost%26amp%3Bid%3D290870" target="_blank">http://djeyl.net/forum/index.php?act=Attac...t&id=290870</a> // all messages are sent with MSG_ONE_UNRELIABLE flag to avoid overflow in case of very low esp_timer setting and much targets make_TE_BEAMPOINTS(id,color, Float:Vec1[3], Float:Vec2[3], width, brightness) { message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0,0,0}, id); //message begin write_byte(0); write_coord(floatround(Vec1[0])); // start position write_coord(floatround(Vec1[1])); write_coord(floatround(Vec1[2])); write_coord(floatround(Vec2[0])); // end position write_coord(floatround(Vec2[1])); write_coord(floatround(Vec2[2])); write_short(laser); // sprite index write_byte(3); // starting frame write_byte(0); // frame rate in 0.1's write_byte(floatround(get_pcvar_float(pcvar_esp_timer) * 10)); // life in 0.1's write_byte(width); // line width in 0.1's write_byte(0); // noise amplitude in 0.01's write_byte(esp_colors[color][0]); write_byte(esp_colors[color][1]); write_byte(esp_colors[color][2]); write_byte(brightness); // brightness) write_byte(0); // scroll speed in 0.1's message_end(); } 5. dead_best предоставил код версии 1.6: Сообщение 12Код:
#include <amxmodx> #include <fakemeta> #define PLUGIN "Admin Spectator ESP" #define VERSION "1.6" #define AUTHOR "KoST" #define OFFSET_TEAM 114 enum { ESP_ON = 0, ESP_LINE, ESP_BOX } new bool:admin[33], bool:first_person[33], bool:ducking[33], bool:admin_options[33][10], bool:is_in_menu[33] new team_colors[4][3]={{0,0,0},{150,0,0},{0,0,150},{0,150,0}} new esp_colors[5][3]={{0,255,0},{100,60,60},{60,60,100},{255,0,255},{128,128,128}} new view_target[33], damage_done_to[33], spec[33], pcvar_esp_default_keys, laser, max_players public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) pcvar_esp_default_keys = register_cvar("esp_disable_default_keys","0") register_clcmd("esp_menu", "cmd_esp_menu", ADMIN_KICK, "Shows ESP Menu") register_clcmd("esp_toggle", "cmd_esp_toggle", ADMIN_KICK, "Toggle ESP on/off") register_clcmd("esp_setting", "cmd_esp_settings", ADMIN_KICK, "ESP adasdsassdasd") register_event("StatusValue", "spec_target", "bd", "1=2") register_event("SpecHealth2", "spec_target", "bd") register_event("TextMsg", "spec_mode", "b", "2&#Spec_Mode") register_event("Damage", "event_Damage", "b", "2!0", "3=0", "4!0") register_event("ResetHUD", "reset_hud_alive", "be") register_forward(FM_PlayerPreThink, "fwdPlayerPreThink") new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2 register_menucmd(register_menuid("Admin Specator ESP"), keys, "menu_esp") max_players = get_maxplayers() set_task(1.0, "esp_timer") } public plugin_precache() laser=precache_model("sprites/laserbeam.spr") public client_putinserver(id) { first_person[id]=false if (get_user_flags(id) & ADMIN_KICK) { admin[id]=true init_admin_options(id) } else admin[id]=false } public client_disconnect(id) { save2vault(id) admin[id] = false spec[id] = 0 } public reset_hud_alive(id) spec[id] = 0 public cmd_esp_settings(id) { if (admin[id]) { new out[11], len = strlen(out) read_argv(1, out, 4) for (new i=0;i<len;i++) { if (out[i]=='1') admin_options[id][i]=true else admin_options[id][i]=false } } } public cmd_esp_menu(id) { if (admin[id]) { show_esp_menu(id) } } public cmd_esp_toggle(id) { if (admin[id]) { change_esp_status(id, !admin_options[id][0]) } } show_esp_menu(id) { is_in_menu[id] = true new menu[501] new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2 new onoff[2][] = {{"\roff\w"},{"\yon\w"}} new text[2][] = {{"(use move forward/backward to switch on/off)"},{"(use esp_toggle command to toggle)"}} new text_index = get_pcvar_num(pcvar_esp_default_keys) if (text_index!=1) text_index=0 formatex(menu, 500, "Admin Specator ESP^n %s %s^n^n1. Линии %s^n2. Квадраты %s^n^n0. Выход", onoff[admin_options[id][ESP_ON]], text[text_index], onoff[admin_options[id][ESP_LINE]], onoff[admin_options[id][ESP_BOX]]) show_menu(id, keys,menu) return PLUGIN_HANDLED } public menu_esp(id, key) { if (key==9) { is_in_menu[id]=false return PLUGIN_HANDLED } if (admin_options[id][key+1]) admin_options[id][key+1]=false else admin_options[id][key+1]=true show_esp_menu(id) return PLUGIN_HANDLED } public event_Damage(id) { if (id>0) { new attacker=get_user_attacker(id) if (attacker>0 && attacker<=max_players) { if (view_target[attacker]==id) damage_done_to[attacker]=id } } return PLUGIN_CONTINUE } public spec_mode(id) { new specMode[12] read_data(2, specMode, 11) if(equal(specMode,"#Spec_Mode4")) first_person[id]=true else first_person[id]=false return PLUGIN_CONTINUE } public spec_target(id) { if (id>0) { new target=read_data(2) if (target!=0) spec[id]=target } return PLUGIN_CONTINUE } init_admin_options(id) { for (new i=0;i<4;i++) { admin_options[id][i] = true } load_vault_data(id) } save2vault(id) { if (admin[id]) { new authid[35], tmp[11], key[41] get_user_authid(id, authid, charsmax(authid)) for (new s=0;s<4;s++) { if (admin_options[id][s]) tmp[s]='1' else tmp[s]='0' } tmp[4]=0 formatex(key, charsmax(key), "ESP_%s", authid) set_vaultdata(key, tmp) } } load_vault_data(id) { if (admin[id]) { new data[11], authid[35], key[41] get_user_authid (id, authid, charsmax(authid)) formatex(key, 40, "ESP_%s", authid) get_vaultdata(key, data, 4) if (strlen(data) > 0) { for (new s=0;s<4;s++) { if (data[s]=='1') admin_options[id][s]=true else admin_options[id][s]=false } } } } change_esp_status(id, bool:on) { if (on) { admin_options[id][0] = true if (!is_in_menu[id]) client_print(id, print_chat, "[%s] ON", PLUGIN) if (is_in_menu[id]) show_esp_menu(id) } else { admin_options[id][0] = false if (!is_in_menu[id]) client_print(id, print_chat, "[%s] OFF", PLUGIN) if (is_in_menu[id]) show_esp_menu(id) } } public fwdPlayerPreThink(id) { if (!is_user_connected(id)) return FMRES_IGNORED static button, oldbutton button=pev(id, pev_button) if (button==0) return FMRES_IGNORED oldbutton=pev(id, pev_oldbuttons) if (button & IN_DUCK) ducking[id]=true else ducking[id]=false if (get_pcvar_num(pcvar_esp_default_keys) !=1) { if (admin[id]) { if (first_person[id] && !is_user_alive(id)) { if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD) && !admin_options[id][0]) { change_esp_status(id, true) } if ((button & IN_BACK) && !(oldbutton & IN_BACK) && admin_options[id][0]) { change_esp_status(id, false) } } } } return FMRES_HANDLED } public esp_timer() { static spec_id, Float:my_origin[3], my_team, target_team, Float:target_origin[3], Float:distance, width, Float:v_middle[3], Float:v_hitpoint[3], Float:distance_to_hitpoint, Float:scaled_bone_len, Float:scaled_bone_width, Float:v_bone_start[3], Float:v_bone_end[3], Float:offset_vector[3], Float:eye_level[3], Float:distance_target_hitpoint, actual_bright, color for (new i=1;i<=max_players;i++) { if (admin_options[i][ESP_ON] && first_person[i] && is_user_connected(i) && admin[i] && (!is_user_alive(i)) && (spec[i]>0) && is_user_alive(spec[i])) { spec_id=spec[i] pev(i, pev_origin, my_origin) my_team = get_pdata_int(spec_id, OFFSET_TEAM) for (new s=1;s<=max_players;s++) { if (is_user_alive(s)) { target_team = get_pdata_int(s, OFFSET_TEAM) if (!(target_team ==3)) { if (spec_id !=s) { if (((my_team != target_team && (target_team ==1 || target_team ==2)))) { pev(s, pev_origin, target_origin) distance=vector_distance(my_origin, target_origin) if (admin_options[i][ESP_LINE]) { if (distance<2040.0) width=(255-floatround(distance/8.0))/3 else width=1 make_TE_BEAMENTPOINT(i, target_origin, width,target_team) } subVec(target_origin,my_origin,v_middle) engfunc(EngFunc_TraceLine, my_origin, target_origin, 1, -1, 0) get_tr2(0, TR_vecEndPos, v_hitpoint) distance_to_hitpoint = vector_distance(my_origin, v_hitpoint) if (ducking[spec_id]) scaled_bone_len=distance_to_hitpoint/distance*(50.0-18.0) else scaled_bone_len=distance_to_hitpoint/distance*50.0 scaled_bone_len=distance_to_hitpoint/distance*50.0 scaled_bone_width=distance_to_hitpoint/distance*150.0 normalize(v_middle,offset_vector,distance_to_hitpoint-10.0) copyVec(my_origin,eye_level) if (ducking[spec_id]) eye_level[2]+=12.3 else eye_level[2]+=17.5 addVec(offset_vector,eye_level) copyVec(offset_vector,v_bone_start) copyVec(offset_vector,v_bone_end) v_bone_end[2]-=scaled_bone_len distance_target_hitpoint=distance-distance_to_hitpoint actual_bright=255 if (admin_options[i][ESP_BOX]) { if (distance_target_hitpoint<2040.0) actual_bright=(255-floatround(distance_target_hitpoint/12.0)) else actual_bright=85 if (distance_to_hitpoint!=distance) color=0 else color=target_team if (damage_done_to[spec_id]==s) { color=3 damage_done_to[spec_id]=0 } make_TE_BEAMPOINTS(i,color,v_bone_start,v_bone_end,floatround(scaled_bone_width) ,actual_bright) } } } } } } } } set_task(0.4, "esp_timer") return PLUGIN_CONTINUE } Float:getVecLen(Float:Vec[3]) { new Float:VecNull[3]={0.0,0.0,0.0} new Float:len=vector_distance(Vec,VecNull) return len } normalize(Float:Vec[3],Float:Ret[3],Float:multiplier) { new Float:len=getVecLen(Vec) copyVec(Vec,Ret) Ret[0]/=len Ret[1]/=len Ret[2]/=len Ret[0]*=multiplier Ret[1]*=multiplier Ret[2]*=multiplier } copyVec(Float:Vec[3],Float:Ret[3]) { Ret[0]=Vec[0] Ret[1]=Vec[1] Ret[2]=Vec[2] } subVec(Float:Vec1[3],Float:Vec2[3],Float:Ret[3]) { Ret[0]=Vec1[0]-Vec2[0] Ret[1]=Vec1[1]-Vec2[1] Ret[2]=Vec1[2]-Vec2[2] } addVec(Float:Vec1[3],Float:Vec2[3]) { Vec1[0]+=Vec2[0] Vec1[1]+=Vec2[1] Vec1[2]+=Vec2[2] } make_TE_BEAMPOINTS(id,color,Float:Vec1[3],Float:Vec2[3],width,brightness) { message_begin(MSG_ONE_UNRELIABLE ,SVC_TEMPENTITY,{0,0,0},id) write_byte(0) write_coord(floatround(Vec1[0])) write_coord(floatround(Vec1[1])) write_coord(floatround(Vec1[2])) write_coord(floatround(Vec2[0])) write_coord(floatround(Vec2[1])) write_coord(floatround(Vec2[2])) write_short(laser) write_byte(3) write_byte(0) write_byte(3) write_byte(width) write_byte(0) write_byte(esp_colors[color][0]) write_byte(esp_colors[color][1]) write_byte(esp_colors[color][2]) write_byte(brightness) write_byte(0) message_end() } make_TE_BEAMENTPOINT(id,Float:target_origin[3],width,target_team) { message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,{0,0,0},id) write_byte(1) write_short(id) write_coord(floatround(target_origin[0])) write_coord(floatround(target_origin[1])) write_coord(floatround(target_origin[2])) write_short(laser) write_byte(1) write_byte(1) write_byte(3) write_byte(width) write_byte(0) write_byte(team_colors[target_team][0]) write_byte(team_colors[target_team][1]) write_byte(team_colors[target_team][2]) write_byte(255) write_byte(0) message_end() }
Отредактировал: intercs, - 16.12.2013, 21:34
|