Advertisement
Guest User

[TF2] Friendly Mode include file

a guest
Oct 7th, 2018
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.21 KB | None | 0 0
  1. /****************************************************************************************************
  2.     THIS IS AN UNOFFICIAL UPLOAD OF FRIENDLY MODE'S INCLUDE FILE
  3.     IF YOU CAN FIND THE INCLUDE FILE FROM THE BELOW LINK DO *NOT* USE THIS ONE
  4.     https://forums.alliedmods.net/showthread.php?t=213205
  5.     The plugin is currently missing. The inc file has been temporarily
  6.     uploaded here to satisfy compile dependencies for other plugins.
  7. *****************************************************************************************************/
  8.  
  9. #if defined _tf2friendly_included
  10.   #endinput
  11. #endif
  12. #define _friendly_included
  13.  
  14. public SharedPlugin:__pl_tf2friendly = {
  15.     name = "[TF2] Friendly Mode",
  16.     file = "friendly.smx",
  17. #if defined REQUIRE_PLUGIN
  18.     required = 1,
  19. #else
  20.     required = 0,
  21. #endif
  22. };
  23.  
  24. public __pl_tf2friendly_SetNTVOptional() {
  25.     MarkNativeAsOptional("TF2Friendly_IsFriendly");
  26.     MarkNativeAsOptional("TF2Friendly_SetFriendly");
  27.     MarkNativeAsOptional("TF2Friendly_IsLocked");
  28.     MarkNativeAsOptional("TF2Friendly_SetLock");
  29.     MarkNativeAsOptional("TF2Friendly_IsAdmin");
  30.     MarkNativeAsOptional("TF2Friendly_SetAdmin");
  31.     MarkNativeAsOptional("TF2Friendly_RefreshFriendly");
  32.     MarkNativeAsOptional("TF2Friendly_IsPluginEnabled");
  33. }
  34.  
  35. /****************************************************************************************************
  36.     FORWARDS
  37. *****************************************************************************************************/
  38.  
  39. /**
  40.  * Called everytime Friendly is self-toggled to determine if the player can do so.
  41.  * Return Plugin_Continue to allow, anything else denies them access.
  42.  *
  43.  * This is ONLY called if the player is toggling Friendly on themselves, either through running
  44.  * sm_friendly with no arguments, or using sm_friendly without access to sm_friendly_targetothers
  45.  *
  46.  * @param client        Client Index.
  47.  */
  48. forward Action:TF2Friendly_CanToggleFriendly(client);
  49.  
  50.  
  51.  
  52. /**
  53.  * Called during a Friendly player's refreshing of Friendly Mode.
  54.  *
  55.  * To "refresh" Friendly Mode means to apply/reapply all attributes that may
  56.  * have been removed by other plugins, such as transparency, FL_NOTARGET, etc.
  57.  * This happens every time a Friendly player enters Friendly Mode, hits
  58.  * a resupply cabinet, respawns while remaining in Friendly Mode, has
  59.  * TF2Friendly_RefreshFriendly() called on him, etc.
  60.  *
  61.  * This is when most custom Friendly Mode limitations should be activated.
  62.  * You may also want to look into TF2Friendly_OnEnableFriendly().
  63.  *
  64.  * @param client        Client Index.
  65.  */
  66. forward TF2Friendly_OnRefreshFriendly(client);
  67.  
  68.  
  69.  
  70. /**
  71.  * Called during a player's transition into Friendly Mode. Any one-time limitations/effects to
  72.  * Friendly players should probably be applied here, such as "destroy all their buildings," "make
  73.  * them drop the intel," or "destroy all their sticky bombs."
  74.  *
  75.  * You will most likely want to use TF2Friendly_OnRefreshFriendly() instead.
  76.  *
  77.  * @param client        Client Index.
  78.  */
  79. forward TF2Friendly_OnEnableFriendly(client);
  80.  
  81.  
  82.  
  83. /**
  84.  * Called during a player's transition out of Friendly Mode. Any limitations to
  85.  * Friendly players should probably be removed here.
  86.  *
  87.  * @param client        Client Index.
  88.  */
  89. forward TF2Friendly_OnDisableFriendly(client);
  90.  
  91.  
  92.  
  93. /**
  94.  * Called immediately after a player has spawned into Friendly Mode, or has spawned while KEEPING
  95.  * Friendly Mode enabled. This is not called if the player had Friendly Mode removed on spawn.
  96.  *
  97.  * @param client        Client Index.
  98.  */
  99. forward TF2Friendly_OnFriendlySpawn(client);
  100.  
  101.  
  102.  
  103. /**
  104.  * Called immediately BEFORE a player enters Friendly Mode. If your plugin needs
  105.  * to somehow prepare something BEFORE a player goes Friendly, this is the time to do it.
  106.  *
  107.  * @param client        Client Index.
  108.  */
  109. forward TF2Friendly_OnEnableFriendly_Pre(client);
  110.  
  111.  
  112.  
  113. /**
  114.  * Called immediately AFTER a player's transition into Friendly Mode.
  115.  *
  116.  * @param client        Client Index.
  117.  */
  118. forward TF2Friendly_OnEnableFriendly_Post(client);
  119.  
  120.  
  121.  
  122. /**
  123.  * Called immediately BEFORE a player exits Friendly Mode. If your plugin needs
  124.  * to somehow prepare something BEFORE a player goes Hostile, this is the time to do it.
  125.  *
  126.  * @param client        Client Index.
  127.  */
  128. forward TF2Friendly_OnDisableFriendly_Pre(client);
  129.  
  130.  
  131.  
  132. /**
  133.  * Called immediately AFTER a player's transition out of Friendly Mode.
  134.  *
  135.  * @param client        Client Index.
  136.  */
  137. forward TF2Friendly_OnDisableFriendly_Post(client);
  138.  
  139.  
  140.  
  141. /**
  142.  * Called immediately BEFORE a player has Friendly Mode "refreshed" on them.
  143.  *
  144.  * @param client        Client Index.
  145.  */
  146. forward TF2Friendly_OnRefreshFriendly_Pre(client);
  147.  
  148.  
  149.  
  150. /**
  151.  * Called immediately AFTER a player has Friendly Mode refreshed.
  152.  *
  153.  * @param client        Client Index.
  154.  */
  155. forward TF2Friendly_OnRefreshFriendly_Post(client);
  156.  
  157.  
  158.  
  159. /**
  160.  * Called immediately after Friendly Mode is enabled through changing
  161.  * sm_friendly_enabled to 1.
  162.  *
  163.  * @param client        Client Index.
  164.  */
  165. forward TF2Friendly_OnPluginEnabled(client);
  166.  
  167.  
  168.  
  169. /**
  170.  * Called immediately after Friendly Mode is enabled through changing
  171.  * sm_friendly_enabled to 1. All Friendly players will be removed from
  172.  * Friendly Mode before this forward is called.
  173.  *
  174.  * @param client        Client Index.
  175.  */
  176. forward TF2Friendly_OnPluginDisabled(client);
  177.  
  178.  
  179.  
  180. /**
  181.  * Called immediately after the core Friendly Mode plugin has loaded,
  182.  * and all cvars and configs have been loaded/cached.
  183.  *
  184.  * You can call TF2Friendly_IsPluginEnabled() here.
  185.  *
  186.  * @param client        Client Index.
  187.  */
  188. forward TF2Friendly_OnPluginLoaded(client);
  189.  
  190.  
  191.  
  192. /**
  193.  * Called when Friendly Mode core plugin is unloaded. All Friendly players will
  194.  * be removed from Friendly Mode before this forward is called.
  195.  *
  196.  * @param client        Client Index.
  197.  */
  198. forward TF2Friendly_OnPluginUnloaded(client);
  199.  
  200.  
  201.  
  202. /****************************************************************************************************
  203.     NATIVES
  204. *****************************************************************************************************/
  205.  
  206.  
  207.  
  208. /**
  209.  * Returns whether or not a given player is Friendly.
  210.  *
  211.  * @param client        Client Index.
  212.  * @return              TRUE if Friendly, FALSE if not Friendly or if invalid client.
  213.  */
  214. native bool:TF2Friendly_IsFriendly(client);
  215.  
  216.  
  217.  
  218. /**
  219.  * Sets Friendly mode on a client.
  220.  *
  221.  * @param client        Client Index.
  222.  *
  223.  * @param direction     -1 to toggle, 0 to disable, or 1 to enable
  224.  *
  225.  * @param action        0 to make the change without punishment,
  226.  *                      -1 to slay the player and apply the change upon respawn,
  227.  *                      Any positive integer will have the player slapped for that
  228.  *                      amount of damage. If the player is slapped to death, the
  229.  *                      change will be re-applied upon respawn.
  230.  *
  231.  * @return              -3 if client is not a valid client index,
  232.  *                      -2 if client is not connected and in game,
  233.  *                      -1 if no change was made (the client was already in the requested state)
  234.  *                      0 if the player was made non-Friendly,
  235.  *                      1 if the player was made Friendly,
  236.  *                      2 if the player was made non-Friendly and was slapped to death,
  237.  *                      3 if the player was made Friendly and was slapped to death.
  238.  */
  239. native TF2Friendly_SetFriendly(client, direction=-1, action=0);
  240.  
  241.  
  242.  
  243. /**
  244.  * Returns whether or not a given player is Friendly Locked.
  245.  *
  246.  * @param client        Client Index.
  247.  * @return              TRUE if Locked, FALSE if not locked or if invalid client.
  248.  */
  249. native bool:TF2Friendly_IsLocked(client);
  250.  
  251.  
  252.  
  253. /**
  254.  * Sets or removes Friendly Lock on a client.
  255.  *
  256.  * @param client        Client Index.
  257.  *
  258.  * @param direction     -1 to toggle, 0 to remove lock, or 1 to place lock.
  259.  *
  260.  * @return              -3 if client is not a valid client index,
  261.  *                      -2 if client is not connected and in game,
  262.  *                      -1 if no change was made (the client was already in the requested state)
  263.  *                      0 if the player was unlocked,
  264.  *                      1 if the player was locked.
  265.  */
  266. native TF2Friendly_SetLock(client, direction=-1);
  267.  
  268.  
  269.  
  270. /**
  271.  * Returns whether or not a given player has Friendly Admin mode enabled.
  272.  *
  273.  * @param client        Client Index.
  274.  * @return              TRUE if Friendly Admin, FALSE if not Admin or if invalid client.
  275.  */
  276. native bool:TF2Friendly_IsAdmin(client);
  277.  
  278.  
  279.  
  280. /**
  281.  * Sets or removes Friendly Admin mode on a client.
  282.  *
  283.  * @param client        Client Index.
  284.  *
  285.  * @param direction     -1 to toggle, 0 to disable, or 1 to enable
  286.  *
  287.  * @return              -3 if client is not a valid client index,
  288.  *                      -2 if client is not connected and in game,
  289.  *                      -1 if no change was made (the client was already in the requested state)
  290.  *                      0 if the player was removed from Friendly Admin mode,
  291.  *                      1 if the player was given Friendly Admin mode.
  292.  */
  293. native TF2Friendly_SetAdmin(client, direction=-1);
  294.  
  295.  
  296.  
  297. /**
  298.  * Forces the client to undergo Friendly Mode refreshing, if Friendly.
  299.  *
  300.  * @param client        Client Index.
  301.  *
  302.  * @return              -3 if client is not a valid client index,
  303.  *                      -2 if client is not connected and in game,
  304.  *                      -1 if the client was not in Friendly Mode.
  305.  *                      1 if the function appeared to be successful.
  306.  */
  307. native TF2Friendly_RefreshFriendly(client);
  308.  
  309.  
  310.  
  311. /**
  312.  * Returns whether the plugin is enabled/disabled through the cvar sm_friendly_enabled.
  313.  *
  314.  * @return              TRUE if enabled
  315.  *                      FALSE if disabled
  316.  */
  317. native bool:TF2Friendly_IsPluginEnabled();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement