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

[L4D2] Constant survivor speed


Post New Thread Reply   
 
Thread Tools Display Modes
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-28-2018 , 16:38   Re: [L4D2] Constant survivor speed
Reply With Quote #11

Below:
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
Add:
SetEntPropFloat(client, Prop_Data, "m_flMaxspeed", 250.0);

Try that. If it resets in 1.0 sec and 0.1 sec then you need a Pre/PostThink. It might only set once after hurt event, maybe 0.1 sec timer from the event with userid to then set the speed/movement value on them, and maybe needed if hp drops to 1 hp which is slowest walk?
__________________
Silvers is offline
alcybery
Member
Join Date: Apr 2016
Old 06-28-2018 , 17:09   Re: [L4D2] Constant survivor speed
Reply With Quote #12

Quote:
Originally Posted by Silvers View Post
Below:
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
Add:
SetEntPropFloat(client, Prop_Data, "m_flMaxspeed", 250.0);

Try that. If it resets in 1.0 sec and 0.1 sec then you need a Pre/PostThink. It might only set once after hurt event, maybe 0.1 sec timer from the event with userid to then set the speed/movement value on them, and maybe needed if hp drops to 1 hp which is slowest walk?
I added that line and tried changing the timer to 0.1 sec, still no luck. So then I need Pre/PostThink?
alcybery is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 06-29-2018 , 02:29   Re: [L4D2] Constant survivor speed
Reply With Quote #13

A snippet from New Ammo Packs:

Last edited by cravenge; 06-29-2018 at 02:33.
cravenge is offline
alcybery
Member
Join Date: Apr 2016
Old 06-29-2018 , 09:44   Re: [L4D2] Constant survivor speed
Reply With Quote #14

Quote:
Originally Posted by cravenge View Post
A snippet from New Ammo Packs:
Still not working
tEntDev also shows m_flMaxspeed changing to 150 and not changing back:
PHP Code:
baseclass->m_iHealth (256changed from 49 to 34
baseclass
->m_flMaxspeed (8216changed from 220.0000 to 150.0000 
alcybery is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-29-2018 , 10:00   Re: [L4D2] Constant survivor speed
Reply With Quote #15

PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    for( 
int i 1<= MaxClientsi++ )
        if( 
IsClientInGame(i) )
            
OnClientPutInServer(i);
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_PreThinkPostpostThink);
}

public 
Action postThink(int client)
{
    if( 
GetClientTeam(client) == && IsPlayerAlive(client) )
    {
        
int iHealth GetClientHealth(client);
        if (
iHealth 40)
        {
            
//SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.0);
            
SetEntPropFloat(clientProp_Send"m_flMaxspeed"250.0);
        }
    }

Tested as working, SDKHook_PreThink and SDKHook_PostThink didnt work, only SDKHook_PreThinkPost.
__________________
Silvers is offline
alcybery
Member
Join Date: Apr 2016
Old 06-29-2018 , 11:35   Re: [L4D2] Constant survivor speed
Reply With Quote #16

Quote:
Originally Posted by Silvers View Post
PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    for( 
int i 1<= MaxClientsi++ )
        if( 
IsClientInGame(i) )
            
OnClientPutInServer(i);
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_PreThinkPostpostThink);
}

public 
Action postThink(int client)
{
    if( 
GetClientTeam(client) == && IsPlayerAlive(client) )
    {
        
int iHealth GetClientHealth(client);
        if (
iHealth 40)
        {
            
//SetEntPropFloat(client, Prop_Send, "m_flLaggedMovementValue", 1.0);
            
SetEntPropFloat(clientProp_Send"m_flMaxspeed"250.0);
        }
    }

Tested as working, SDKHook_PreThink and SDKHook_PostThink didnt work, only SDKHook_PreThinkPost.
Thanks, it works, but it seems that character speed when below 40 hp is always 250. If I change it to 220 then it also seems to change adrenaline speed.
alcybery 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 06:00.


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