hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 14:56



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Google [Bot] 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  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Admin esp átirása
HozzászólásElküldve: 2013.09.07. 13:44 
Offline
Őstag
Avatar

Csatlakozott: 2010.04.16. 16:50
Hozzászólások: 1342
Megköszönt másnak: 42 alkalommal
Megköszönték neki: 58 alkalommal
Valaki áttudná írni az admin esp-t úgy hogy ne legyen benne semmi csak a csik ami az ellenfelet mutatja, illetve ne legyen benne a pre_think funkcio hanem parancsra lehessen be/ki kapcsolni pl konzolba be keljen irni hogy "adminwh" de ezzel az egy parancsal be illetve ki lehessen kapcsolni egyben mint pl a /roundsound parancs a körvégi zenénél. A beállítás se kell bele ami a menüvel van mert csak egy funkcio kellene belőle amit említettem az elején, hogy az ellenfelet mutassa a csik, aim vektor meg a többi nem kell mert semmi értelmét nem látom hogy benne van :) elöre is köszönöm aki megcsinálja

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <engine>
  3.  
  4. // Here you can adjust the required admin level if needed
  5.  
  6. #define REQUIRED_ADMIN_LEVEL ADMIN_KICK
  7.  
  8. //--------------------------------------------------------------------------------------------------
  9.  
  10. #define PLUGIN "Admin Spectator ESP"
  11. #define VERSION "1.3"
  12. #define AUTHOR "KoST"
  13.  
  14. enum {
  15. ESP_ON=0,
  16. ESP_LINE,
  17. ESP_BOX,
  18. ESP_NAME,
  19. ESP_HEALTH_ARMOR,
  20. ESP_WEAPON,
  21. ESP_CLIP_AMMO,
  22. ESP_DISTANCE,
  23. ESP_TEAM_MATES,
  24. ESP_AIM_VEC,
  25. }
  26.  
  27. new bool:admin[33] // is/is not admin
  28. new bool:first_person[33] //is/is not in first person view
  29. new spec[33] // spec[player_id]=the players id if
  30. new laser // precached model
  31. new max_players // if you start hlds with +maxplayers 20 for example this would be 20
  32. new team_colors[4][3]={{0,0,0},{150,0,0},{0,0,150},{0,150,0}}
  33. new esp_colors[5][3]={{0,255,0},{100,60,60},{60,60,100},{255,0,255},{128,128,128}}
  34. new bool:ducking[33] //is/is not player ducked
  35. new damage_done_to[33] //damage_done_to[p1]=p2 // p1 has hit p2
  36. new view_target[33] // attackers victim
  37. new bool:admin_options[33][10] // individual esp options
  38. new bool:is_in_menu[33] // has esp menu open
  39.  
  40. // weapon strings
  41. new weapons[30][10]={"None","P228","Scout","HE","XM1014","C4",
  42. "MAC-10","AUG","Smoke","Elite","Fiveseven",
  43. "UMP45","SIG550","Galil","Famas","USP",
  44. "Glock","AWP","MP5","M249","M3","M4A1",
  45. "TMP","G3SG1","Flash","Deagle","SG552",
  46. "AK47","Knife","P90"}
  47.  
  48. public plugin_precache(){
  49. laser=precache_model("sprites/laserbeam.spr")
  50. }
  51.  
  52. public plugin_init(){
  53. register_plugin(PLUGIN,VERSION,AUTHOR)
  54. server_print("^n^t%s v%s, Copyright (C) 2006 by %s^n",PLUGIN,VERSION,AUTHOR)
  55.  
  56. // cvars
  57. register_cvar("esp","1")
  58. register_cvar("esp_timer","0.3")
  59. register_cvar("esp_allow_all","0")
  60. register_cvar("esp_disable_default_keys","0")
  61. register_cvar("aesp_version",VERSION,FCVAR_SERVER|FCVAR_UNLOGGED|FCVAR_SPONLY)
  62.  
  63. // client commands
  64. register_clcmd("esp_menu","cmd_esp_menu",REQUIRED_ADMIN_LEVEL,"Shows ESP Menu")
  65. register_clcmd("esp_toggle","cmd_esp_toggle",REQUIRED_ADMIN_LEVEL,"Toggle ESP on/off")
  66. register_clcmd("say /esp_menu","cmd_esp_menu",REQUIRED_ADMIN_LEVEL,"Shows ESP Menu")
  67. register_clcmd("say /esp_toggle","cmd_esp_toggle",REQUIRED_ADMIN_LEVEL,"Toggle ESP on/off")
  68. register_clcmd("esp_settings","cmd_esp_settings",REQUIRED_ADMIN_LEVEL," ESP adasdsassdasd")
  69.  
  70.  
  71. // events
  72. register_event("StatusValue","spec_target","bd","1=2")
  73. register_event("SpecHealth2","spec_target","bd")
  74. register_event("TextMsg","spec_mode","b","2&#Spec_Mode")
  75. register_event("Damage", "event_Damage", "b", "2!0", "3=0", "4!0")
  76. register_event("ResetHUD", "reset_hud_alive", "be")
  77.  
  78.  
  79. // menu
  80. 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
  81. register_menucmd(register_menuid("Admin Specator ESP"),keys,"menu_esp")
  82.  
  83. max_players=get_maxplayers()
  84.  
  85. // start esp_timer for the first time
  86. set_task(1.0,"esp_timer")
  87. }
  88.  
  89. public reset_hud_alive(id){
  90. spec[id]=0
  91. return PLUGIN_CONTINUE
  92. }
  93.  
  94. public cmd_esp_settings(id){
  95. if (admin[id]){
  96. new out[11]
  97. read_argv(1,out,10)
  98. new len=strlen(out)
  99. for (new i=0;i<len;i++){
  100. if (out[i]=='1'){
  101. admin_options[id][i]=true
  102. }else{
  103. admin_options[id][i]=false
  104. }
  105. }
  106. }
  107. }
  108.  
  109. public cmd_esp_menu(id){
  110. if (admin[id] && get_cvar_num("esp")==1){
  111. show_esp_menu(id)
  112. }
  113. }
  114.  
  115. public cmd_esp_toggle(id){
  116. if (admin[id] && get_cvar_num("esp")==1){
  117. change_esp_status(id,!admin_options[id][0])
  118. }
  119. }
  120.  
  121. public show_esp_menu(id){
  122. is_in_menu[id]=true
  123. new menu[301]
  124. 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
  125. new onoff[2][]={{"\ki\"},{"\be\"}} // \r=Piros \y=Sarga \w=Feher
  126. new text[2][]={{"(Itt tudod ki/be kapcsolni az admin wh funkcioit)"},{"(use esp_toggle command to toggle)"}} // \r=Piros \y=Sarga \w=Feher
  127. new text_index=get_cvar_num("esp_disable_default_keys")
  128. if (text_index!=1) text_index=0
  129. 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",
  130. onoff[admin_options[id][ESP_ON]],
  131. text[text_index],
  132. onoff[admin_options[id][ESP_LINE]],
  133. onoff[admin_options[id][ESP_BOX]],
  134. onoff[admin_options[id][ESP_NAME]],
  135. onoff[admin_options[id][ESP_HEALTH_ARMOR]],
  136. onoff[admin_options[id][ESP_WEAPON]],
  137. onoff[admin_options[id][ESP_CLIP_AMMO]],
  138. onoff[admin_options[id][ESP_DISTANCE]],
  139. onoff[admin_options[id][ESP_TEAM_MATES]],
  140. onoff[admin_options[id][ESP_AIM_VEC]])
  141. show_menu(id,keys,menu)
  142.  
  143. return PLUGIN_HANDLED
  144. }
  145.  
  146. public menu_esp(id,key){
  147. if (key==9){ // exit
  148. is_in_menu[id]=false
  149. return PLUGIN_HANDLED
  150. }
  151. // toggle esp options
  152. if (admin_options[id][key+1]){
  153. admin_options[id][key+1]=false
  154. }else{
  155. admin_options[id][key+1]=true
  156. }
  157. show_esp_menu(id)
  158. return PLUGIN_HANDLED
  159. }
  160.  
  161. public event_Damage(id){
  162. if (id>0) {
  163. new attacker=get_user_attacker(id)
  164. if (attacker>0 && attacker<=max_players){
  165. if (view_target[attacker]==id){
  166. damage_done_to[attacker]=id
  167. }
  168. }
  169. }
  170. return PLUGIN_CONTINUE
  171. }
  172.  
  173. public spec_mode(id){
  174. // discover if in first_person_view
  175. new specMode[12]
  176. read_data(2,specMode,11)
  177.  
  178. if(equal(specMode,"#Spec_Mode4")){
  179. first_person[id]=true
  180. }else{
  181. first_person[id]=false
  182. }
  183. return PLUGIN_CONTINUE
  184. }
  185.  
  186. public spec_target(id){
  187. if (id>0){
  188. new target=read_data(2)
  189. if (target!=0){
  190. spec[id]=target
  191. }
  192. }
  193. return PLUGIN_CONTINUE
  194. }
  195.  
  196. public client_putinserver(id){
  197. first_person[id]=false
  198. if ((get_user_flags(id) & REQUIRED_ADMIN_LEVEL) || get_cvar_num("esp_allow_all")==1){
  199. admin[id]=true
  200. init_admin_options(id)
  201.  
  202. }else{
  203. admin[id]=false
  204. }
  205. }
  206.  
  207. public init_admin_options(id){
  208.  
  209. for (new i=0;i<10;i++){
  210. admin_options[id][i]=true
  211. }
  212. admin_options[id][ESP_TEAM_MATES]=false
  213. load_vault_data(id)
  214. }
  215.  
  216. public save2vault(id){
  217. if (admin[id]){
  218. new authid[35]
  219. get_user_authid (id,authid,34)
  220. new tmp[11]
  221.  
  222. for (new s=0;s<10;s++){
  223.  
  224. if (admin_options[id][s]){
  225. tmp[s]='1';
  226. }else{
  227. tmp[s]='0';
  228. }
  229. }
  230. tmp[10]=0
  231.  
  232. //server_print("STEAMID: %s OPTIONS: %s",authid,tmp);
  233. new key[41]
  234. format(key,40,"AESP_%s",authid)
  235.  
  236. set_vaultdata(key,tmp)
  237. }
  238. }
  239.  
  240. public load_vault_data(id){
  241. if (admin[id]){
  242. new data[11]
  243. new authid[35]
  244. get_user_authid (id,authid,34)
  245. new key[41]
  246. format(key,40,"AESP_%s",authid)
  247. get_vaultdata(key,data,10)
  248. if (strlen(data)>0){
  249. for (new s=0;s<10;s++){
  250. if (data[s]=='1'){
  251. admin_options[id][s]=true
  252. }else{
  253. admin_options[id][s]=false
  254. }
  255. }
  256. }
  257. }
  258.  
  259. }
  260.  
  261. public client_disconnect(id){
  262. save2vault(id)
  263. admin[id]=false
  264. spec[id]=0
  265. }
  266.  
  267. public change_esp_status(id,bool:on){
  268. if (on){
  269. admin_options[id][0]=true
  270. if (!is_in_menu[id]) client_print(id,print_chat,"[%s] BEKAPCSOLVA",PLUGIN)
  271. if (is_in_menu[id]) show_esp_menu(id)
  272. }else{
  273. admin_options[id][0]=false
  274. if (!is_in_menu[id]) client_print(id,print_chat,"[%s] KIKAPCSOLVA",PLUGIN)
  275. if (is_in_menu[id]) show_esp_menu(id)
  276. }
  277. }
  278.  
  279. public client_PreThink(id){
  280. if (!is_user_connected(id)) return PLUGIN_CONTINUE
  281.  
  282. new button=get_user_button(id)
  283. if (button==0) return PLUGIN_CONTINUE // saves a lot of cpu
  284.  
  285. new oldbutton=get_user_oldbutton(id)
  286.  
  287. if (button & IN_DUCK){
  288. ducking[id]=true
  289. }else{
  290. ducking[id]=false
  291. }
  292.  
  293. if ((get_cvar_num("esp")==1) && (get_cvar_num("esp_disable_default_keys")!=1)){
  294. if (admin[id]){
  295. if (first_person[id] && !is_user_alive(id)){
  296. if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD)){
  297. show_esp_menu(id)
  298. }
  299. if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD) && !admin_options[id][0]){
  300. change_esp_status(id,true)
  301. }
  302. if ((button & IN_BACK) && !(oldbutton & IN_BACK) && admin_options[id][0]){
  303. change_esp_status(id,false)
  304. }
  305. }
  306. }
  307. }
  308. return PLUGIN_CONTINUE
  309. }
  310.  
  311. public draw_aim_vector(i,s,len){
  312. new Float:endpoint[3]
  313. new tmp[3]
  314. new Float:vec1[3]
  315. get_user_origin(s, tmp, 1)
  316. IVecFVec(tmp,vec1)
  317. vec1[2]-=6.0
  318. VelocityByAim(s,len,endpoint) // get aim vector
  319. addVec(endpoint,vec1) // add origin to get absolute coordinates
  320. make_TE_BEAMPOINTS(i,4,vec1,endpoint,10,0,255)
  321. return PLUGIN_CONTINUE
  322. }
  323.  
  324. public esp_timer(){
  325.  
  326. if (get_cvar_num("esp")!=1) { // if esp is not 1, it is off
  327. set_task(1.0,"esp_timer") // check for reactivation in 1 sec intervals
  328. return PLUGIN_CONTINUE
  329. }
  330.  
  331. for (new i=1;i<=max_players;i++){ // loop through players
  332.  
  333. 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:) -->
  334.  
  335. new spec_id=spec[i]
  336. new Float:my_origin[3]
  337. entity_get_vector(i,EV_VEC_origin,my_origin) // get origin of spectating admin
  338. new my_team
  339. my_team=get_team(spec_id) // get team of spectated <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->
  340.  
  341. new Float:smallest_angle=180.0
  342. new smallest_id=0
  343. new Float:xp=2.0,Float:yp=2.0 // x,y of hudmessage
  344. new Float:dist
  345.  
  346. for (new s=1;s<=max_players;s++){ // loop through the targets
  347. if (is_user_alive(s)){ // target must be alive
  348. new target_team=get_team(s) // get team of target
  349. if (!(target_team==3)){ //if not spectator
  350. if (spec_id!=s){ // do not target myself
  351. // if the target is in the other team and not spectator
  352.  
  353. if (((my_team!=target_team && (target_team==1 || target_team==2)) || admin_options[i][ESP_TEAM_MATES])){
  354.  
  355. new Float:target_origin[3]
  356. // get origin of target
  357. entity_get_vector(s,EV_VEC_origin,target_origin)
  358.  
  359.  
  360. // get distance from me to target
  361. new Float:distance=vector_distance(my_origin,target_origin)
  362.  
  363. if (admin_options[i][ESP_LINE]){
  364.  
  365. new width
  366. if (distance<2040.0){
  367. // calculate width according to distance
  368. width=(255-floatround(distance/8.0))/3
  369. }else{
  370. width=1
  371. }
  372. // create temp_ent
  373. make_TE_BEAMENTPOINT(i,target_origin,width,target_team)
  374. }
  375.  
  376.  
  377. // get vector from me to target
  378. new Float:v_middle[3]
  379. subVec(target_origin,my_origin,v_middle)
  380.  
  381. // trace from me to target, getting hitpoint
  382. new Float:v_hitpoint[3]
  383. trace_line (-1,my_origin,target_origin,v_hitpoint)
  384.  
  385. // get distance from me to hitpoint (nearest wall)
  386. new Float:distance_to_hitpoint=vector_distance(my_origin,v_hitpoint)
  387.  
  388. // scale
  389. new Float:scaled_bone_len
  390. if (ducking[spec_id]){
  391. scaled_bone_len=distance_to_hitpoint/distance*(50.0-18.0)
  392. }else{
  393. scaled_bone_len=distance_to_hitpoint/distance*50.0
  394. }
  395. scaled_bone_len=distance_to_hitpoint/distance*50.0
  396.  
  397. new Float:scaled_bone_width=distance_to_hitpoint/distance*150.0
  398.  
  399. new Float:v_bone_start[3],Float:v_bone_end[3]
  400. new Float:offset_vector[3]
  401. // get the point 10.0 units away from wall
  402. normalize(v_middle,offset_vector,distance_to_hitpoint-10.0) // offset from wall
  403.  
  404. // set to eye level
  405. new Float:eye_level[3]
  406. copyVec(my_origin,eye_level)
  407.  
  408. if (ducking[spec_id]){
  409. eye_level[2]+=12.3
  410. }else{
  411. eye_level[2]+=17.5
  412. }
  413.  
  414.  
  415. addVec(offset_vector,eye_level)
  416.  
  417. // start and end of green box
  418. copyVec(offset_vector,v_bone_start)
  419. copyVec(offset_vector,v_bone_end)
  420. v_bone_end[2]-=scaled_bone_len
  421.  
  422. new Float:distance_target_hitpoint=distance-distance_to_hitpoint
  423.  
  424. new actual_bright=255
  425.  
  426. if (admin_options[i][ESP_BOX]){
  427. // this is to make green box darker if distance is larger
  428. if (distance_target_hitpoint<2040.0){
  429. actual_bright=(255-floatround(distance_target_hitpoint/12.0))
  430.  
  431. }else{
  432. actual_bright=85
  433. }
  434. new color
  435. if (distance_to_hitpoint!=distance){ // if no line of sight
  436. color=0
  437. }else{ // if line of sight
  438. color=target_team
  439. }
  440.  
  441. if (damage_done_to[spec_id]==s) {
  442. color=3
  443. damage_done_to[spec_id]=0
  444. }
  445. make_TE_BEAMPOINTS(i,color,v_bone_start,v_bone_end,floatround(scaled_bone_width),target_team,actual_bright)
  446. }
  447.  
  448.  
  449. 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]){
  450.  
  451.  
  452. new Float:ret[2]
  453. new Float:x_angle=get_screen_pos(spec_id,v_middle,ret)
  454.  
  455. // find target with the smallest distance to crosshair (on x-axis)
  456. if (smallest_angle>floatabs(x_angle)){
  457. if (floatabs(x_angle)!=0.0){
  458. smallest_angle=floatabs(x_angle)
  459. view_target[spec_id]=s
  460. smallest_id=s // store nearest target id..
  461. xp=ret[0] // and x,y coordinates of hudmessage
  462. yp=ret[1]
  463. dist=distance
  464. }
  465. }
  466. }
  467. }
  468. }
  469. }
  470. }
  471. } // inner player loop end
  472. if (!is_user_alive(smallest_id)) {
  473. smallest_id=0
  474. xp=-1.0
  475. }
  476. if (smallest_id>0 && admin_options[i][ESP_AIM_VEC]){
  477. draw_aim_vector(i,smallest_id,2000)
  478. }
  479. if (xp>0.0 && xp<=1.0 && yp>0.0 && yp<=1.0){ // if in visible range
  480. // show the player info
  481. set_hudmessage(255, 255, 0, floatabs(xp), floatabs(yp), 0, 0.0, get_cvar_float("esp_timer"), 0.0, 0.0, 2)
  482.  
  483. new name[37]=""
  484. new tmp[33]
  485. get_user_name(smallest_id,tmp,32)
  486. if (admin_options[i][ESP_NAME]){
  487. format(name,36,"[%s]^n",tmp)
  488. }
  489.  
  490.  
  491. new health[25]=""
  492. if (admin_options[i][ESP_HEALTH_ARMOR]){
  493. new hp=get_user_health(smallest_id)
  494. new armor=get_user_armor(smallest_id)
  495. format(health,24,"health: %d armor: %d^n",hp,armor)
  496. }
  497.  
  498.  
  499. new clip_ammo[22]=""
  500. new clip,ammo
  501. new weapon_id=get_user_weapon(smallest_id,clip,ammo)
  502. if (admin_options[i][ESP_CLIP_AMMO]){
  503. format(clip_ammo,21,"clip: %d ammo: %d^n",clip,ammo)
  504. }
  505.  
  506. new weapon_name[21]=""
  507. if (admin_options[i][ESP_WEAPON]){
  508. if ((weapon_id-1)<0 || (weapon_id-1)>29) weapon_id=1
  509. format(weapon_name,20,"weapon: %s^n",weapons[weapon_id-1])
  510. //copy(weapon_name,9,weapons[weapon_id-1])
  511. }
  512.  
  513. new str_dist[19]
  514. if (admin_options[i][ESP_DISTANCE]){
  515. format(str_dist,18,"distance: %d^n",floatround(dist))
  516. }
  517.  
  518. show_hudmessage(i, "%s%s%s%s%s",name,health,weapon_name,clip_ammo,str_dist)
  519. }
  520. }
  521. }
  522. set_task(get_cvar_float("esp_timer"),"esp_timer") // keep it going
  523. return PLUGIN_CONTINUE
  524. }
  525.  
  526. public Float:get_screen_pos(id,Float:v_me_to_target[3],Float:Ret[2]){
  527. new Float:v_aim[3]
  528. VelocityByAim(id,1,v_aim) // get aim vector
  529. new Float:aim[3]
  530. copyVec(v_aim,aim) // make backup copy of v_aim
  531. v_aim[2]=0.0 // project aim vector vertically to x,y plane
  532. new Float:v_target[3]
  533. copyVec(v_me_to_target,v_target)
  534. v_target[2]=0.0 // project target vector vertically to x,y plane
  535. // both v_aim and v_target are in the x,y plane, so angle can be calculated..
  536. new Float:x_angle
  537. new Float:x_pos=get_screen_pos_x(v_target,v_aim,x_angle) // get the x coordinate of hudmessage..
  538. new Float:y_pos=get_screen_pos_y(v_me_to_target,aim) // get the y coordinate of hudmessage..
  539. Ret[0]=x_pos
  540. Ret[1]=y_pos
  541. return x_angle
  542. }
  543.  
  544. public Float:get_screen_pos_x(Float:target[3],Float:aim[3],&Float:xangle){
  545. new Float:x_angle=floatacos(vectorProduct(aim,target)/(getVecLen(aim)*getVecLen(target)),1) // get angle between vectors
  546. new Float:x_pos
  547. //this part is a bit tricky..
  548. //the problem is that the 'angle between vectors' formula returns always positive values
  549. //how can be determined if the target vector is on the left or right side of the aim vector? with only positive angles?
  550. //the solution:
  551. //the scalar triple product returns the volume of the parallelepiped that is created by three input vectors
  552. //
  553. //i used the aim and target vectors as the first two input parameters
  554. //and the third one is a vector pointing straight upwards [0,0,1]
  555. //if now the target is on the left side of spectator origin the created parallelepipeds volume is negative
  556. //and on the right side positive
  557. //now we can turn x_angle into a signed value..
  558. if (scalar_triple_product(aim,target)<0.0) x_angle*=-1 // make signed
  559. if (x_angle>=-45.0 && x_angle<=45.0){ // if in fov of 90
  560. x_pos=1.0-(floattan(x_angle,degrees)+1.0)/2.0 // calulate y_pos of hudmessage
  561. xangle=x_angle
  562. return x_pos
  563. }
  564. xangle=0.0
  565. return -2.0
  566. }
  567.  
  568. public Float:get_screen_pos_y(Float:v_target[3],Float:aim[3]){
  569. new Float:target[3]
  570.  
  571. // rotate vector about z-axis directly over the direction vector (to get height angle)
  572. rotateVectorZ(v_target,aim,target)
  573.  
  574. // get angle between aim vector and target vector
  575. new Float:y_angle=floatacos(vectorProduct(aim,target)/(getVecLen(aim)*getVecLen(target)),1) // get angle between vectors
  576.  
  577. new Float:y_pos
  578. new Float:norm_target[3],Float:norm_aim[3]
  579.  
  580. // get normalized target and aim vectors
  581. normalize(v_target,norm_target,1.0)
  582. normalize(aim,norm_aim,1.0)
  583.  
  584. //since the 'angle between vectors' formula returns always positive values
  585. if (norm_target[2]<norm_aim[2]) y_angle*=-1 //make signed
  586.  
  587. if (y_angle>=-45.0 && y_angle<=45.0){ // if in fov of 90
  588. y_pos=1.0-(floattan(y_angle,degrees)+1.0)/2.0 // calulate y_pos of hudmessage
  589. if (y_pos>=0.0 && y_pos<=1.0) return y_pos
  590. }
  591. return -2.0
  592. }
  593.  
  594. public get_team(id){
  595. new team[2]
  596. get_user_team(id,team,1)
  597. switch(team[0]){
  598. case 'T':{
  599. return 1
  600. }
  601. case 'C':{
  602. return 2
  603. }
  604. case 'S':{
  605. return 3
  606. }
  607. default:{}
  608. }
  609. return 0
  610. }
  611.  
  612. // Vector Operations -------------------------------------------------------------------------------
  613.  
  614. public Float:getVecLen(Float:Vec[3]){
  615. new Float:VecNull[3]={0.0,0.0,0.0}
  616. new Float:len=vector_distance(Vec,VecNull)
  617. return len
  618. }
  619.  
  620. public Float:scalar_triple_product(Float:a[3],Float:b[3]){
  621. new Float:up[3]={0.0,0.0,1.0}
  622. new Float:Ret[3]
  623. Ret[0]=a[1]*b[2]-a[2]*b[1]
  624. Ret[1]=a[2]*b[0]-a[0]*b[2]
  625. Ret[2]=a[0]*b[1]-a[1]*b[0]
  626. return vectorProduct(Ret,up)
  627. }
  628.  
  629. public normalize(Float:Vec[3],Float:Ret[3],Float:multiplier){
  630. new Float:len=getVecLen(Vec)
  631. copyVec(Vec,Ret)
  632. Ret[0]/=len
  633. Ret[1]/=len
  634. Ret[2]/=len
  635. Ret[0]*=multiplier
  636. Ret[1]*=multiplier
  637. Ret[2]*=multiplier
  638. }
  639.  
  640. public rotateVectorZ(Float:Vec[3],Float:direction[3],Float:Ret[3]){
  641. // rotates vector about z-axis
  642. new Float:tmp[3]
  643. copyVec(Vec,tmp)
  644. tmp[2]=0.0
  645. new Float:dest_len=getVecLen(tmp)
  646. copyVec(direction,tmp)
  647. tmp[2]=0.0
  648. new Float:tmp2[3]
  649. normalize(tmp,tmp2,dest_len)
  650. tmp2[2]=Vec[2]
  651. copyVec(tmp2,Ret)
  652. }
  653.  
  654. public Float:vectorProduct(Float:Vec1[3],Float:Vec2[3]){
  655. return Vec1[0]*Vec2[0]+Vec1[1]*Vec2[1]+Vec1[2]*Vec2[2]
  656. }
  657.  
  658. public copyVec(Float:Vec[3],Float:Ret[3]){
  659. Ret[0]=Vec[0]
  660. Ret[1]=Vec[1]
  661. Ret[2]=Vec[2]
  662. }
  663.  
  664. public subVec(Float:Vec1[3],Float:Vec2[3],Float:Ret[3]){
  665. Ret[0]=Vec1[0]-Vec2[0]
  666. Ret[1]=Vec1[1]-Vec2[1]
  667. Ret[2]=Vec1[2]-Vec2[2]
  668. }
  669.  
  670. public addVec(Float:Vec1[3],Float:Vec2[3]){
  671. Vec1[0]+=Vec2[0]
  672. Vec1[1]+=Vec2[1]
  673. Vec1[2]+=Vec2[2]
  674. }
  675.  
  676. // Temporary Entities ------------------------------------------------------------------------------
  677. // there is a list of much more temp entities at: http://djeyl.net/forum/index.php?s=80ec ... &id=290870
  678. // all messages are sent with MSG_ONE_UNRELIABLE flag to avoid overflow in case of very low esp_timer setting and much targets
  679.  
  680. public make_TE_BEAMPOINTS(id,color,Float:Vec1[3],Float:Vec2[3],width,target_team,brightness){
  681. message_begin(MSG_ONE_UNRELIABLE ,SVC_TEMPENTITY,{0,0,0},id) //message begin
  682. write_byte(0)
  683. write_coord(floatround(Vec1[0])) // start position
  684. write_coord(floatround(Vec1[1]))
  685. write_coord(floatround(Vec1[2]))
  686. write_coord(floatround(Vec2[0])) // end position
  687. write_coord(floatround(Vec2[1]))
  688. write_coord(floatround(Vec2[2]))
  689. write_short(laser) // sprite index
  690. write_byte(3) // starting frame
  691. write_byte(0) // frame rate in 0.1's
  692. write_byte(floatround(get_cvar_float("esp_timer")*10)) // life in 0.1's
  693. write_byte(width) // line width in 0.1's
  694. write_byte(0) // noise amplitude in 0.01's
  695. write_byte(esp_colors[color][0])
  696. write_byte(esp_colors[color][1])
  697. write_byte(esp_colors[color][2])
  698. write_byte(brightness) // brightness)
  699. write_byte(0) // scroll speed in 0.1's
  700. message_end()
  701. }
  702.  
  703. public make_TE_BEAMENTPOINT(id,Float:target_origin[3],width,target_team){
  704. message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,{0,0,0},id)
  705. write_byte(1)
  706. write_short(id)
  707. write_coord(floatround(target_origin[0]))
  708. write_coord(floatround(target_origin[1]))
  709. write_coord(floatround(target_origin[2]))
  710. write_short(laser)
  711. write_byte(1)
  712. write_byte(1)
  713. write_byte(floatround(get_cvar_float("esp_timer")*10))
  714. write_byte(width)
  715. write_byte(0)
  716. write_byte(team_colors[target_team][0])
  717. write_byte(team_colors[target_team][1])
  718. write_byte(team_colors[target_team][2])
  719. write_byte(255)
  720. write_byte(0)
  721. message_end()
  722. }
  723.  

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Admin esp átirása
HozzászólásElküldve: 2013.09.09. 12:52 
Offline
Developer
Avatar

Csatlakozott: 2011.06.01. 21:11
Hozzászólások: 7962
Megköszönt másnak: 295 alkalommal
Megköszönték neki: 535 alkalommal
Úgylátom ezt senki nem csinálja.

Két dolgot ajánlok: Amxx plugin: http://forums.alliedmods.net/showthread.php?p=795222 (Ez spriteket csinál, nézd meg a videóban)
A másik egy rage almodul: http://hlmod.hu/viewtopic.php?f=22&t=4115 (Bár szerintem a fenti pluginnal többre mész)

_________________
http://www.easyrankup.eu

Ők köszönték meg kiki nek ezt a hozzászólást: expert (2013.09.09. 20:19)
  Népszerűség: 2.27%


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  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 20 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