summaryrefslogtreecommitdiff
path: root/cheat/gmod/c_base_weapon.cpp
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/gmod/c_base_weapon.cpp
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
cleaned up
in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64
Diffstat (limited to 'cheat/gmod/c_base_weapon.cpp')
-rw-r--r--cheat/gmod/c_base_weapon.cpp87
1 files changed, 87 insertions, 0 deletions
diff --git a/cheat/gmod/c_base_weapon.cpp b/cheat/gmod/c_base_weapon.cpp
new file mode 100644
index 0000000..94c5ec6
--- /dev/null
+++ b/cheat/gmod/c_base_weapon.cpp
@@ -0,0 +1,87 @@
+#include "c_base_weapon.hpp"
+#include "context.hpp"
+#include "base_cheat.hpp"
+
+void* c_base_weapon::get_wpn_data( ) {
+ static auto func = pattern::first_code_match< void*( __thiscall* )( void* ) >( g_gmod.m_chl.dll( ), "0F B7 81 ? ? ? ? 50 E8 ? ? ? ? 83 C4 04 C3" );
+
+ if ( func )
+ return func( this );
+
+ return nullptr;
+}
+
+bool c_base_weapon::is_cw20( ) {
+ if( !g_ctx.m_lua )
+ return false;
+
+ const auto lua = g_ctx.m_lua;
+
+ this->ce( )->PushEntity( );
+ if( !lua->IsType( -1, LUA_TYPE::TYPE_ENTITY ) ) {
+ lua->Pop( 2 );
+ return false;
+ }
+
+ lua->GetField( -1, xors( "CW20Weapon" ) );
+ if( !lua->IsType( -1, LUA_TYPE::TYPE_BOOL ) ) {
+ lua->Pop( 2 );
+ return false;
+ }
+
+ bool is_cw20 = lua->GetBool( -1 );
+
+ lua->Pop( 2 );
+
+ return is_cw20;
+}
+
+bool c_base_weapon::is_fas2( ) {
+ if( !g_ctx.m_lua )
+ return false;
+
+ const auto lua = g_ctx.m_lua;
+
+ this->ce( )->PushEntity( );
+ if( !lua->IsType( -1, LUA_TYPE::TYPE_ENTITY ) ) {
+ lua->Pop( 2 );
+ return false;
+ }
+
+ lua->GetField( -1, xors( "IsFAS2Weapon" ) );
+ if( !lua->IsType( -1, LUA_TYPE::TYPE_BOOL ) ) {
+ lua->Pop( 2 );
+ return false;
+ }
+
+ bool is_fas2 = lua->GetBool( -1 );
+
+ lua->Pop( 2 );
+
+ return is_fas2;
+}
+
+float c_base_weapon::get_custom_cone( ) {
+ if( !g_ctx.m_lua )
+ return 0.f;
+
+ const auto lua = g_ctx.m_lua;
+
+ this->ce( )->PushEntity( ); // thank god for this function.
+ if( !lua->IsType( -1, LUA_TYPE::TYPE_ENTITY ) ) {
+ lua->Pop( 2 );
+ return false;
+ }
+
+ lua->GetField( -1, xors( "CurCone" ) );
+ if( !lua->IsType( -1, LUA_TYPE::TYPE_NUMBER ) ) {
+ lua->Pop( 2 );
+ return false;
+ }
+
+ float cone = lua->GetNumber( -1 );
+
+ lua->Pop( 2 );
+
+ return cone;
+} \ No newline at end of file