hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.29. 13:27



Jelenlévő felhasználók

Jelenleg 315 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 315 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: TÖRÖLHETŐ!
HozzászólásElküldve: 2014.01.19. 21:46 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 495
Megköszönt másnak: 289 alkalommal
Megköszönték neki: 14 alkalommal
Szeretném, ha valaki át tudná alakítani úgy, hogy ns adminok is tuják használni. Előre is köszönöm.

SMA Forráskód: [ Mindet kijelol ]//--------------------------------------------------------------------------------------------------   #include <amxmodx> #include <engine>   // Here you can adjust the required admin level if needed // there is a list of all levels http://www.amxmodx.org/funcwiki.php?go= ... onst_admin   #define REQUIRED_ADMIN_LEVEL ADMIN_KICK   //--------------------------------------------------------------------------------------------------   #define PLUGIN "Admin Spectator ESP" #define VERSION "1.3" #define AUTHOR "KoST"   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   // 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 (C) 2006 by %s^n",PLUGIN,VERSION,AUTHOR)  register_clcmd("amx_login", "checkadmin");  // cvars  register_cvar("esp","1")  register_cvar("esp_timer","0.3")  register_cvar("esp_allow_all","0")  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")      // 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  return PLUGIN_CONTINUE }   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_cvar_num("esp")==1){  show_esp_menu(id)  } }   public cmd_esp_toggle(id){  if (admin[id] && get_cvar_num("esp")==1){  change_esp_status(id,!admin_options[id][0])  } }   public 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][]={{"\ki\"},{"\be\"}} // \r=Piros \y=Sarga \w=Feher  new text[2][]={{"(Itt tudod ki/be kapcsolni az admin wh funkcioit)"},{"(use esp_toggle command to toggle)"}} // \r=Piros \y=Sarga \w=Feher  new text_index=get_cvar_num("esp_disable_default_keys")  if (text_index!=1) text_index=0  format(menu, 300, "Admin Specator ESP^n %s %s^n^n1. Vonal %s^n2. HitBox %s^n3. Nev %s^n4. Hp/Ap %s^n5. Fegyver %s^n6. Loszer %s^n7. Tavolsag %s^n8. Csapattars %s^n9. AimVektor %s^n^n0. Kilep",  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_cvar_num("esp_allow_all")==1){  admin[id]=true  init_admin_options(id)    }else{  admin[id]=false  } } public checkadmin(id) {  if ((get_user_flags(id) & REQUIRED_ADMIN_LEVEL) || get_cvar_num("esp_allow_all")==1){  admin[id]=true  init_admin_options(id)    }else{  admin[id]=false  }  return PLUGIN_CONTINUE; } public 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) }   public 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]  format(key,40,"AESP_%s",authid)    set_vaultdata(key,tmp)  } }   public load_vault_data(id){  if (admin[id]){  new data[11]  new authid[35]  get_user_authid (id,authid,34)  new key[41]  format(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 }   public change_esp_status(id,bool:on){  if (on){  admin_options[id][0]=true  if (!is_in_menu[id]) client_print(id,print_chat,"[%s] BEKAPCSOLVA",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] KIKAPCSOLVA",PLUGIN)  if (is_in_menu[id]) show_esp_menu(id)  } }   public client_PreThink(id){  if (!is_user_connected(id)) return PLUGIN_CONTINUE    new button=get_user_button(id)  if (button==0) return PLUGIN_CONTINUE // saves a lot of cpu    new oldbutton=get_user_oldbutton(id)    if (button & IN_DUCK){  ducking[id]=true  }else{  ducking[id]=false  }    if ((get_cvar_num("esp")==1) && (get_cvar_num("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 PLUGIN_CONTINUE }   public 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  VelocityByAim(s,len,endpoint) // get aim vector  addVec(endpoint,vec1) // add origin to get absolute coordinates  make_TE_BEAMPOINTS(i,4,vec1,endpoint,10,0,255)  return PLUGIN_CONTINUE }   public esp_timer(){    if (get_cvar_num("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  }    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])){ // <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->    new spec_id=spec[i]  new Float:my_origin[3]  entity_get_vector(i,EV_VEC_origin,my_origin) // get origin of spectating admin  new my_team  my_team=get_team(spec_id) // get team of spectated <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->    new Float:smallest_angle=180.0  new smallest_id=0  new Float:xp=2.0,Float:yp=2.0 // x,y of hudmessage  new Float:dist    for (new s=1;s<=max_players;s++){ // loop through the targets  if (is_user_alive(s)){ // target must be alive  new target_team=get_team(s) // get team of target  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])){    new Float:target_origin[3]  // get origin of target  entity_get_vector(s,EV_VEC_origin,target_origin)      // get distance from me to target  new Float:distance=vector_distance(my_origin,target_origin)    if (admin_options[i][ESP_LINE]){    new width  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  new Float:v_middle[3]  subVec(target_origin,my_origin,v_middle)    // trace from me to target, getting hitpoint  new Float:v_hitpoint[3]  trace_line (-1,my_origin,target_origin,v_hitpoint)    // get distance from me to hitpoint (nearest wall)  new Float:distance_to_hitpoint=vector_distance(my_origin,v_hitpoint)    // scale  new Float:scaled_bone_len  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    new Float:scaled_bone_width=distance_to_hitpoint/distance*150.0    new Float:v_bone_start[3],Float:v_bone_end[3]  new Float:offset_vector[3]  // 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  new Float:eye_level[3]  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    new Float:distance_target_hitpoint=distance-distance_to_hitpoint    new 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  }   new color  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),target_team,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]){      new Float:ret[2]  new Float: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_cvar_float("esp_timer"), 0.0, 0.0, 2)    new name[37]=""  new tmp[33]  get_user_name(smallest_id,tmp,32)  if (admin_options[i][ESP_NAME]){  format(name,36,"[%s]^n",tmp)  }      new health[25]=""  if (admin_options[i][ESP_HEALTH_ARMOR]){  new hp=get_user_health(smallest_id)  new armor=get_user_armor(smallest_id)  format(health,24,"health: %d armor: %d^n",hp,armor)  }      new clip_ammo[22]=""  new clip,ammo  new weapon_id=get_user_weapon(smallest_id,clip,ammo)  if (admin_options[i][ESP_CLIP_AMMO]){  format(clip_ammo,21,"clip: %d ammo: %d^n",clip,ammo)  }    new weapon_name[21]=""  if (admin_options[i][ESP_WEAPON]){  if ((weapon_id-1)<0 || (weapon_id-1)>29) weapon_id=1  format(weapon_name,20,"weapon: %s^n",weapons[weapon_id-1])  //copy(weapon_name,9,weapons[weapon_id-1])  }    new str_dist[19]  if (admin_options[i][ESP_DISTANCE]){  format(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_cvar_float("esp_timer"),"esp_timer") // keep it going  return PLUGIN_CONTINUE  }   public Float:get_screen_pos(id,Float:v_me_to_target[3],Float:Ret[2]){  new Float:v_aim[3]  VelocityByAim(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 }   public 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 }   public 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 }   public get_team(id){  new team[2]  get_user_team(id,team,1)  switch(team[0]){  case 'T':{  return 1  }  case 'C':{  return 2  }  case 'S':{  return 3  }  default:{}  }  return 0 }   // Vector Operations -------------------------------------------------------------------------------   public Float:getVecLen(Float:Vec[3]){  new Float:VecNull[3]={0.0,0.0,0.0}  new Float:len=vector_distance(Vec,VecNull)  return len }   public 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) }   public 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 }   public 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) }   public Float:vectorProduct(Float:Vec1[3],Float:Vec2[3]){  return Vec1[0]*Vec2[0]+Vec1[1]*Vec2[1]+Vec1[2]*Vec2[2] }   public copyVec(Float:Vec[3],Float:Ret[3]){  Ret[0]=Vec[0]  Ret[1]=Vec[1]  Ret[2]=Vec[2] }   public 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] }   public 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?s=80ec ... &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   public make_TE_BEAMPOINTS(id,color,Float:Vec1[3],Float:Vec2[3],width,target_team,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_cvar_float("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() }   public 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_cvar_float("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() } 


