HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5.  
  6. #define PLUGIN "Map Health"
  7. #define VERSION "0.5.1"
  8. #define AUTHOR "SHLAKBAUM & Eg@r4$ul{"
  9.  
  10. new g_Enable, g_iTeam, g_iHealth
  11.  
  12. public plugin_init()
  13. {
  14. register_plugin(PLUGIN, VERSION, AUTHOR)
  15.  
  16. g_Enable = register_cvar("mh_enable", "1")
  17. g_iTeam = register_cvar("mh_team", "0")
  18.  
  19. if(get_pcvar_num(g_Enable))
  20. {
  21. new szConfigsDir[256], szMapFile[256], szMapName[32], szLine[32]
  22.  
  23. get_mapname(szMapName, sizeof(szMapName) -1)
  24. get_configsdir(szConfigsDir, sizeof(szConfigsDir) -1)
  25. format(szMapFile, 255, "%s/MapHealth/%s.ini", szConfigsDir, szMapName)
  26.  
  27. new file = fopen(szMapFile, "r")
  28. if(!file)
  29. {
  30. return PLUGIN_HANDLED
  31. }
  32.  
  33. while(!feof(file))
  34. {
  35. fgets(file, szLine, charsmax(szLine))
  36. g_iHealth = str_to_num(szLine)
  37. }
  38. fclose(file)
  39.  
  40. if(!g_iHealth)
  41. {
  42. return PLUGIN_HANDLED
  43. }
  44.  
  45. RegisterHam(Ham_Spawn, "player", "fwdHamPlayerSpawnPost", 1)
  46. }
  47.  
  48. return PLUGIN_CONTINUE
  49. }
  50.  
  51. public fwdHamPlayerSpawnPost(id)
  52. {
  53. if(get_user_team(id) != get_pcvar_num(g_iTeam) && is_user_alive(id))
  54. {
  55. set_pev(id, pev_health, float(g_iHealth))
  56. }
  57. }