Skip to content

A metamod plugin for Sven co-op, AngelsScript, Hook and SQLite!

License

Notifications You must be signed in to change notification settings

DrAbcOfficial/asexthook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASExtHook: Plugin to extend Sven Co-op script ASExtHook

License: GPL v3 Build Release Download Commit

ASExtHook is a Metamod plugin used to extend the Sven Co-op AngelScripts scripting system.

Using this plugin makes it easy to perform operations that were previously exceptionally difficult, such as hooking whether a monster is dead or not.

Auto-generated HTML documentation for the Sven Co-op AsExtHook Angelscript API is available Here

Used HTML Generator Here



1. Install

  1. Grab metamod-p and asext.dll/asext.so Here

  2. Install them.

  3. Grab asexthook.dll/asexthook.so, put them into svencoop/addons/metamod/dlls

    1. Grab latest version in Action (Unstable, crash risk)

      or

    2. Grab release version in Release (Stable)

  4. edit svencoop/addons/metamod/plugins.ini

  5. add

win32 addons/metamod/dlls/asexthook.dll
linux addons/metamod/dlls/asexthook.so
  1. enjoy your new hook :3

2. Build

If you are using systems that are not covered by automatic builds (yum's and aur's)

or want to add new hooks yourself, you can follow these steps to configure your build environment.

  1. Install everything you need

    1. Git or winget install --id Git.Git -e --source winget
    2. Visual Studio with vc143 toolset And C++ desktop development
    1. sudo apt install git make build-essential gcc gcc-multilib g++-multilib cmake -y
    1. sudo yum install git make gcc gcc-c++ glibc-devel.i686 libstdc++-devel.i686 cmake -y

    Sorry guys who using Arch, I've never used an Arch based distribution, you'll have to find out how to configure the dependencies yourselves!🙂

  2. Clone metamod modified by hzqst

    git clone https://github.com/DrAbcOfficial/metamod-fallguys.git metamod

    cd metamod

  3. Clone this

    git clone https://github.com/DrAbcOfficial/asexthook.git

    cd asexthook

  4. Build!

    1. Open asexthook.sln with visual studio
    2. Press F7
    3. Wait and done.
    1. mkdir build && cd build && cmake .. && make
  5. Grab

    Now you can grab your new library (asexthook.dll/asexthook.so) in

    metamod/build/addons/metamod/dlls/

3. Document

3.1. Current Expansion Property

Class Namespace Object
CBinaryStringBuilder <Global> g_BinaryStringBuilder

3.2. Current Expansion Objects

class HealthInfo{
	CBaseEntity@ pEntity;
	float flHealth;
	int bitsDamageType;
	int health_cap;
}

3.3. Current Expansion Methods

Class Method Explian
CEngineFuncs uint32 CRC32(const string& in szBuffer) Caculate CRC32 for a string
CEngineFuncs bool ClassMemcpy(?& in src, ?& in dst) copy class, If src and dst are different type, return false. If not class ref, crash game.
--- --- ---
CBinaryStringBuilder More info click url👉 CBinaryStringBuilder
CSQLite More info click url👉 CSQLite

3.4. Expansion Method Examples

Example

3.5. 3.5 Expansion CVar

CVar default explain
sv_fixgmr 1 add gmr found before SV_ModelIndex to fix gmr crash game

3.6. Current Expansion Hooks


3.6.1. EntitySpawn

Hooks::Entity const uint32 EntitySpawn (CBaseEntity@ pEntity)

Call after original CBaseEntity::Spawn called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.2. IRelationship

Hooks::Entity const uint32 IRelationship (CBaseEntity@ pEntity, CBaseEntity@ pOther, bool param, int& out newValue)

Pre call before checking relation.

if newValue changed, will use new relationship.

StopMode: CALL_ALL

MapScript | Plugin


3.6.3. MonsterSpawn

Hooks::Monster const uint32 MonsterSpawn (CBaseMonster@ pMonster)

Call after who having FL_MONSTER entity CBaseEntity::Spawn called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.6. MonsterTraceAttack

Hooks::Monster const uint32 MonsterTraceAttack (CBaseMonster@ pMonster, entvars_t@ pevAttacker, float flDamage, Vector vecDir, const TraceResult& in ptr, int bitDamageType)

Call before origin CBaseMonster::TraceAttack called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.7. BreakableKilled

Hooks::Entity const uint32 BreakableKilled (CBaseEntity@ pBreakable, entvars_t@ pevAttacker, int iGib)

Call before origin CBreakable::Die called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.8. BreakableTakeDamage

Hooks::Entity const uint32 BreakableTakeDamage (DamageInfo@ info)

Call before origin CBreakable::TakeDamage called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.9. BreakableTraceAttack

Hooks::Monster const uint32 MonsterTraceAttack (CBaseEntity@ pBreakable, entvars_t@ pevAttacker, float flDamage, Vector vecDir, const TraceResult& in ptr, int bitDamageType)

Call before origin CBreakable::TraceAttack called.

Notice that player died will call this hook, because player is monster too.

StopMode: CALL_ALL

MapScript | Plugin


3.6.10. PlayerPostTakeDamage

Hooks::Player const uint32 PlayerPostTakeDamage (DamageInfo@ info)

Call after origin CBasePlayer::TakeDamage called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.11. PlayerTakeHealth

Hooks::Player const uint32 PlayerTakeHealth (HealthInfo@ info)

Call after origin CBasePlayer::TakeHealth called.

StopMode: CALL_ALL

MapScript | Plugin


3.6.12. PlayerCallMedic

Hooks::Player const uint32 PlayerCallMedic (CBasePlayer@ pPlayer)

Call before "Medic!!!!"

StopMode: CALL_ALL

MapScript | Plugin


3.6.13. PlayerCallGrenade

Hooks::Player const uint32 PlayerCallGrenade (CBasePlayer@ pPlayer)

Call before "Take Cover!!!!"

StopMode: CALL_ALL

MapScript | Plugin


3.6.14. PlayerUserInfoChanged

Hooks::Player const uint32 PlayerUserInfoChanged (CBasePlayer@ pClient, string szInfoBuffer, uint&out uiFlag)

Call before player userinfo changed (e.g: name change)

will block original call if uiFlag not 0

StopMode: CALL_ALL

MapScript | Plugin


3.6.15. GrappleGetMonsterType

Hooks::Weapon const uint32 GrappleGetMonsterType (CBaseEntity@ pThis, CBaseEntity@ pEntity, uint& out flag)

Pre call before Weapon Grapple checking monster type

No more hardcoded grapple, yay!

out return value:

value result
1 pull monster to player
2 pull player to monster
other use default

StopMode: CALL_ALL

MapScript | Plugin


3.6.16. SendScoreInfo

Hooks::Player const uint32 SendScoreInfo (CBasePlayer@ pPlayer, edict_t@ pTarget, int iTeamID, string szTeamName, uint& out flag)

Pre call before sending hud info to edict

will block original call if out value not 0.

StopMode: CALL_ALL

MapScript | Plugin