AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] Dukehacks (https://forums.alliedmods.net/showthread.php?t=69658)

L. Duke 04-08-2008 15:07

[EXTENSION] Dukehacks
 
3 Attachment(s)
Dukehacks
version: 0.0.1.x

----------------------------
Currently supports TF2(0.0.1.X), DODS(0.0.1.X), and CSS(0.0.0.3).
Also, TheOwning has posted an update to the offsets text file for the Empires Mod
----------------------------

See the included .sp files for how to use.

Orangebox functions:

OnEntityCreated (see dhentities.sp) (Note: Reading info like class name can cause crashes here. For most things you should use OnEntitySpawned instead.)

OnEntitySpawned
(see dhentities.sp and dhpipebomb.sp)

OnEntityDeleted
(see dhentities.sp)

dhTakeDamage
(apply damage to a player or entity by another player or entity)

dhAddClientHook (hook client functions)
  • TraceAttack (see dhtraceattack.sp) // deprecated (use TakeDamage)
  • Processusercmds
  • PreThink (see dhthinkhooks.sp)
  • PostThink (see dhthinkhooks.sp)
  • TakeDamage (see dhnofalldmg.sp)
  • more coming...
dhHookEntity (hook specific entities)
  • Touch (see dhjumppad.sp)
  • VPhysicsUpdate (physics ent "think" function, see dhballoon.sp)
  • more coming...
----------------------------

PHP Code:

/**
 * @brief enums
 */
 
enum ClientHookType
{
    
CHK_TraceAttack 0,  // deprecated, use CHK_TakeDamage
    
CHK_ProcessUsercmds,
    
CHK_PreThink,
    
CHK_PostThink,
    
CHK_TakeDamage,
    
CHK_Other
};

enum EntityHookType
{
    
EHK_Touch 0,
    
EHK_VPhysicsUpdate,
    
EHK_Other
};

funcenum Hooks
{
    
/**** clients ****/
    
    // TraceAttack hook (pre) (client)
    
Action:public(clientattackerinflictorFloat:Damage, &Float:damageMultiplier),
    
// ProcessUsercmds hook (pre) (client)
    
Action:public(client, &buttons, &impulse),
    
// PreThink hook (pre) (client)
    // PostThink hook (pre) (client)
    
Action:public(client),
    
// TakeDamage hook (pre) (client)
    
Action:public(clientattackerinflictorFloat:Damage, &Float:damageMultiplierdamagetype),
    
// VPhysicsUpdate hook
    
Action:public(entity),
    
    
/**** entities ****/
    
Action:public(entityother)
};
 
/**
 * @brief Called whenever an entity is created (currently only entities with an edict index)
 *        Using GetEdictClasName and similar functions can cause the server to crash.
 *        For most applications, you should use dhOnEntitySpawned instead. 
 *
 * @param edict        Index of the edict.
 * @return            Pl_Continue
 */
forward ResultType:dhOnEntityCreated(edict);

/**
 * @brief Called whenever an entity is spawned (currently only entities with an edict index)
 *
 * @param edict        Index of the edict.
 * @return            Pl_Continue
 */
forward ResultType:dhOnEntitySpawned(edict);

/**
 * @brief Called whenever an entity is deleted (currently only entities with an edict index)
 *
 * @param edict        Index of the edict.
 * @return            Pl_Continue
 */
forward ResultType:dhOnEntityDeleted(edict);

/**
 * @brief Add hook to all clients (players) [for example: TraceAttack]
 *
 * @param type            type of hook.
 * @param func            function name to send the hook to.
 * @return                none
 */
native dhAddClientHook(ClientHookType:typeHooks:func);

/**
 * @brief    Add hook to specified entity (for example: Touch hook)
 *            (entities will automatically be unhooked by the extension
 *            when they are deleted)
 *
 * @param entity        entity to hook
 * @param type            type of hook.
 * @param func            function name to send the hook to.
 * @return                none
 */
native dhHookEntity(entityEntityHookType:typeHooks:func);


/**
 * @brief    Removes a hook from a specified entity (for example: Touch hook)
 *            (entities will automatically be unhooked by the extension
 *            when they are deleted)
 *
 * @param entity        entity to unhook
 * @param type            type of hook.
 * @return                none
 */
native dhUnHookEntity(entityEntityHookType:type);


/**
 * @brief    applies damage to a player or entity
 *
 * @param entity        entity to damage
 * @param attacker        player/entity attacking
 * @param inflictor        player/entity doing damage (generally same as attacker unless attacker uses an object/projectile)
 * @param damage        damage to apply
 * @param damagetype    type of damage (DMG_BULLET, DMG_FALL, etc.)
 * @return                false if entity/attacker/inflictor are invalid
 *                        true otherwise
 */
native dhTakeDamage(entityattackerinflictorFloat:damagedamagetype);

    
/**
 * @brief Game defines
 */
 
/* buttons */
#define IN_ATTACK        (1 << 0)
#define IN_JUMP            (1 << 1)
#define IN_DUCK            (1 << 2)
#define IN_FORWARD        (1 << 3)
#define IN_BACK            (1 << 4)
#define IN_USE            (1 << 5)
#define IN_CANCEL        (1 << 6)
#define IN_LEFT            (1 << 7)
#define IN_RIGHT        (1 << 8)
#define IN_MOVELEFT        (1 << 9)
#define IN_MOVERIGHT    (1 << 10)
#define IN_ATTACK2        (1 << 11)
#define IN_RUN            (1 << 12)
#define IN_RELOAD        (1 << 13)
#define IN_ALT1            (1 << 14)
#define IN_ALT2            (1 << 15)
#define IN_SCORE        (1 << 16)   // Used by client.dll for when scoreboard is held down
#define IN_SPEED        (1 << 17)    // Player is holding the speed key
#define IN_WALK            (1 << 18)    // Player holding walk key
#define IN_ZOOM            (1 << 19)    // Zoom key for HUD zoom
#define IN_WEAPON1        (1 << 20)    // weapon defines these bits
#define IN_WEAPON2        (1 << 21)    // weapon defines these bits
#define IN_BULLRUSH        (1 << 22)
#define IN_GRENADE1        (1 << 23)    // grenade 1
#define IN_GRENADE2        (1 << 24)    // grenade 2

/*  damage  */
// NOTE: TF2 seems to redefine some of the middle flags
//       for example, a crit attack passes DMG_ACID.
//       Adding DMG_ACID will not make an attack critical though. :(
#define DMG_GENERIC            0            // generic damage was done
#define DMG_CRUSH            (1 << 0)    // crushed by falling or moving object. 
                                        // NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage.
                                        // DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead.
#define DMG_BULLET            (1 << 1)    // shot
#define DMG_SLASH            (1 << 2)    // cut, clawed, stabbed
#define DMG_BURN            (1 << 3)    // heat burned
#define DMG_VEHICLE            (1 << 4)    // hit by a vehicle
#define DMG_FALL            (1 << 5)    // fell too far
#define DMG_BLAST            (1 << 6)    // explosive blast damage
#define DMG_CLUB            (1 << 7)    // crowbar, punch, headbutt
#define DMG_SHOCK            (1 << 8)    // electric shock
#define DMG_SONIC            (1 << 9)    // sound pulse shockwave
#define DMG_ENERGYBEAM        (1 << 10)    // laser or other high energy beam 
#define DMG_PREVENT_PHYSICS_FORCE        (1 << 11)    // Prevent a physics force 
#define DMG_NEVERGIB        (1 << 12)    // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB        (1 << 13)    // with this bit OR'd in, any damage type can be made to gib victims upon death.
#define DMG_DROWN            (1 << 14)    // Drowning
#define DMG_PARALYZE        (1 << 15)    // slows affected creature down
#define DMG_NERVEGAS        (1 << 16)    // nerve toxins, very bad
#define DMG_POISON            (1 << 17)    // blood poisoning - heals over time like drowning damage
#define DMG_RADIATION        (1 << 18)    // radiation exposure
#define DMG_DROWNRECOVER    (1 << 19)    // drowning recovery
#define DMG_ACID            (1 << 20)    // toxic chemicals or acid burns
#define DMG_SLOWBURN        (1 << 21)    // in an oven
#define DMG_REMOVENORAGDOLL    (1<<22)        // with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed.
                                        // use this to kill an entity that you've already got a server-side ragdoll for
#define DMG_PHYSGUN            (1<<23)        // Hit by manipulator. Usually doesn't do any damage.
#define DMG_PLASMA            (1<<24)        // Shot by Cremator
#define DMG_AIRBOAT            (1<<25)        // Hit by the airboat's gun
#define DMG_DISSOLVE        (1<<26)        // Dissolving!
#define DMG_BLAST_SURFACE    (1<<27)        // A blast on the surface of water that cannot harm things underwater
#define DMG_DIRECT            (1<<28)
#define DMG_BUCKSHOT        (1<<29)        // not quite a bullet. Little, rounder, different. 

----------------------------

Changelist
0.0.1.9
- added VPhysicsUpdate entity hook (physics ent "think" function)
0.0.1.7
- added dhTakeDamage
- added TakeDamage hook on clients
0.0.1.5 and 0.0.1.6
- added client hooks ProcessUsercmds, PreThink, and PostThink
- added entity hook Touch
0.0.1.3 and 0.0.1.4
- added TraceAttack hook (see dhtraceattack.sp for example use)
- fixed Linux .so for SM 1.0.4
0.0.1.x
- orangebox version
- CSS specific functions are not included (and will probably not be included when CSS goes orangebox)
0.0.0.3
- added defines for TerminateRound reasons
- added GameDescription changer
- added event queue (ent_fire) native
0.0.0.2
- fixed possible crash bug in round end blocker
0.0.0.1
- initial release

----------------------------

Download
0.0.0.3
and earlier are CSS only!
0.0.1.x is for Orangebox games only! There are two versions, one for SM 1.1 and one for SM 1.0.4.

Linux Users: If SELinux is enabled, this plugin will crash the server when it loads. Either disable SELinux or disable/renable/restart after installing the file.

Click here for a newer better hacks extension thanks to DJ Tsunami!


L. Duke 04-08-2008 15:08

Re: [EXTENSION] Dukehacks (CSS)
 
1 Attachment(s)
Source:

SAMURAI16 04-08-2008 15:42

Re: [EXTENSION] Dukehacks (CSS)
 
awesome
Well done

Fredd 04-08-2008 20:50

Re: [EXTENSION] Dukehacks (CSS)
 
good job man i been waiting!!

BAILOPAN 04-09-2008 01:56

Re: [EXTENSION] Dukehacks (CSS)
 
Very nice, LDuke!

bl4nk 04-09-2008 07:55

Re: [EXTENSION] Dukehacks (CSS)
 
I'd love to have the entity listener for TF2. What would it take to make you port it over? :D

L. Duke 04-09-2008 11:36

Re: [EXTENSION] Dukehacks (CSS)
 
I'm hoping to add other mods after I get more of the functionality completed. I'll be working on TF2 at some point because it will be a good stepping stone to getting the extension compatible with the OB in case Valve ever follows through and updates CSS and DODS to the OB version.

bl4nk 04-09-2008 11:44

Re: [EXTENSION] Dukehacks (CSS)
 
All the functionality I need right now is the hook for when new entities are created. If you could possibly throw together a quick extension with that only I would be in your debt.

toazron1 04-10-2008 11:09

Re: [EXTENSION] Dukehacks (CSS)
 
Id be interested in a TF2 version as well. Looks very interesting.

blade81 04-12-2008 12:57

Re: [EXTENSION] Dukehacks (CSS)
 
Nice! could you add progress bar asap pls? Can you make the progress bar cancelable at any time?


All times are GMT -4. The time now is 07:16.

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