HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* AMX Mod X
  2. * Zoom Info
  3. *
  4. * (c) Copyright 2007 by VEN
  5. *
  6. * This file is provided as is (no warranties)
  7. */
  8.  
  9. // plugin's main information
  10. #define PLUGIN_NAME "Zoom Info"
  11. #define PLUGIN_VERSION "0.1"
  12. #define PLUGIN_AUTHOR "VEN"
  13.  
  14. #include <amxmodx>
  15. #include <fakemeta>
  16.  
  17. #define HUDMSG_X 0.02
  18. #define HUDMSG_Y 0.7
  19.  
  20. #define SET_HUDMSG(%1,%2) set_hudmessage(%1, %2, 0, HUDMSG_X, HUDMSG_Y, 0, 0.0, 0.1, 0.0, 0.0, 4)
  21.  
  22. #define FOV_DEFAULT 90
  23. #define FOV_ZOOM_X3 15
  24.  
  25. // ported statsx.sma distance() function
  26. #define UNITS_TO_METERS(%1) ((%1) * 0.0254)
  27.  
  28. public plugin_init() {
  29. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  30. register_forward(FM_PlayerPostThink, "fwPlayerPostThink")
  31. }
  32.  
  33. public fwPlayerPostThink(id) {
  34. static fov
  35. if ((fov = pev(id, pev_fov)) >= FOV_DEFAULT || !fov)
  36. return FMRES_IGNORED
  37.  
  38. static Float:units, player
  39. units = get_user_aiming(id, player, _:units)
  40. if (!is_user_alive(player))
  41. SET_HUDMSG(255, 255)
  42. else if (get_user_team(id) == get_user_team(player))
  43. SET_HUDMSG(0, 255)
  44. else
  45. SET_HUDMSG(255, 0)
  46.  
  47. show_hudmessage(id, "Zoom: x%d [%ddeg]^nTavolsag: %.1fm [%.1fu]", fov <= FOV_ZOOM_X3 ? 3 : 2, fov, UNITS_TO_METERS(units), units)
  48.  
  49. return FMRES_IGNORED
  50. }
  51.