Comments (4)
not good autostrafe
from csgo_modest.
not good autostrafe
Yea, but it's simple, quick, and it works. This is supposed to be used as a base, correct? If people want a better strafer, they should add one themselves. Just thought it would be nice to have that in since bhop is already in there.
from csgo_modest.
void autostrafe()
{
if ( !config::get<bool>( ctx::cfg.movement_autostrafe ) )
return;
/// Is player underwater / onground? Autostrafe won't work in these conditions
if ( ctx::client.local->get_flags().has_flag( FL_ONGROUND ) )
return;
/// Allow movement if movement keys are pressed
if ( ctx::client.cmd->buttons.has_flag( IN_MOVERIGHT ) || ctx::client.cmd->buttons.has_flag( IN_MOVELEFT )
|| ctx::client.cmd->buttons.has_flag( IN_FORWARD ) || ctx::client.cmd->buttons.has_flag( IN_BACK ) )
return;
if ( ctx::client.local->get_velocity().length_2d() < 50.f )
{
/// This gets called if the player is standing still and holds the space bar
set_autostrafe_movement( calculate_best_rotation( 320.f ) );
}
else if ( ctx::client.cmd->mousedx > 1 || ctx::client.cmd->mousedx < -1 )
{
/// This gets called if the player is manually strafing with their mouse
ctx::client.cmd->sidemove = ctx::client.cmd->mousedx < 0.f ? -450.f : 450.f;
}
else
{
/// This gets called if the player is not strafing with their mouse, but already has some velocity
set_autostrafe_movement( calculate_best_rotation( ctx::client.local->get_velocity().length_2d() ) );
}
}
float calculate_best_rotation( float ideal_velocity )
{
float ideal_rotation = std::min( math::rad2deg( std::asinf( 30.f / ideal_velocity ) ) * 0.5f, 45.f );
float turn_direction_modifier = ctx::client.cmd->command_number % 2 ? 1.f : -1.f;
ctx::client.cmd->forwardmove = 0.f;
ctx::client.cmd->sidemove = 450.f;
float best_rotation = ( ideal_rotation - 90.f ) * turn_direction_modifier;
return best_rotation;
}
void set_autostrafe_movement( float current_rotation )
{
float sin_rotation = sin( math::deg2rad( current_rotation ) );
float cos_rotation = cos( math::deg2rad( current_rotation ) );
float new_forwardmove = ( sin_rotation * ctx::client.cmd->forwardmove ) + ( cos_rotation * ctx::client.cmd->sidemove );
float new_sidemove = ( cos_rotation * ctx::client.cmd->forwardmove ) + ( sin_rotation * ctx::client.cmd->sidemove );
ctx::client.cmd->forwardmove = new_forwardmove;
ctx::client.cmd->sidemove = new_sidemove;
}`
much better, enjoy pasta
from csgo_modest.
I don't feel like a base needs a lot ( if any ) features at all.
from csgo_modest.
Related Issues (13)
- Text drawing with centred X HOT 1
- Pretty sure CCSWeaponData is wrong HOT 6
- Interfaces HOT 1
- hooking certain things HOT 1
- won't inject
- injection
- econ_item_def_t struct outdated
- Update?
- Failed To Compile HOT 1
- freopen HOT 1
- Cool menu HOT 1
- Selecting Tabs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csgo_modest.