Raised This Month: $51 Target: $400
 12% 

movement speed while scoped?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrMith
New Member
Join Date: Nov 2016
Old 02-20-2018 , 06:02   movement speed while scoped?
Reply With Quote #1

Working on a plugin so when you're scoped with a AWP in CS:GO you move at 200 units/s instead of 100 units/s.
m_flLaggedMovementValue feels like a client host_timescale and causes jumping to go at 2x speed.
I've tried m_flMaxspeed and nothing seemed to work but maybe i shouldn't try to code at 4 am
Code:
public void OnPluginStart()
{
	HookEvent("weapon_zoom", Event_PlayerZoom, EventHookMode_Pre);
}

public Action Event_PlayerZoom(Event event, const char[] name, bool dontBroadcast)
{
	int userID = event.GetInt("userid");
	PrintToChatAll("%i",userID);
	int clientID = GetClientOfUserId(2);
	PrintToChatAll("%i", clientID);
	SetEntPropFloat(clientID, Prop_Send, "m_flLaggedMovementValue", 2.0);
	return Plugin_Continue;
}
MrMith is offline
Wyon
Junior Member
Join Date: Mar 2018
Old 03-02-2018 , 02:10   Re: movement speed while scoped?
Reply With Quote #2

If you need to do that for all players you can simply change it in weapon configs (\csgo\scripts\items\items_game.txt)
"weapon_awp_prefab" > "attributes" > "max player speed alt"
Wyon is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 03-03-2018 , 03:20   Re: movement speed while scoped?
Reply With Quote #3

Try:
PHP Code:
public void OnPluginStart()
{
    
HookEvent("weapon_zoom"Event_PlayerZoomEventHookMode_Pre);
}

public 
Action Event_PlayerZoom(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
SetEntPropFloat(clientProp_Send"m_flLaggedMovementValue"2.0);
    return 
Plugin_Continue;

__________________
ambn is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 03-03-2018 , 09:46   Re: movement speed while scoped?
Reply With Quote #4

untested, but try this: https://forums.alliedmods.net/showth...11#post2568211
__________________
retired
shavit is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-05-2018 , 07:57   Re: movement speed while scoped?
Reply With Quote #5

Untested, try this:

Code:

#include <sourcemod>
#include <sdkhooks>

new Float:Speed;

public Plugin:myinfo =
{
	name = "[CSGO] Zoom Speed",
	author = "Eyal282 ( FuckTheSchool )",
	description = "Allows you to decide the speed of a player when he zooms",
	version = SOURCEMOD_VERSION,
	url = "http://www.sourcemod.net/"
};

public OnPluginStart()
{
	HookEvent("weapon_zoom", Event_PlayerZoom, EventHookMode_Post);
	
	new Handle:hConVar = CreateConVar("scoped_speed", "200.0", "Determines the speed of a scoped player");
	
	Speed = GetConVarFloat(hConVar);
	HookConVarChange(hConVar, OnConVarChange);
}

public OnConVarChange(Handle:hConVar, const String:oldValue[], const String:newValue[])
{
	Speed = StringToFloat(newValue);
}

public Event_PlayerZoom(Handle:hEvent, String:Name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
	
	SDKHook(client, SDKHook_PreThinkPost, OnPreThinkPost);
}

public OnPreThinkPost(client)
{
	if(!IsPlayerAlive(client) || !IsPlayerZoomed(client))
		SDKUnhook(client, SDKHook_PreThinkPost, OnPreThinkPost);
		
	SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", Speed);
}

stock bool:IsPlayerZoomed(client)
	return bool:GetEntProp(client, Prop_Send, "m_bIsScoped");
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
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 22:09.


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