Raised This Month: $ Target: $400
 0% 

Minimum player speed?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 09-01-2018 , 06:36   Minimum player speed?
Reply With Quote #1

Is there a way to set the minimum player speed on a server? I don't want players to go slower than 75 units/s. Is there a plugin for this?
sekac is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-02-2018 , 07:05   Re: Minimum player speed?
Reply With Quote #2

maybe with method: PreThink -> if player in ground -> if he's speed is < 75 then set his speed at 75

ps: how did you get 75 units? from what is it for?
JocAnis is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-02-2018 , 07:13   Re: Minimum player speed?
Reply With Quote #3

Put it as the last plugin in plugins.ini.
If some plugins are changing maxspeed poorly (like in PreThink) then it wont work.

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>

new CVar_MaxSpeedMin;

public plugin_init()
{
	register_plugin("MaxSpeed Minimum", "1.0", "Ghost");
	RegisterHam(Ham_Item_PreFrame, "player", "Ham_Item_PreFrame_Post", 1);
	CVar_MaxSpeedMin = register_cvar("amxx_maxspeed_min", "75.0");
}

public Ham_Item_PreFrame_Post(PlayerID)
{
	static Float:MaxSpeed, Float:MinMaxSpeed;
	MaxSpeed = entity_get_float(PlayerID, EV_FL_maxspeed);
	MinMaxSpeed = get_pcvar_float(CVar_MaxSpeedMin);
	
	if (MaxSpeed < MinMaxSpeed)
		entity_set_float(PlayerID, EV_FL_maxspeed, MinMaxSpeed);
}

Alternative, with prethink way, should work in any case:

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

new CVar_MaxSpeedMin;
new Float:MaxSpeedMin;

public plugin_init()
{
	register_plugin("MaxSpeed Minimum", "1.0", "Ghost");
	register_forward(FM_PlayerPreThink, "FM_PlayerPreThink_Post", 1);
	CVar_MaxSpeedMin = register_cvar("amxx_maxspeed_min", "75.0");
}

public plugin_cfg()
{
	MaxSpeedMin = get_pcvar_float(CVar_MaxSpeedMin);
}

public FM_PlayerPreThink_Post(PlayerID)
{
	static Float:MaxSpeed;
	MaxSpeed = entity_get_float(PlayerID, EV_FL_maxspeed);
	
	if (MaxSpeed < MaxSpeedMin)
		entity_set_float(PlayerID, EV_FL_maxspeed, MaxSpeedMin);
}
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 09-02-2018 at 07:16.
Ghosted is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-02-2018 , 08:57   Re: Minimum player speed?
Reply With Quote #4

Whats the point of this plugin can you please share the idea.

Ghost he said player speed and not maxspeed.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

new CVar_MaxSpeedMin;
new 
Float:MaxSpeedMin;

public 
plugin_init()
{
    
register_plugin("Player Minimum Speed""1.0""Ghost");
    
register_forward(FM_PlayerPreThink"FM_PlayerPreThink_Post"1);
    
CVar_MaxSpeedMin register_cvar("amx_speed_min""75.0");
}

public 
plugin_cfg()
{
    
MaxSpeedMin get_pcvar_float(CVar_MaxSpeedMin);
}

public 
FM_PlayerPreThink_Post(PlayerID)
{
    if(!
is_user_alive(PlayerID)) return;
        
    static 
Float:Vector[3];
    
entity_get_vector(PlayerIDEV_VEC_velocityVector);
    
    if (
vector_length(Vector) < MaxSpeedMin)
        {
                
entity_get_vector(PlayerIDEV_VEC_v_angleVector)
                
angle_vector(VectorANGLEVECTOR_FORWARDVector)
                
Vector[0] *= MaxSpeedMin;
                
Vector[1] *= MaxSpeedMin;
                
entity_set_vector(PlayerIDEV_VEC_velocityVector);
        }


1 problem with this if the player has jumped he will be stuck in midair unless he was moving with speed greater than the minimum, to solve this you need to check if he is not on the ground.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-02-2018 at 10:37.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
sekac
Senior Member
Join Date: Nov 2016
Old 09-02-2018 , 11:11   Re: Minimum player speed?
Reply With Quote #5

Because when you walk/crouch the game makes you move a certain % of your max speed. It doesn't care if it is an unscoped scout or double zoomed awp. So you can almost completely stop moving. I don't know how this problem is fixed in csgo but even with double zoomed awp you move at a reasonable speed.

EDIT: So I just tested it and it is not what I wanted. You always move at the min speed even if the player is not pressing any keys.
EDIT2: I also tried the Ghosted's version but you still lose a lot of speed when crouching.

Maybe the question here is can I reduce the crouch speed modifier? Maybe if the player is crouching make his maxspeed 1.5x?

Last edited by sekac; 09-02-2018 at 11:24.
sekac is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-02-2018 , 11:52   Re: Minimum player speed?
Reply With Quote #6

You didnt explain this in the 1st post.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Old 09-04-2018, 13:22
Ghosted
This message has been deleted by Ghosted. Reason: NVM got it...
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:42.


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