HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <sourcemod>
  2. #pragma semicolon 1
  3.  
  4. #define PLUGIN_VERSION "1.0"
  5.  
  6. new Handle:cvarhealthmaximum;
  7. new Handle:cvarhealthtogive;
  8.  
  9. public Plugin:myinfo =
  10. {
  11. name = "DoD Medic",
  12. author = "Hell Phoenix",
  13. description = "DoD Medic",
  14. version = PLUGIN_VERSION,
  15. url = "http://www.charliemaurice.com/plugins/"
  16. };
  17.  
  18. public OnPluginStart(){
  19. CreateConVar("dod_medic_version", PLUGIN_VERSION, "DoD Medic Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
  20. cvarhealthmaximum = CreateConVar("dod_medic_health_maximum","30","Maximum elet a !medic parancs hasznalatahoz!",FCVAR_PLUGIN);
  21. cvarhealthtogive = CreateConVar("dod_medic_health_give","40","Mennyi eletet adjon a !medic parancs!",FCVAR_PLUGIN);
  22.  
  23. RegConsoleCmd("say", Command_Say);
  24. RegConsoleCmd("say_team", Command_Say);
  25.  
  26. }
  27.  
  28. public Action:Command_Say(client,args){
  29. if(client != 0){
  30.  
  31. decl String:speech[64];
  32. decl String:clientName[64];
  33. GetClientName(client,clientName,64);
  34. GetCmdArgString(speech,sizeof(speech));
  35.  
  36. new startidx = 0;
  37. if (speech[0] == '"'){
  38. startidx = 1;
  39. new len = strlen(speech);
  40. if (speech[len-1] == '"'){
  41. speech[len-1] = '\0';
  42. }
  43. }
  44.  
  45. if(strcmp(speech[startidx],"!medic",false) == 0){
  46. CreateTimer(0.1, Medic, client);
  47. return Plugin_Handled;
  48. }
  49. }
  50. return Plugin_Continue;
  51. }
  52.  
  53. public Action:Medic(Handle:timer, any:client){
  54. new dead = GetPlayerState(client);
  55. new health = GetPlayerHealth(client);
  56. LogMessage("%s", health);
  57. if (dead != 512){
  58. PrintToChat(client, "[DoD Medic] A halottak nem tudnak segitseget kerni!");
  59. return Plugin_Continue;
  60. }
  61. if (health <= GetConVarInt(cvarhealthmaximum)){
  62. ClientCommand(client, "voice_medic");
  63. new nhealth = (GetConVarInt(cvarhealthtogive) + health);
  64. SetEntProp(client, Prop_Send, "m_iHealth", nhealth, 1);
  65. }else{
  66. PrintToChat(client, "[DoD Medic] Meg nem szolhatsz az orvosnak, nincs nagy bajod!");
  67. }
  68.  
  69. return Plugin_Handled;
  70. }
  71.  
  72.  
  73. public GetPlayerHealth(playerindex){
  74. return GetEntData(playerindex,GetHealthOffset(playerindex));
  75. }
  76. public GetHealthOffset(playerindex){
  77. return FindDataMapOffs(playerindex,"m_iHealth");
  78. }
  79.  
  80. public GetPlayerState(playerindex){
  81. return GetEntData(playerindex,GetStateOffset(playerindex));
  82. }
  83. public GetStateOffset(playerindex){
  84. return FindDataMapOffs(playerindex,"m_lifeState");
  85. }
  86.  
  87.