AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Hook Grab Rope (1.1.4) (https://forums.alliedmods.net/showthread.php?t=201154)

Sheepdude 11-17-2012 18:36

[ANY] Hook Grab Rope (1.1.4)
 
3 Attachment(s)
Hook Grab Rope

Version 1.1.4


Table of Contents
----------------------------------------------------
Description
Commands and Cvars
Forwards and Natives
Complementary Plugins
Installation
Dependencies
Credits
Changelog
To Do
Notes
Download


Description
----------------------------------------------------
Allows admins (or all players) to hook on to walls,
grab other players, or swing on a rope.

Example usage: bind q +hook

Youtube Demonstration: http://www.youtube.com/watch?v=4whoHchDdgc


Commands and Cvars
----------------------------------------------------
Commands
+hook Shoot a hook and glide toward where it lands
+grab Grab a player or object and move it around
+rope Attach a rope and swing on it
+push Shoot a hook and push away from it

Spoiler


Forwards and Natives
----------------------------------------------------
Code:

/**
 * Called when a player tries to hook.
 *
 * @param client    Player index.
 * @return          Plugin_Handled; to stop the player from hooking.
 */
forward Action:HGR_OnClientHook(client);

/**
 * Called when a player tries to search for a grab target.
 *
 * @param client    Player index.
 * @return          Plugin_Handled; to stop the player from searching.
 */
forward Action:HGR_OnClientGrabSearch(client);

/**
 * Called when a player tries to grab a valid target.
 *
 * @param client    Player index.
 * @return          Plugin_Handled; to stop the player from grabbing.
 */
forward Action:HGR_OnClientGrab(client);

/**
 * Called when a player tries to rope.
 *
 * @param client    Player index.
 * @return          Plugin_Handled; to stop the player from roping.
 */
forward Action:HGR_OnClientRope(client);

/**
 * Gives or removes group access to hook, grab, or rope.
 * Each client will receive a notification in chat.
 *
 * @param target    Group target [@all/@ct/@t] (String)
 * @param access    0 - Give, 1 - Take (integer)
 * @param action    0 - Hook, 1 - Grab, 2 - Rope (integer)
 * @return          The number of players whose access was set.
 */
native HGR_Access(const String:target[], access, action);

/**
 * Gives or removes client access to hook, grab, or rope.
 * The client will receive a notification in chat.
 *
 * @param client    Player index (integer)
 * @param access    0 - Give, 1 - Take (integer)
 * @param action    0 - Hook, 1 - Grab, 2 - Rope (integer)
 * @return          True if successful, false if client is a bot.
 * @error            Player index is out of bounds.
 */
native bool:HGR_ClientAccess(client, access, action);

/**
 * Returns whether or not a client is using the hook.
 *
 * @param client    Player index (integer)
 * @return          True if player is hooking, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsHooking(client);

/**
 * Returns whether or not a client is using the grab.
 *
 * @param client    Player index (integer)
 * @return          True if player is grabbing, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsGrabbing(client);

/**
 * Returns whether or not a client is being grabbed.
 *
 * @param client    Player index (integer)
 * @return          True if player is being grabbed, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsBeingGrabbed(client);

/**
 * Returns whether or not a client is using the rope.
 *
 * @param client    Player index (integer)
 * @return          True if player is using the rope, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsRoping(client);

/**
 * Returns whether or not a client is hooking backward
 *
 * @param client    Player index (integer)
 * @return          True if player is hooking backward, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsPushing(client);

/**
 * Returns whether or not a client is attracting a grab target
 *
 * @param client    Player index (integer)
 * @return          True if player is attracting grab target, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsAttracting(client);

/**
 * Returns whether or not a client is repelling a grab target
 *
 * @param client    Player index (integer)
 * @return          True if player is repelling grab target, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsRepelling(client);

/**
 * Returns whether or not a client is ascending a rope
 *
 * @param client    Player index (integer)
 * @return          True if player is ascending a rope, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsAscending(client);

/**
 * Returns whether or not a client is descending a rope
 *
 * @param client    Player index (integer)
 * @return          True if player is descending a rope, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_IsDescending(client);

/**
 * Retrieves the location where a client's hook is attached.
 *
 * @param client    Player index (integer)
 * @param buffer    Buffer to store the location in (Float)
 * @return          True if player is hooking, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_GetHookLocation(client, Float:buffer[3]);

/**
 * Retrieves the location where a client's grab is attached.
 *
 * @param client    Player index (integer)
 * @param buffer    Buffer to store the location in (Float)
 * @return          True if player is grabbing, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_GetGrabLocation(client, Float:buffer[3]);

/**
 * Retrieves the location where a client's rope is attached.
 *
 * @param client    Player index (integer)
 * @param buffer    Buffer to store the location in (Float)
 * @return          True if player is using the rope, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_GetRopeLocation(client, Float:buffer[3]);

/**
 * Retrieves the location opposite of where a client's hook is attached.
 *
 * @param client    Player index (integer)
 * @param buffer    Buffer to store the location in (Float)
 * @return          True if player is using the hook, false otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_GetPushLocation(client, Float:buffer[3]);

/**
 * Retrieves the distance between the client and where their hook landed
 *
 * @param client    Player index (integer)
 * @return          Hook distance, or -1 if client is not hooking.
 * @error            Player index is out of bounds.
 */
native Float:HGR_GetHookDistance(client);

/**
 * Retrieves the distance between the client and their grab target
 *
 * @param client    Player index (integer)
 * @return          Grab distance, or -1 if client is not hooking.
 * @error            Player index is out of bounds.
 */
native Float:HGR_GetGrabDistance(client);

/**
 * Retrieves the distance between the client and where their rope landed
 *
 * @param client    Player index (integer)
 * @return          Rope distance, or -1 if client is not hooking.
 * @error            Player index is out of bounds.
 */
native Float:HGR_GetRopeDistance(client);

/**
 * Retrieves the distance between the client and the location opposite of where their hook landed
 *
 * @param client    Player index (integer)
 * @return          Push distance, or -1 if client is not hooking.
 * @error            Player index is out of bounds.
 */
native Float:HGR_GetPushDistance(client);

/**
 * Retrieves the entity index of a client's hook target.
 *
 * @param client    Player index (integer)
 * @return          Entity index of hook target, or -1 if client has no target.
 * @error            Player index is out of bounds.
 */
native HGR_GetHookTarget(client);

/**
 * Retrieves the entity index of a client's grab target.
 *
 * @param client    Player index (integer)
 * @return          Entity index of grab target, or -1 if client has no target.
 * @error            Player index is out of bounds.
 */
native HGR_GetGrabTarget(client);

/**
 * Retrieves the entity index of a client's rope target.
 *
 * @param client    Player index (integer)
 * @return          Entity index of rope target, or -1 if client has no target.
 * @error            Player index is out of bounds.
 */
native HGR_GetRopeTarget(client);

/**
 * Retrieves the entity index opposite of a client's hook target.
 *
 * @param client    Player index (integer)
 * @return          Entity index of push target, or -1 if client has no target.
 * @error            Player index is out of bounds.
 */
native HGR_GetPushTarget(client);

/**
 * Forces a client to use their hook.
 *
 * @param client    Player index (integer)
 * @return          False if player is performing an action and unable to hook, true otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_ForceHook(client);

/**
 * Forces a client to use their grab.
 *
 * @param client    Player index (integer)
 * @return          False if player is performing an action and unable to grab, true otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_ForceGrab(client);

/**
 * Forces a client to use their rope.
 *
 * @param client    Player index (integer)
 * @return          False if player is performing an action and unable to rope, true otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_ForceRope(client);

/**
 * Forces a client to use their hook push.
 *
 * @param client    Player index (integer)
 * @return          False if player is performing an action and unable to push, true otherwise.
 * @error            Player index is out of bounds.
 */
native bool:HGR_ForcePush(client);

/**
 * Stops a client hook in progress.
 *
 * @param client    Player index (integer)
 * @return          True if successful, false if player is not hooking.
 * @error            Player index is out of bounds.
 */
native bool:HGR_StopHook(client);

/**
 * Stops a client grab in progress.
 *
 * @param client    Player index (integer)
 * @return          True if successful, false if player is not grabbing.
 * @error            Player index is out of bounds.
 */
native bool:HGR_StopGrab(client);

/**
 * Stops a client rope in progress.
 *
 * @param client    Player index (integer)
 * @return          True if successful, false if player is not roping.
 * @error            Player index is out of bounds.
 */
native bool:HGR_StopRope(client);

/**
 * Stops a client hook push in progress.
 *
 * @param client    Player index (integer)
 * @return          True if successful, false if player is not pushing.
 * @error            Player index is out of bounds.
 */
native bool:HGR_StopPush(client);


Complementary Plugins
----------------------------------------------------
  • [HGRMM 1.0] Hook Grab Rope Minimum/Maximum Distance (29 November 2012)
    -Restricts player actions to a specific distance range.
    -Set convars in /cfg/sourcemod/hgrmm.cfg.

  • [HGRLimit 1.0] Hook Grab Rope Limit Use (20 December 2012)
    -Restricts player actions to a certain number of uses per round and map.
    -Set convars in /cfg/sourcemod/hgrlimit.cfg.


Installation
----------------------------------------------------
Extract the zip file contents into your game directory.
Edit settings in \cfg\sourcemod\hookgrabrope.cfg


Dependencies
----------------------------------------------------
None


Credits
----------------------------------------------------
Changelog
----------------------------------------------------
Spoiler
  • 1.1.4 (21 December 2012)
    -Bug fix: Previously, the plugin was freezing the grabber instead of the grab target.


To Do
----------------------------------------------------
  • None at the moment.

Notes
----------------------------------------------------
  • This plugin is meant to replace the previous HGRSource plugin.
  • If you are using custom UpButton and DownButton convars, keep in mind that some buttons may not function correctly for your mod.
  • Let me know if you find any bugs or have a feature request.
  • Use admin_overrides.cfg to change admin permissions for the plugin commands.
Example admin_overrides.cfg:
Code:

Overrides
{
        "+grab"        "z"
        "+rope"        "cef"
}

In this example, only admins with the "z" flag can use grab, and only admins with all three "cef" flags can use rope. Since hook is not listed, any admin with ADMFLAG_GENERIC ("b") flag can use hook.


Download
----------------------------------------------------

hamilton5 11-17-2012 23:46

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.4)
 
