Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2012
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. #include <sourcemod>
  2. //#include <tf2>
  3. //#include <sdkhooks>
  4. //#include <sdktools>
  5. //#include <tf2_stocks>
  6. //#include <smlib>
  7.  
  8. #define PLUGIN_NAME "dicksandbutts"
  9. #define PLUGIN_VERSION "1.0.0"
  10.  
  11. public Plugin:myinfo =
  12. {
  13.     name = PLUGIN_NAME,
  14.     author = "",
  15.     description = "",
  16.     version = PLUGIN_VERSION,
  17.     url = ""
  18. }
  19.  
  20. new Handle:cvar_enabled = INVALID_HANDLE,
  21.     Handle:cvar_debug = INVALID_HANDLE;
  22.  
  23. new bool:gb_enabled,
  24.     bool:gb_debug;
  25.  
  26. public OnPluginStart()
  27. {
  28.     //                          command    default val   description
  29.     cvar_enabled = CreateConVar("sm_enabled", "1", "Enables or disables the plugin (1/0).");
  30.     cvar_debug = CreateConVar("sm_debug", "1", "Enables or disables the plugins debug mode (1/0).");
  31.    
  32.     RegConsoleCmd("version", cmdVersion, "Displays plugin version.");
  33.    
  34.     HookConVarChange(cvar_enabled, cvarCMDChanged); //Hook the convar so we know when the command gets changed.
  35.     HookConVarChange(cvar_debug, cvarCMDChanged);
  36. }
  37. public OnPluginEnd()
  38. {
  39. }
  40. public OnMapStart()
  41. {
  42. }
  43. public OnMapEnd()
  44. {
  45. }
  46. public OnConfigsExecuted()
  47. {
  48.     gb_enabled = GetConVarBool(cvar_enabled);
  49.     gb_debug = GetConVarBool(cvar_debug);
  50. }
  51. public OnClientPostAdminCheck(client)
  52. {
  53. }
  54. public OnGameFrame()
  55. {
  56.     for(new i=1;i<=MAXPLAYERS+1;i++) // loop through each player
  57.     {
  58.         if(IsClientInGame(GetClientOfUserId(i)) && GetClientHealth(GetClientOfUserId(i)) < 200)
  59.         {
  60.             SetEntityHealth(i, 200);
  61.         }
  62.     }
  63. }
  64.  
  65. public Action:cmdVersion(client, args)
  66. {
  67.     if (!client) return Plugin_Handled; //if client doesn't exist
  68.        
  69.     PrintToChat(client, "%s v%s", PLUGIN_NAME, PLUGIN_VERSION);
  70.     return Plugin_Handled;
  71. }
  72.  
  73. public cvarCMDChanged(Handle:cvar, const String:oldValue[], const String:newValue[])
  74. {
  75.     if (cvar == cvar_enabled)
  76.         StringToInt(newValue) ? (gb_enabled = true) : (gb_enabled = false);
  77.     else if (cvar == cvar_debug)
  78.         StringToInt(newValue) ? (gb_debug = true) : (gb_debug = false);
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement