hlmod.hu

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



Jelenlévő felhasználók

Jelenleg 233 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 232 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  [ 3 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Admin nézi az embert és admin_wh
HozzászólásElküldve: 2014.02.07. 18:32 
Offline
Jómunkásember

Csatlakozott: 2014.01.04. 18:31
Hozzászólások: 326
Megköszönt másnak: 79 alkalommal
Megköszönték neki: 7 alkalommal
hello! arra van valami parancs ,hogy az admin mindekit tudjon nézni anélkül,hogy ki kellene állni a specbe?
Eza beállitás van a kamerára:
mp_forcechasecam 2
mp_forcecamera 2

Illetve ebből az admin whból valaki megcsinálná nekem,hogy csak a vonal legyen ott?

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


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Admin nézi az embert és admin_wh
HozzászólásElküldve: 2014.02.07. 19:04 
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
Hy, admin whnak ezt ne használd, ez nagyon régi.

Ajánlanám ezt: https://forums.alliedmods.net/showthread.php?t=89081

Az hogy admin tudjon nézni mindenkit: Admin Free Look (kérdés müködik e még)

_________________
http://www.easyrankup.eu

Ők köszönték meg kiki nek ezt a hozzászólást: gyurc1111 (2014.02.07. 19:22)
  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 nézi az embert és admin_wh
HozzászólásElküldve: 2014.02.07. 19:23 
Offline
Jómunkásember

Csatlakozott: 2014.01.04. 18:31
Hozzászólások: 326
Megköszönt másnak: 79 alkalommal
Megköszönték neki: 7 alkalommal
Amint oda jutottam ahozz a géphez tesztelem.
Köszi!


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


Ki van itt

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