cool man, good start anyway. Any plans for some real textures vs the color? Maybe sounds for when it 'hooks'?

Sheepdude 11-18-2012 00:07

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.4)
 
For sounds, yes. I'll have to find a good one. I didn't plan on changing the look of the beam, since the plugin just uses temp entities to draw the beam effect. If you have a good idea for changing the beam and can push me in the right direction in terms of coding, I'd be interested.

shavit 11-18-2012 00:54

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.4)
 
Great plugin.
I'll install.

hamilton5 11-18-2012 04:28

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.4)
 
Im able to hook to the sky while still in freeze time and move
also HGR contact admin error.. when dead trying to hook..

Sheepdude 11-18-2012 05:56

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.4)
 
Quote:

Originally Posted by hamilton5 (Post 1839800)
Im able to hook to the sky while still in freeze time and move
also HGR contact admin error.. when dead trying to hook..

That will happen, since one of the criteria for the contact admin error is that the player trying to hook is not alive... perhaps I can establish separate criteria for that so the error is not displayed.

As for hooking while frozen, that is intended according to the original plugin code, but I will implement a convar to toggle that. Thanks for the feedback.

hamilton5 11-18-2012 06:05

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.4)
 
seems odd you cant hook the ground or to a wall to move during freezetime then..

thanks for continuing development and getting it working on GO :)

Sheepdude 11-18-2012 21:51

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.5)
 
New version
  • 1.0.5 (18 November 2012)
    -Added convar sm_hgr_freeze_enable to disable plugin during freezetime.
    -Added sound effects
    -Made error messages less verbose.
    -Allow grabbing of non-player entities
    -Improved entity checks

Mitchell 11-18-2012 22:42

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.5)
 
you should fix the issue of using rope having it pull you up constantly, and should be a constant distance.

Sreaper 11-18-2012 22:56

Re: [CS:S/CS:GO] Hook Grab Rope (1.0.5)
 
Very nice plugin. If you have time, would you please add a convar that defines the hook hit sound?
Additionally, your plugin should work with any game.

Change line 130
Code:

HookEvent("round_freeze_end", RoundFreezeEndEvent);
to
Code:

HookEventEx("round_freeze_end", RoundFreezeEndEvent);
Tested on TF2.


All times are GMT -4. The time now is 08:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.