HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #pragma semicolon 1
  2.  
  3. #include <sourcemod>
  4.  
  5. // Global Definitions
  6. #define PLUGIN_VERSION "1.2.2"
  7.  
  8. // Functions
  9. public Plugin:myinfo =
  10. {
  11. name = "Elet beállítás",
  12. author = "Mr. Blip",
  13. description = "Jatekos elet beallitasok.",
  14. version = PLUGIN_VERSION,
  15. };
  16.  
  17.  
  18. public OnPluginStart()
  19. {
  20. LoadTranslations("common.phrases");
  21. LoadTranslations("sethealth.phrases");
  22. CreateConVar("sm_sethealth_version", PLUGIN_VERSION, "SetHealth Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
  23. RegAdminCmd("sm_sethealth", Command_SetHealth, ADMFLAG_SLAY, "sm_sethealth <#userid|nev> <ertek>");
  24. }
  25.  
  26. public Action:Command_SetHealth(client, args)
  27. {
  28. decl String:target[32], String:mod[32], String:health[10];
  29. new nHealth;
  30. new maxHealth[10] = {0, 125, 125, 200, 175, 150, 300, 175, 125, 125};
  31.  
  32. GetGameFolderName(mod, sizeof(mod));
  33.  
  34. if (args < 2)
  35. {
  36. ReplyToCommand(client, "[SM] Hasznalat:: sm_sethealth <#userid|nev> <ertek>");
  37. return Plugin_Handled;
  38. }
  39. else {
  40. GetCmdArg(1, target, sizeof(target));
  41. GetCmdArg(2, health, sizeof(health));
  42. nHealth = StringToInt(health);
  43. }
  44.  
  45. if (nHealth < 0) {
  46. ReplyToCommand(client, "[SM] Eletet nem lehet beallitani nullara.");
  47. return Plugin_Handled;
  48. }
  49.  
  50. decl String:target_name[MAX_TARGET_LENGTH];
  51. new target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  52.  
  53. if ((target_count = ProcessTargetString(
  54. target,
  55. client,
  56. target_list,
  57. MAXPLAYERS,
  58. COMMAND_FILTER_ALIVE,
  59. target_name,
  60. sizeof(target_name),
  61. tn_is_ml)) <= 0)
  62. {
  63. ReplyToTargetError(client, target_count);
  64. return Plugin_Handled;
  65. }
  66.  
  67. for (new i = 0; i < target_count; i++)
  68. {
  69. if (strcmp(mod, "tf") == 0) {
  70. new class = GetEntProp(target_list[i], Prop_Send, "m_iClass");
  71.  
  72. if (nHealth == 0)
  73. FakeClientCommand(target_list[i], "explode");
  74. else if (nHealth > maxHealth[class]) {
  75. SetEntProp(target_list[i], Prop_Data, "m_iMaxHealth", nHealth);
  76. SetEntityHealth(target_list[i], nHealth);
  77. }
  78. }
  79.  
  80. else {
  81. if (nHealth == 0)
  82. SetEntityHealth(target_list[i], 1);
  83. else
  84. SetEntityHealth(target_list[i], nHealth);
  85. }
  86.  
  87. LogAction(client, target_list[i], "\"%L\" beallitva \"%L\" elete %i", client, target_list[i], nHealth);
  88. }
  89.  
  90. if (tn_is_ml)
  91. ShowActivity2(client, "[SM] ", "%t", "elet atallitva", target_name, nHealth);
  92. else
  93. ShowActivity2(client, "[SM] ", "%t", "elet atallitva", "_s", target_name, nHealth);
  94.  
  95. return Plugin_Handled;
  96.  
  97. }