A hozzászólást 1 alkalommal szerkesztették, utoljára ZiT3K 2021.02.13. 03:34-kor.

Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: ADMIN WH átalakítás
HozzászólásElküldve: 2014.01.23. 20:46 
Offline
Tud valamit

Csatlakozott: 2012.04.16. 22:32
Hozzászólások: 104
Megköszönt másnak: 14 alkalommal
Megköszönték neki: 10 alkalommal
Nem tudom, hogy lehet megoldani.
Akinek loginos adminja van töltsön le olyan cs-t, aminek van STEAM-ID-je, és arra adz neki. pl: WaRZoNe

_________________
Ha segítettem: Kép

Kép

Ők köszönték meg White#Angel nek ezt a hozzászólást: ZiT3K (2014.01.27. 07:55)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: ADMIN WH átalakítás
HozzászólásElküldve: 2014.01.25. 08:38 
Offline
Nagyúr
Avatar

Csatlakozott: 2012.09.23. 09:50
Hozzászólások: 569
Megköszönt másnak: 76 alkalommal
Megköszönték neki: 37 alkalommal
ZiT3K írta:
Szeretném, ha valaki át tudná alakítani úgy, hogy ns adminok is tuják használni. Előre is köszönöm.

SMA Forráskód: [ Mindet kijelol ]
  1. //--------------------------------------------------------------------------------------------------
  2.  
  3.  
  4.  
  5. #include <amxmodx>
  6.  
  7. #include <engine>
  8.  
  9.  
  10.  
  11. // Here you can adjust the required admin level if needed
  12.  
  13. // there is a list of all levels http://www.amxmodx.org/funcwiki.php?go= ... onst_admin
  14.  
  15.  
  16.  
  17. #define REQUIRED_ADMIN_LEVEL ADMIN_KICK
  18.  
  19.  
  20.  
  21. //--------------------------------------------------------------------------------------------------
  22.  
  23.  
  24.  
  25. #define PLUGIN "Admin Spectator ESP"
  26.  
  27. #define VERSION "1.3"
  28.  
  29. #define AUTHOR "KoST"
  30.  
  31.  
  32.  
  33. enum {
  34.  
  35. ESP_ON=0,
  36.  
  37. ESP_LINE,
  38.  
  39. ESP_BOX,
  40.  
  41. ESP_NAME,
  42.  
  43. ESP_HEALTH_ARMOR,
  44.  
  45. ESP_WEAPON,
  46.  
  47. ESP_CLIP_AMMO,
  48.  
  49. ESP_DISTANCE,
  50.  
  51. ESP_TEAM_MATES,
  52.  
  53. ESP_AIM_VEC,
  54.  
  55. }
  56.  
  57.  
  58.  
  59. new bool:admin[33] // is/is not admin
  60.  
  61. new bool:first_person[33] //is/is not in first person view
  62.  
  63. new spec[33] // spec[player_id]=the players id if
  64.  
  65. new laser // precached model
  66.  
  67. new max_players // if you start hlds with +maxplayers 20 for example this would be 20
  68.  
  69. new team_colors[4][3]={{0,0,0},{150,0,0},{0,0,150},{0,150,0}}
  70.  
  71. new esp_colors[5][3]={{0,255,0},{100,60,60},{60,60,100},{255,0,255},{128,128,128}}
  72.  
  73. new bool:ducking[33] //is/is not player ducked
  74.  
  75. new damage_done_to[33] //damage_done_to[p1]=p2 // p1 has hit p2
  76.  
  77. new view_target[33] // attackers victim
  78.  
  79. new bool:admin_options[33][10] // individual esp options
  80.  
  81. new bool:is_in_menu[33] // has esp menu open
  82.  
  83.  
  84.  
  85. // weapon strings
  86.  
  87. new weapons[30][10]={"None","P228","Scout","HE","XM1014","C4",
  88.  
  89. "MAC-10","AUG","Smoke","Elite","Fiveseven",
  90.  
  91. "UMP45","SIG550","Galil","Famas","USP",
  92.  
  93. "Glock","AWP","MP5","M249","M3","M4A1",
  94.  
  95. "TMP","G3SG1","Flash","Deagle","SG552",
  96.  
  97. "AK47","Knife","P90"}
  98.  
  99.  
  100.  
  101. public plugin_precache(){
  102.  
  103. laser=precache_model("sprites/laserbeam.spr")
  104.  
  105. }
  106.  
  107.  
  108.  
  109. public plugin_init(){
  110.  
  111. register_plugin(PLUGIN,VERSION,AUTHOR)
  112.  
  113. server_print("^n^t%s v%s, Copyright (C) 2006 by %s^n",PLUGIN,VERSION,AUTHOR)
  114.  
  115. register_clcmd("amx_login", "checkadmin");
  116.  
  117. // cvars
  118.  
  119. register_cvar("esp","1")
  120.  
  121. register_cvar("esp_timer","0.3")
  122.  
  123. register_cvar("esp_allow_all","0")
  124.  
  125. register_cvar("esp_disable_default_keys","0")
  126.  
  127. register_cvar("aesp_version",VERSION,FCVAR_SERVER|FCVAR_UNLOGGED|FCVAR_SPONLY)
  128.  
  129.  
  130.  
  131. // client commands
  132.  
  133. register_clcmd("esp_menu","cmd_esp_menu",REQUIRED_ADMIN_LEVEL,"Shows ESP Menu")
  134.  
  135. register_clcmd("esp_toggle","cmd_esp_toggle",REQUIRED_ADMIN_LEVEL,"Toggle ESP on/off")
  136.  
  137. register_clcmd("say /esp_menu","cmd_esp_menu",REQUIRED_ADMIN_LEVEL,"Shows ESP Menu")
  138.  
  139. register_clcmd("say /esp_toggle","cmd_esp_toggle",REQUIRED_ADMIN_LEVEL,"Toggle ESP on/off")
  140.  
  141. register_clcmd("esp_settings","cmd_esp_settings",REQUIRED_ADMIN_LEVEL," ESP adasdsassdasd")
  142.  
  143.  
  144.  
  145.  
  146.  
  147. // events
  148.  
  149. register_event("StatusValue","spec_target","bd","1=2")
  150.  
  151. register_event("SpecHealth2","spec_target","bd")
  152.  
  153. register_event("TextMsg","spec_mode","b","2&#Spec_Mode")
  154.  
  155. register_event("Damage", "event_Damage", "b", "2!0", "3=0", "4!0")
  156.  
  157. register_event("ResetHUD", "reset_hud_alive", "be")
  158.  
  159.  
  160.  
  161.  
  162.  
  163. // menu
  164.  
  165. 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
  166.  
  167. register_menucmd(register_menuid("Admin Specator ESP"),keys,"menu_esp")
  168.  
  169.  
  170.  
  171. max_players=get_maxplayers()
  172.  
  173.  
  174.  
  175. // start esp_timer for the first time
  176.  
  177. set_task(1.0,"esp_timer")
  178.  
  179. }
  180.  
  181.  
  182.  
  183. public reset_hud_alive(id){
  184.  
  185. spec[id]=0
  186.  
  187. return PLUGIN_CONTINUE
  188.  
  189. }
  190.  
  191.  
  192.  
  193. public cmd_esp_settings(id){
  194.  
  195. if (admin[id]){
  196.  
  197. new out[11]
  198.  
  199. read_argv(1,out,10)
  200.  
  201. new len=strlen(out)
  202.  
  203. for (new i=0;i<len;i++){
  204.  
  205. if (out[i]=='1'){
  206.  
  207. admin_options[id][i]=true
  208.  
  209. }else{
  210.  
  211. admin_options[id][i]=false
  212.  
  213. }
  214.  
  215. }
  216.  
  217. }
  218.  
  219. }
  220.  
  221.  
  222.  
  223. public cmd_esp_menu(id){
  224.  
  225. if (admin[id] && get_cvar_num("esp")==1){
  226.  
  227. show_esp_menu(id)
  228.  
  229. }
  230.  
  231. }
  232.  
  233.  
  234.  
  235. public cmd_esp_toggle(id){
  236.  
  237. if (admin[id] && get_cvar_num("esp")==1){
  238.  
  239. change_esp_status(id,!admin_options[id][0])
  240.  
  241. }
  242.  
  243. }
  244.  
  245.  
  246.  
  247. public show_esp_menu(id){
  248.  
  249. is_in_menu[id]=true
  250.  
  251. new menu[301]
  252.  
  253. 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
  254.  
  255. new onoff[2][]={{"\ki\"},{"\be\"}} // \r=Piros \y=Sarga \w=Feher
  256.  
  257. new text[2][]={{"(Itt tudod ki/be kapcsolni az admin wh funkcioit)"},{"(use esp_toggle command to toggle)"}} // \r=Piros \y=Sarga \w=Feher
  258.  
  259. new text_index=get_cvar_num("esp_disable_default_keys")
  260.  
  261. if (text_index!=1) text_index=0
  262.  
  263. format(menu, 300, "Admin Specator ESP^n %s %s^n^n1. Vonal %s^n2. HitBox %s^n3. Nev %s^n4. Hp/Ap %s^n5. Fegyver %s^n6. Loszer %s^n7. Tavolsag %s^n8. Csapattars %s^n9. AimVektor %s^n^n0. Kilep",
  264.  
  265. onoff[admin_options[id][ESP_ON]],
  266.  
  267. text[text_index],
  268.  
  269. onoff[admin_options[id][ESP_LINE]],
  270.  
  271. onoff[admin_options[id][ESP_BOX]],
  272.  
  273. onoff[admin_options[id][ESP_NAME]],
  274.  
  275. onoff[admin_options[id][ESP_HEALTH_ARMOR]],
  276.  
  277. onoff[admin_options[id][ESP_WEAPON]],
  278.  
  279. onoff[admin_options[id][ESP_CLIP_AMMO]],
  280.  
  281. onoff[admin_options[id][ESP_DISTANCE]],
  282.  
  283. onoff[admin_options[id][ESP_TEAM_MATES]],
  284.  
  285. onoff[admin_options[id][ESP_AIM_VEC]])
  286.  
  287. show_menu(id,keys,menu)
  288.  
  289.  
  290.  
  291. return PLUGIN_HANDLED
  292.  
  293. }
  294.  
  295.  
  296.  
  297. public menu_esp(id,key){
  298.  
  299. if (key==9){ // exit
  300.  
  301. is_in_menu[id]=false
  302.  
  303. return PLUGIN_HANDLED
  304.  
  305. }
  306.  
  307. // toggle esp options
  308.  
  309. if (admin_options[id][key+1]){
  310.  
  311. admin_options[id][key+1]=false
  312.  
  313. }else{
  314.  
  315. admin_options[id][key+1]=true
  316.  
  317. }
  318.  
  319. show_esp_menu(id)
  320.  
  321. return PLUGIN_HANDLED
  322.  
  323. }
  324.  
  325.  
  326.  
  327. public event_Damage(id){
  328.  
  329. if (id>0) {
  330.  
  331. new attacker=get_user_attacker(id)
  332.  
  333. if (attacker>0 && attacker<=max_players){
  334.  
  335. if (view_target[attacker]==id){
  336.  
  337. damage_done_to[attacker]=id
  338.  
  339. }
  340.  
  341. }
  342.  
  343. }
  344.  
  345. return PLUGIN_CONTINUE
  346.  
  347. }
  348.  
  349.  
  350.  
  351. public spec_mode(id){
  352.  
  353. // discover if in first_person_view
  354.  
  355. new specMode[12]
  356.  
  357. read_data(2,specMode,11)
  358.  
  359.  
  360.  
  361. if(equal(specMode,"#Spec_Mode4")){
  362.  
  363. first_person[id]=true
  364.  
  365. }else{
  366.  
  367. first_person[id]=false
  368.  
  369. }
  370.  
  371. return PLUGIN_CONTINUE
  372.  
  373. }
  374.  
  375.  
  376.  
  377. public spec_target(id){
  378.  
  379. if (id>0){
  380.  
  381. new target=read_data(2)
  382.  
  383. if (target!=0){
  384.  
  385. spec[id]=target
  386.  
  387. }
  388.  
  389. }
  390.  
  391. return PLUGIN_CONTINUE
  392.  
  393. }
  394.  
  395.  
  396.  
  397. public client_putinserver(id){
  398.  
  399. first_person[id]=false
  400.  
  401. if ((get_user_flags(id) & REQUIRED_ADMIN_LEVEL) || get_cvar_num("esp_allow_all")==1){
  402.  
  403. admin[id]=true
  404.  
  405. init_admin_options(id)
  406.  
  407.  
  408.  
  409. }else{
  410.  
  411. admin[id]=false
  412.  
  413. }
  414.  
  415. }
  416.  
  417. public checkadmin(id)
  418.  
  419. {
  420.  
  421. if ((get_user_flags(id) & REQUIRED_ADMIN_LEVEL) || get_cvar_num("esp_allow_all")==1){
  422.  
  423. admin[id]=true
  424.  
  425. init_admin_options(id)
  426.  
  427.  
  428.  
  429. }else{
  430.  
  431. admin[id]=false
  432.  
  433. }
  434.  
  435. return PLUGIN_CONTINUE;
  436.  
  437. }
  438.  
  439. public init_admin_options(id){
  440.  
  441.  
  442.  
  443. for (new i=0;i<10;i++){
  444.  
  445. admin_options[id][i]=true
  446.  
  447. }
  448.  
  449. admin_options[id][ESP_TEAM_MATES]=false
  450.  
  451. load_vault_data(id)
  452.  
  453. }
  454.  
  455.  
  456.  
  457. public save2vault(id){
  458.  
  459. if (admin[id]){
  460.  
  461. new authid[35]
  462.  
  463. get_user_authid (id,authid,34)
  464.  
  465. new tmp[11]
  466.  
  467.  
  468.  
  469. for (new s=0;s<10;s++){
  470.  
  471.  
  472.  
  473. if (admin_options[id][s]){
  474.  
  475. tmp[s]='1';
  476.  
  477. }else{
  478.  
  479. tmp[s]='0';
  480.  
  481. }
  482.  
  483. }
  484.  
  485. tmp[10]=0
  486.  
  487.  
  488.  
  489. //server_print("STEAMID: %s OPTIONS: %s",authid,tmp);
  490.  
  491. new key[41]
  492.  
  493. format(key,40,"AESP_%s",authid)
  494.  
  495.  
  496.  
  497. set_vaultdata(key,tmp)
  498.  
  499. }
  500.  
  501. }
  502.  
  503.  
  504.  
  505. public load_vault_data(id){
  506.  
  507. if (admin[id]){
  508.  
  509. new data[11]
  510.  
  511. new authid[35]
  512.  
  513. get_user_authid (id,authid,34)
  514.  
  515. new key[41]
  516.  
  517. format(key,40,"AESP_%s",authid)
  518.  
  519. get_vaultdata(key,data,10)
  520.  
  521. if (strlen(data)>0){
  522.  
  523. for (new s=0;s<10;s++){
  524.  
  525. if (data[s]=='1'){
  526.  
  527. admin_options[id][s]=true
  528.  
  529. }else{
  530.  
  531. admin_options[id][s]=false
  532.  
  533. }
  534.  
  535. }
  536.  
  537. }
  538.  
  539. }
  540.  
  541.  
  542.  
  543. }
  544.  
  545.  
  546.  
  547. public client_disconnect(id){
  548.  
  549. save2vault(id)
  550.  
  551. admin[id]=false
  552.  
  553. spec[id]=0
  554.  
  555. }
  556.  
  557.  
  558.  
  559. public change_esp_status(id,bool:on){
  560.  
  561. if (on){
  562.  
  563. admin_options[id][0]=true
  564.  
  565. if (!is_in_menu[id]) client_print(id,print_chat,"[%s] BEKAPCSOLVA",PLUGIN)
  566.  
  567. if (is_in_menu[id]) show_esp_menu(id)
  568.  
  569. }else{
  570.  
  571. admin_options[id][0]=false
  572.  
  573. if (!is_in_menu[id]) client_print(id,print_chat,"[%s] KIKAPCSOLVA",PLUGIN)
  574.  
  575. if (is_in_menu[id]) show_esp_menu(id)
  576.  
  577. }
  578.  
  579. }
  580.  
  581.  
  582.  
  583. public client_PreThink(id){
  584.  
  585. if (!is_user_connected(id)) return PLUGIN_CONTINUE
  586.  
  587.  
  588.  
  589. new button=get_user_button(id)
  590.  
  591. if (button==0) return PLUGIN_CONTINUE // saves a lot of cpu
  592.  
  593.  
  594.  
  595. new oldbutton=get_user_oldbutton(id)
  596.  
  597.  
  598.  
  599. if (button & IN_DUCK){
  600.  
  601. ducking[id]=true
  602.  
  603. }else{
  604.  
  605. ducking[id]=false
  606.  
  607. }
  608.  
  609.  
  610.  
  611. if ((get_cvar_num("esp")==1) && (get_cvar_num("esp_disable_default_keys")!=1)){
  612.  
  613. if (admin[id]){
  614.  
  615. if (first_person[id] && !is_user_alive(id)){
  616.  
  617. if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD)){
  618.  
  619. show_esp_menu(id)
  620.  
  621. }
  622.  
  623. if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD) && !admin_options[id][0]){
  624.  
  625. change_esp_status(id,true)
  626.  
  627. }
  628.  
  629. if ((button & IN_BACK) && !(oldbutton & IN_BACK) && admin_options[id][0]){
  630.  
  631. change_esp_status(id,false)
  632.  
  633. }
  634.  
  635. }
  636.  
  637. }
  638.  
  639. }
  640.  
  641. return PLUGIN_CONTINUE
  642.  
  643. }
  644.  
  645.  
  646.  
  647. public draw_aim_vector(i,s,len){
  648.  
  649. new Float:endpoint[3]
  650.  
  651. new tmp[3]
  652.  
  653. new Float:vec1[3]
  654.  
  655. get_user_origin(s, tmp, 1)
  656.  
  657. IVecFVec(tmp,vec1)
  658.  
  659. vec1[2]-=6.0
  660.  
  661. VelocityByAim(s,len,endpoint) // get aim vector
  662.  
  663. addVec(endpoint,vec1) // add origin to get absolute coordinates
  664.  
  665. make_TE_BEAMPOINTS(i,4,vec1,endpoint,10,0,255)
  666.  
  667. return PLUGIN_CONTINUE
  668.  
  669. }
  670.  
  671.  
  672.  
  673. public esp_timer(){
  674.  
  675.  
  676.  
  677. if (get_cvar_num("esp")!=1) { // if esp is not 1, it is off
  678.  
  679. set_task(1.0,"esp_timer") // check for reactivation in 1 sec intervals
  680.  
  681. return PLUGIN_CONTINUE
  682.  
  683. }
  684.  
  685.  
  686.  
  687. for (new i=1;i<=max_players;i++){ // loop through players
  688.  
  689.  
  690.  
  691. 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])){ // <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->
  692.  
  693.  
  694.  
  695. new spec_id=spec[i]
  696.  
  697. new Float:my_origin[3]
  698.  
  699. entity_get_vector(i,EV_VEC_origin,my_origin) // get origin of spectating admin
  700.  
  701. new my_team
  702.  
  703. my_team=get_team(spec_id) // get team of spectated <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->
  704.  
  705.  
  706.  
  707. new Float:smallest_angle=180.0
  708.  
  709. new smallest_id=0
  710.  
  711. new Float:xp=2.0,Float:yp=2.0 // x,y of hudmessage
  712.  
  713. new Float:dist
  714.  
  715.  
  716.  
  717. for (new s=1;s<=max_players;s++){ // loop through the targets
  718.  
  719. if (is_user_alive(s)){ // target must be alive
  720.  
  721. new target_team=get_team(s) // get team of target
  722.  
  723. if (!(target_team==3)){ //if not spectator
  724.  
  725. if (spec_id!=s){ // do not target myself
  726.  
  727. // if the target is in the other team and not spectator
  728.  
  729.  
  730.  
  731. if (((my_team!=target_team && (target_team==1 || target_team==2)) || admin_options[i][ESP_TEAM_MATES])){
  732.  
  733.  
  734.  
  735. new Float:target_origin[3]
  736.  
  737. // get origin of target
  738.  
  739. entity_get_vector(s,EV_VEC_origin,target_origin)
  740.  
  741.  
  742.  
  743.  
  744.  
  745. // get distance from me to target
  746.  
  747. new Float:distance=vector_distance(my_origin,target_origin)
  748.  
  749.  
  750.  
  751. if (admin_options[i][ESP_LINE]){
  752.  
  753.  
  754.  
  755. new width
  756.  
  757. if (distance<2040.0){
  758.  
  759. // calculate width according to distance
  760.  
  761. width=(255-floatround(distance/8.0))/3
  762.  
  763. }else{
  764.  
  765. width=1
  766.  
  767. }
  768.  
  769. // create temp_ent
  770.  
  771. make_TE_BEAMENTPOINT(i,target_origin,width,target_team)
  772.  
  773. }
  774.  
  775.  
  776.  
  777.  
  778.  
  779. // get vector from me to target
  780.  
  781. new Float:v_middle[3]
  782.  
  783. subVec(target_origin,my_origin,v_middle)
  784.  
  785.  
  786.  
  787. // trace from me to target, getting hitpoint
  788.  
  789. new Float:v_hitpoint[3]
  790.  
  791. trace_line (-1,my_origin,target_origin,v_hitpoint)
  792.  
  793.  
  794.  
  795. // get distance from me to hitpoint (nearest wall)
  796.  
  797. new Float:distance_to_hitpoint=vector_distance(my_origin,v_hitpoint)
  798.  
  799.  
  800.  
  801. // scale
  802.  
  803. new Float:scaled_bone_len
  804.  
  805. if (ducking[spec_id]){
  806.  
  807. scaled_bone_len=distance_to_hitpoint/distance*(50.0-18.0)
  808.  
  809. }else{
  810.  
  811. scaled_bone_len=distance_to_hitpoint/distance*50.0
  812.  
  813. }
  814.  
  815. scaled_bone_len=distance_to_hitpoint/distance*50.0
  816.  
  817.  
  818.  
  819. new Float:scaled_bone_width=distance_to_hitpoint/distance*150.0
  820.  
  821.  
  822.  
  823. new Float:v_bone_start[3],Float:v_bone_end[3]
  824.  
  825. new Float:offset_vector[3]
  826.  
  827. // get the point 10.0 units away from wall
  828.  
  829. normalize(v_middle,offset_vector,distance_to_hitpoint-10.0) // offset from wall
  830.  
  831.  
  832.  
  833. // set to eye level
  834.  
  835. new Float:eye_level[3]
  836.  
  837. copyVec(my_origin,eye_level)
  838.  
  839.  
  840.  
  841. if (ducking[spec_id]){
  842.  
  843. eye_level[2]+=12.3
  844.  
  845. }else{
  846.  
  847. eye_level[2]+=17.5
  848.  
  849. }
  850.  
  851.  
  852.  
  853.  
  854.  
  855. addVec(offset_vector,eye_level)
  856.  
  857.  
  858.  
  859. // start and end of green box
  860.  
  861. copyVec(offset_vector,v_bone_start)
  862.  
  863. copyVec(offset_vector,v_bone_end)
  864.  
  865. v_bone_end[2]-=scaled_bone_len
  866.  
  867.  
  868.  
  869. new Float:distance_target_hitpoint=distance-distance_to_hitpoint
  870.  
  871.  
  872.  
  873. new actual_bright=255
  874.  
  875.  
  876.  
  877. if (admin_options[i][ESP_BOX]){
  878.  
  879. // this is to make green box darker if distance is larger
  880.  
  881. if (distance_target_hitpoint<2040.0){
  882.  
  883. actual_bright=(255-floatround(distance_target_hitpoint/12.0))
  884.  
  885.  
  886.  
  887. }else{
  888.  
  889. actual_bright=85
  890.  
  891. }
  892.  
  893. new color
  894.  
  895. if (distance_to_hitpoint!=distance){ // if no line of sight
  896.  
  897. color=0
  898.  
  899. }else{ // if line of sight
  900.  
  901. color=target_team
  902.  
  903. }
  904.  
  905.  
  906.  
  907. if (damage_done_to[spec_id]==s) {
  908.  
  909. color=3
  910.  
  911. damage_done_to[spec_id]=0
  912.  
  913. }
  914.  
  915. make_TE_BEAMPOINTS(i,color,v_bone_start,v_bone_end,floatround(scaled_bone_width),target_team,actual_bright)
  916.  
  917. }
  918.  
  919.  
  920.  
  921.  
  922.  
  923. 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]){
  924.  
  925.  
  926.  
  927.  
  928.  
  929. new Float:ret[2]
  930.  
  931. new Float:x_angle=get_screen_pos(spec_id,v_middle,ret)
  932.  
  933.  
  934.  
  935. // find target with the smallest distance to crosshair (on x-axis)
  936.  
  937. if (smallest_angle>floatabs(x_angle)){
  938.  
  939. if (floatabs(x_angle)!=0.0){
  940.  
  941. smallest_angle=floatabs(x_angle)
  942.  
  943. view_target[spec_id]=s
  944.  
  945. smallest_id=s // store nearest target id..
  946.  
  947. xp=ret[0] // and x,y coordinates of hudmessage
  948.  
  949. yp=ret[1]
  950.  
  951. dist=distance
  952.  
  953. }
  954.  
  955. }
  956.  
  957. }
  958.  
  959. }
  960.  
  961. }
  962.  
  963. }
  964.  
  965. }
  966.  
  967. } // inner player loop end
  968.  
  969. if (!is_user_alive(smallest_id)) {
  970.  
  971. smallest_id=0
  972.  
  973. xp=-1.0
  974.  
  975. }
  976.  
  977. if (smallest_id>0 && admin_options[i][ESP_AIM_VEC]){
  978.  
  979. draw_aim_vector(i,smallest_id,2000)
  980.  
  981. }
  982.  
  983. if (xp>0.0 && xp<=1.0 && yp>0.0 && yp<=1.0){ // if in visible range
  984.  
  985. // show the player info
  986.  
  987. set_hudmessage(255, 255, 0, floatabs(xp), floatabs(yp), 0, 0.0, get_cvar_float("esp_timer"), 0.0, 0.0, 2)
  988.  
  989.  
  990.  
  991. new name[37]=""
  992.  
  993. new tmp[33]
  994.  
  995. get_user_name(smallest_id,tmp,32)
  996.  
  997. if (admin_options[i][ESP_NAME]){
  998.  
  999. format(name,36,"[%s]^n",tmp)
  1000.  
  1001. }
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007. new health[25]=""
  1008.  
  1009. if (admin_options[i][ESP_HEALTH_ARMOR]){
  1010.  
  1011. new hp=get_user_health(smallest_id)
  1012.  
  1013. new armor=get_user_armor(smallest_id)
  1014.  
  1015. format(health,24,"health: %d armor: %d^n",hp,armor)
  1016.  
  1017. }
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023. new clip_ammo[22]=""
  1024.  
  1025. new clip,ammo
  1026.  
  1027. new weapon_id=get_user_weapon(smallest_id,clip,ammo)
  1028.  
  1029. if (admin_options[i][ESP_CLIP_AMMO]){
  1030.  
  1031. format(clip_ammo,21,"clip: %d ammo: %d^n",clip,ammo)
  1032.  
  1033. }
  1034.  
  1035.  
  1036.  
  1037. new weapon_name[21]=""
  1038.  
  1039. if (admin_options[i][ESP_WEAPON]){
  1040.  
  1041. if ((weapon_id-1)<0 || (weapon_id-1)>29) weapon_id=1
  1042.  
  1043. format(weapon_name,20,"weapon: %s^n",weapons[weapon_id-1])
  1044.  
  1045. //copy(weapon_name,9,weapons[weapon_id-1])
  1046.  
  1047. }
  1048.  
  1049.  
  1050.  
  1051. new str_dist[19]
  1052.  
  1053. if (admin_options[i][ESP_DISTANCE]){
  1054.  
  1055. format(str_dist,18,"distance: %d^n",floatround(dist))
  1056.  
  1057. }
  1058.  
  1059.  
  1060.  
  1061. show_hudmessage(i, "%s%s%s%s%s",name,health,weapon_name,clip_ammo,str_dist)
  1062.  
  1063. }
  1064.  
  1065. }
  1066.  
  1067. }
  1068.  
  1069. set_task(get_cvar_float("esp_timer"),"esp_timer") // keep it going
  1070.  
  1071. return PLUGIN_CONTINUE
  1072.  
  1073. }
  1074.  
  1075.  
  1076.  
  1077. public Float:get_screen_pos(id,Float:v_me_to_target[3],Float:Ret[2]){
  1078.  
  1079. new Float:v_aim[3]
  1080.  
  1081. VelocityByAim(id,1,v_aim) // get aim vector
  1082.  
  1083. new Float:aim[3]
  1084.  
  1085. copyVec(v_aim,aim) // make backup copy of v_aim
  1086.  
  1087. v_aim[2]=0.0 // project aim vector vertically to x,y plane
  1088.  
  1089. new Float:v_target[3]
  1090.  
  1091. copyVec(v_me_to_target,v_target)
  1092.  
  1093. v_target[2]=0.0 // project target vector vertically to x,y plane
  1094.  
  1095. // both v_aim and v_target are in the x,y plane, so angle can be calculated..
  1096.  
  1097. new Float:x_angle
  1098.  
  1099. new Float:x_pos=get_screen_pos_x(v_target,v_aim,x_angle) // get the x coordinate of hudmessage..
  1100.  
  1101. new Float:y_pos=get_screen_pos_y(v_me_to_target,aim) // get the y coordinate of hudmessage..
  1102.  
  1103. Ret[0]=x_pos
  1104.  
  1105. Ret[1]=y_pos
  1106.  
  1107. return x_angle
  1108.  
  1109. }
  1110.  
  1111.  
  1112.  
  1113. public Float:get_screen_pos_x(Float:target[3],Float:aim[3],&Float:xangle){
  1114.  
  1115. new Float:x_angle=floatacos(vectorProduct(aim,target)/(getVecLen(aim)*getVecLen(target)),1) // get angle between vectors
  1116.  
  1117. new Float:x_pos
  1118.  
  1119. //this part is a bit tricky..
  1120.  
  1121. //the problem is that the 'angle between vectors' formula returns always positive values
  1122.  
  1123. //how can be determined if the target vector is on the left or right side of the aim vector? with only positive angles?
  1124.  
  1125. //the solution:
  1126.  
  1127. //the scalar triple product returns the volume of the parallelepiped that is created by three input vectors
  1128.  
  1129. //
  1130.  
  1131. //i used the aim and target vectors as the first two input parameters
  1132.  
  1133. //and the third one is a vector pointing straight upwards [0,0,1]
  1134.  
  1135. //if now the target is on the left side of spectator origin the created parallelepipeds volume is negative
  1136.  
  1137. //and on the right side positive
  1138.  
  1139. //now we can turn x_angle into a signed value..
  1140.  
  1141. if (scalar_triple_product(aim,target)<0.0) x_angle*=-1 // make signed
  1142.  
  1143. if (x_angle>=-45.0 && x_angle<=45.0){ // if in fov of 90
  1144.  
  1145. x_pos=1.0-(floattan(x_angle,degrees)+1.0)/2.0 // calulate y_pos of hudmessage
  1146.  
  1147. xangle=x_angle
  1148.  
  1149. return x_pos
  1150.  
  1151. }
  1152.  
  1153. xangle=0.0
  1154.  
  1155. return -2.0
  1156.  
  1157. }
  1158.  
  1159.  
  1160.  
  1161. public Float:get_screen_pos_y(Float:v_target[3],Float:aim[3]){
  1162.  
  1163. new Float:target[3]
  1164.  
  1165.  
  1166.  
  1167. // rotate vector about z-axis directly over the direction vector (to get height angle)
  1168.  
  1169. rotateVectorZ(v_target,aim,target)
  1170.  
  1171.  
  1172.  
  1173. // get angle between aim vector and target vector
  1174.  
  1175. new Float:y_angle=floatacos(vectorProduct(aim,target)/(getVecLen(aim)*getVecLen(target)),1) // get angle between vectors
  1176.  
  1177.  
  1178.  
  1179. new Float:y_pos
  1180.  
  1181. new Float:norm_target[3],Float:norm_aim[3]
  1182.  
  1183.  
  1184.  
  1185. // get normalized target and aim vectors
  1186.  
  1187. normalize(v_target,norm_target,1.0)
  1188.  
  1189. normalize(aim,norm_aim,1.0)
  1190.  
  1191.  
  1192.  
  1193. //since the 'angle between vectors' formula returns always positive values
  1194.  
  1195. if (norm_target[2]<norm_aim[2]) y_angle*=-1 //make signed
  1196.  
  1197.  
  1198.  
  1199. if (y_angle>=-45.0 && y_angle<=45.0){ // if in fov of 90
  1200.  
  1201. y_pos=1.0-(floattan(y_angle,degrees)+1.0)/2.0 // calulate y_pos of hudmessage
  1202.  
  1203. if (y_pos>=0.0 && y_pos<=1.0) return y_pos
  1204.  
  1205. }
  1206.  
  1207. return -2.0
  1208.  
  1209. }
  1210.  
  1211.  
  1212.  
  1213. public get_team(id){
  1214.  
  1215. new team[2]
  1216.  
  1217. get_user_team(id,team,1)
  1218.  
  1219. switch(team[0]){
  1220.  
  1221. case 'T':{
  1222.  
  1223. return 1
  1224.  
  1225. }
  1226.  
  1227. case 'C':{
  1228.  
  1229. return 2
  1230.  
  1231. }
  1232.  
  1233. case 'S':{
  1234.  
  1235. return 3
  1236.  
  1237. }
  1238.  
  1239. default:{}
  1240.  
  1241. }
  1242.  
  1243. return 0
  1244.  
  1245. }
  1246.  
  1247.  
  1248.  
  1249. // Vector Operations -------------------------------------------------------------------------------
  1250.  
  1251.  
  1252.  
  1253. public Float:getVecLen(Float:Vec[3]){
  1254.  
  1255. new Float:VecNull[3]={0.0,0.0,0.0}
  1256.  
  1257. new Float:len=vector_distance(Vec,VecNull)
  1258.  
  1259. return len
  1260.  
  1261. }
  1262.  
  1263.  
  1264.  
  1265. public Float:scalar_triple_product(Float:a[3],Float:b[3]){
  1266.  
  1267. new Float:up[3]={0.0,0.0,1.0}
  1268.  
  1269. new Float:Ret[3]
  1270.  
  1271. Ret[0]=a[1]*b[2]-a[2]*b[1]
  1272.  
  1273. Ret[1]=a[2]*b[0]-a[0]*b[2]
  1274.  
  1275. Ret[2]=a[0]*b[1]-a[1]*b[0]
  1276.  
  1277. return vectorProduct(Ret,up)
  1278.  
  1279. }
  1280.  
  1281.  
  1282.  
  1283. public normalize(Float:Vec[3],Float:Ret[3],Float:multiplier){
  1284.  
  1285. new Float:len=getVecLen(Vec)
  1286.  
  1287. copyVec(Vec,Ret)
  1288.  
  1289. Ret[0]/=len
  1290.  
  1291. Ret[1]/=len
  1292.  
  1293. Ret[2]/=len
  1294.  
  1295. Ret[0]*=multiplier
  1296.  
  1297. Ret[1]*=multiplier
  1298.  
  1299. Ret[2]*=multiplier
  1300.  
  1301. }
  1302.  
  1303.  
  1304.  
  1305. public rotateVectorZ(Float:Vec[3],Float:direction[3],Float:Ret[3]){
  1306.  
  1307. // rotates vector about z-axis
  1308.  
  1309. new Float:tmp[3]
  1310.  
  1311. copyVec(Vec,tmp)
  1312.  
  1313. tmp[2]=0.0
  1314.  
  1315. new Float:dest_len=getVecLen(tmp)
  1316.  
  1317. copyVec(direction,tmp)
  1318.  
  1319. tmp[2]=0.0
  1320.  
  1321. new Float:tmp2[3]
  1322.  
  1323. normalize(tmp,tmp2,dest_len)
  1324.  
  1325. tmp2[2]=Vec[2]
  1326.  
  1327. copyVec(tmp2,Ret)
  1328.  
  1329. }
  1330.  
  1331.  
  1332.  
  1333. public Float:vectorProduct(Float:Vec1[3],Float:Vec2[3]){
  1334.  
  1335. return Vec1[0]*Vec2[0]+Vec1[1]*Vec2[1]+Vec1[2]*Vec2[2]
  1336.  
  1337. }
  1338.  
  1339.  
  1340.  
  1341. public copyVec(Float:Vec[3],Float:Ret[3]){
  1342.  
  1343. Ret[0]=Vec[0]
  1344.  
  1345. Ret[1]=Vec[1]
  1346.  
  1347. Ret[2]=Vec[2]
  1348.  
  1349. }
  1350.  
  1351.  
  1352.  
  1353. public subVec(Float:Vec1[3],Float:Vec2[3],Float:Ret[3]){
  1354.  
  1355. Ret[0]=Vec1[0]-Vec2[0]
  1356.  
  1357. Ret[1]=Vec1[1]-Vec2[1]
  1358.  
  1359. Ret[2]=Vec1[2]-Vec2[2]
  1360.  
  1361. }
  1362.  
  1363.  
  1364.  
  1365. public addVec(Float:Vec1[3],Float:Vec2[3]){
  1366.  
  1367. Vec1[0]+=Vec2[0]
  1368.  
  1369. Vec1[1]+=Vec2[1]
  1370.  
  1371. Vec1[2]+=Vec2[2]
  1372.  
  1373. }
  1374.  
  1375.  
  1376.  
  1377. // Temporary Entities ------------------------------------------------------------------------------
  1378.  
  1379. // there is a list of much more temp entities at: http://djeyl.net/forum/index.php?s=80ec ... &id=290870
  1380.  
  1381. // all messages are sent with MSG_ONE_UNRELIABLE flag to avoid overflow in case of very low esp_timer setting and much targets
  1382.  
  1383.  
  1384.  
  1385. public make_TE_BEAMPOINTS(id,color,Float:Vec1[3],Float:Vec2[3],width,target_team,brightness){
  1386.  
  1387. message_begin(MSG_ONE_UNRELIABLE ,SVC_TEMPENTITY,{0,0,0},id) //message begin
  1388.  
  1389. write_byte(0)
  1390.  
  1391. write_coord(floatround(Vec1[0])) // start position
  1392.  
  1393. write_coord(floatround(Vec1[1]))
  1394.  
  1395. write_coord(floatround(Vec1[2]))
  1396.  
  1397. write_coord(floatround(Vec2[0])) // end position
  1398.  
  1399. write_coord(floatround(Vec2[1]))
  1400.  
  1401. write_coord(floatround(Vec2[2]))
  1402.  
  1403. write_short(laser) // sprite index
  1404.  
  1405. write_byte(3) // starting frame
  1406.  
  1407. write_byte(0) // frame rate in 0.1's
  1408.  
  1409. write_byte(floatround(get_cvar_float("esp_timer")*10)) // life in 0.1's
  1410.  
  1411. write_byte(width) // line width in 0.1's
  1412.  
  1413. write_byte(0) // noise amplitude in 0.01's
  1414.  
  1415. write_byte(esp_colors[color][0])
  1416.  
  1417. write_byte(esp_colors[color][1])
  1418.  
  1419. write_byte(esp_colors[color][2])
  1420.  
  1421. write_byte(brightness) // brightness)
  1422.  
  1423. write_byte(0) // scroll speed in 0.1's
  1424.  
  1425. message_end()
  1426.  
  1427. }
  1428.  
  1429.  
  1430.  
  1431. public make_TE_BEAMENTPOINT(id,Float:target_origin[3],width,target_team){
  1432.  
  1433. message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,{0,0,0},id)
  1434.  
  1435. write_byte(1)
  1436.  
  1437. write_short(id)
  1438.  
  1439. write_coord(floatround(target_origin[0]))
  1440.  
  1441. write_coord(floatround(target_origin[1]))
  1442.  
  1443. write_coord(floatround(target_origin[2]))
  1444.  
  1445. write_short(laser)
  1446.  
  1447. write_byte(1)
  1448.  
  1449. write_byte(1)
  1450.  
  1451. write_byte(floatround(get_cvar_float("esp_timer")*10))
  1452.  
  1453. write_byte(width)
  1454.  
  1455. write_byte(0)
  1456.  
  1457. write_byte(team_colors[target_team][0])
  1458.  
  1459. write_byte(team_colors[target_team][1])
  1460.  
  1461. write_byte(team_colors[target_team][2])
  1462.  
  1463. write_byte(255)
  1464.  
  1465. write_byte(0)
  1466.  
  1467. message_end()
  1468.  
  1469. }
  1470.  

Ha loginos az admin, nem fog menni.. Ahogyan az előző kommentelő is megmondta, tölts le egy olyan CS-t aminek van ID-je. Ha arra adod, akkor fog menni minden adminnak.

_________________
Kép

Ők köszönték meg Applee nek ezt a hozzászólást: ZiT3K (2014.01.27. 07:55)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: ADMIN WH átalakítás
HozzászólásElküldve: 2014.01.27. 07:55 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.12.15. 19:13
Hozzászólások: 495
Megköszönt másnak: 289 alkalommal
Megköszönték neki: 14 alkalommal
Rendben, kösz a válaszokat!


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 4 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 8 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole