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

l4d2 survivor speed plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
santu1santu1
Junior Member
Join Date: Jan 2018
Old 01-16-2018 , 11:10   l4d2 survivor speed plugin
Reply With Quote #1

Hello, can someone please make a plugin that changes the survivor speed to the desired number?
santu1santu1 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-17-2018 , 03:58   Re: l4d2 survivor speed plugin
Reply With Quote #2

Untested:

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0"

ConVar cvEnablePlugin;

public 
Plugin myinfo =
{
    
name "[L4D & L4D2] Set Player Speed",
    
author "Psykotik (Crasher_3637)",
    
description "Allows admins to set player's speed.",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=304476"
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_setspeed"cmdSetSpeedADMFLAG_KICK"Set a player's speed.");
    
RegAdminCmd("sm_speedplayer"cmdSetSpeedADMFLAG_KICK"Set a player's speed.")
    
cvEnablePlugin CreateConVar("sps_enableplugin""1""Enable the plugin?\n(0: OFF)\n(1: ON)"FCVAR_NOTIFY);
    
CreateConVar("sps_pluginversion"PLUGIN_VERSION"Plugin version"FCVAR_NOTIFY);
    
cvEnablePlugin.AddChangeHook(vCvarChanged_cvEnablePlugin);
}

public 
void vCvarChanged_cvEnablePlugin(ConVar convar, const char[] oldValue, const char[] newValue)
{
    if (!
cvEnablePlugin.BoolValue)
    {
        for (
int iPlayeriPlayer <= MaxClientsiPlayer++)
        {
            if (
bIsValidClient(iPlayer))
            {
                
SetEntPropFloat(iPlayerProp_Data"m_flLaggedMovementValue"1.0);
            }
        }
    }
}

public 
Action cmdSetSpeed(int clientint args)
{
    if (!
cvEnablePlugin.BoolValue)
    {
        
ReplyToCommand(client"\x04[SPS]\x01 The\x05 Set Player Speed\x01 plugin is off.");
        return 
Plugin_Handled;
    }

    if (
args != 2)
    {
        
ReplyToCommand(client"\x04[SPS]\x01 Usage: sm_setspeed <player> <value>");
        return 
Plugin_Handled;
    }

    
char target[32];
    
char target_name[MAX_NAME_LENGTH];
    
int target_list[MAXPLAYERS];
    
int target_count;
    
bool tn_is_ml;
    
GetCmdArg(1targetsizeof(target));
    
char arg2[32];
    
float value;
    
GetCmdArg(2arg2sizeof(arg2));
    
value StringToFloat(arg2);
    if ((
target_count ProcessTargetString(targetclienttarget_listMAXPLAYERSCOMMAND_FILTER_ALIVEtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }

    for (
int iPlayer 0iPlayer target_countiPlayer++)
    {
        if (
bIsValidClient(iPlayer))
        {
            
vChangePlayerSpeed(target_list[iPlayer], value);
        }
    }

    return 
Plugin_Handled;
}

void vChangePlayerSpeed(int targetfloat value)
{
    if (
bIsValidClient(target))
    {
        
SetEntPropFloat(targetProp_Data"m_flLaggedMovementValue"value);
    }
}

bool bIsValidClient(int client)
{
    return (
client && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && !IsClientInKickQueue(client) && IsPlayerAlive(client) && IsValidEntity(client));

Attached Files
File Type: sp Get Plugin or Get Source (set_player_speed.sp - 301 views - 2.6 KB)
__________________

Last edited by Psyk0tik; 01-17-2018 at 04:03.
Psyk0tik is offline
santu1santu1
Junior Member
Join Date: Jan 2018
Old 01-28-2018 , 05:10   Re: l4d2 survivor speed plugin
Reply With Quote #3

it says that the plugin failed to compile
santu1santu1 is offline
santu1santu1
Junior Member
Join Date: Jan 2018
Old 01-28-2018 , 05:34   Re: l4d2 survivor speed plugin
Reply With Quote #4

can you make another one please
santu1santu1 is offline
kot4404
Senior Member
Join Date: Mar 2013
Old 01-29-2018 , 10:29   Re: l4d2 survivor speed plugin
Reply With Quote #5

https://forums.alliedmods.net/showthread.php?p=1251446
kot4404 is offline
ricksfishin
Senior Member
Join Date: Oct 2017
Old 01-29-2018 , 16:12   Re: l4d2 survivor speed plugin
Reply With Quote #6

Try this compiled
Attached Files
File Type: smx set_player_speed.smx (5.4 KB, 328 views)
File Type: sp Get Plugin or Get Source (set_player_speed.sp - 547 views - 2.6 KB)
ricksfishin is offline
santu1santu1
Junior Member
Join Date: Jan 2018
Old 01-30-2018 , 12:03   Re: l4d2 survivor speed plugin
Reply With Quote #7

thanks but it stills does not works
santu1santu1 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 07-14-2018 , 21:08   Re: l4d2 survivor speed plugin
Reply With Quote #8

Got it working.

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_VERSION "1.0"

bool g_bSpedUp[MAXPLAYERS 1];
ConVar g_cvEnablePlugin;

public 
Plugin myinfo =
{
    
name "[L4D & L4D2] Set Player Speed",
    
author "Psykotik (Crasher_3637)",
    
description "Allows admins to set player's speed.",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=304476"
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_setspeed"cmdSetSpeedADMFLAG_KICK"Set a player's speed.");
    
RegAdminCmd("sm_speedplayer"cmdSetSpeedADMFLAG_KICK"Set a player's speed.");
    
g_cvEnablePlugin CreateConVar("sps_enableplugin""1""Enable the plugin?\n(0: OFF)\n(1: ON)");
    
CreateConVar("sps_pluginversion"PLUGIN_VERSION"Plugin version"FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
g_cvEnablePlugin.AddChangeHook(vEnablePlugin);
    
AutoExecConfig(true"set_player_speed");
}

public 
void vEnablePlugin(ConVar convar, const char[] oldValue, const char[] newValue)
{
    if (!
g_cvEnablePlugin.BoolValue)
    {
        for (
int iPlayeriPlayer <= MaxClientsiPlayer++)
        {
            if (
bIsValidClient(iPlayer))
            {
                
SetEntPropFloat(iPlayerProp_Send"m_flLaggedMovementValue"1.0);
            }
        }
    }
}

public 
Action cmdSetSpeed(int clientint args)
{
    if (!
g_cvEnablePlugin.BoolValue)
    {
        
ReplyToCommand(client"\x04[SPS]\x01 The\x05 Set Player Speed\x01 plugin is off.");
        return 
Plugin_Handled;
    }
    if (!
bIsValidClient(client))
    {
        
ReplyToCommand(client"\x04[SPS]\x01 You must be in-game to use this command.");
        return 
Plugin_Handled;
    }
    
char target[32];
    
char target_name[MAX_NAME_LENGTH];
    
int target_list[MAXPLAYERS];
    
int target_count;
    
bool tn_is_ml;
    
GetCmdArg(1targetsizeof(target));
    
char arg2[32];
    
GetCmdArg(2arg2sizeof(arg2));
    
float value StringToFloat(arg2);
    
char arg3[32];
    
GetCmdArg(3arg3sizeof(arg3));
    
int toggle StringToInt(arg3);
    if (
args != 3)
    {
        
ReplyToCommand(client"\x04[SPS]\x01 Usage: sm_setspeed <#userid|name> <value> <0|1> or sm_speedplayer <#userid|name> <value> <0|1>");
        return 
Plugin_Handled;
    }
    if ((
target_count ProcessTargetString(targetclienttarget_listMAXPLAYERSCOMMAND_FILTER_ALIVEtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }
    for (
int iPlayer 0iPlayer target_countiPlayer++)
    {
        
vChangePlayerSpeed(target_list[iPlayer], valuetoggle);
    }
    return 
Plugin_Handled;
}

void vChangePlayerSpeed(int clientfloat valueint toggle)
{
    switch (
toggle)
    {
        case 
0:
        {
            
g_bSpedUp[client] = false;
            
SetEntPropFloat(clientProp_Send"m_flLaggedMovementValue"1.0);
        }
        case 
1:
        {
            if (
bIsValidClient(client) && !g_bSpedUp[client])
            {
                
g_bSpedUp[client] = true;
                
DataPack dpDataPack;
                
CreateDataTimer(1.0tTimerChangePlayerSpeeddpDataPackTIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
                
dpDataPack.WriteCell(GetClientUserId(client));
                
dpDataPack.WriteFloat(value);
            }
        }
    }
}

public 
Action tTimerChangePlayerSpeed(Handle timerDataPack pack)
{
    
pack.Reset();
    
int client GetClientOfUserId(pack.ReadCell());
    
float value pack.ReadFloat();
    if (!
g_cvEnablePlugin.BoolValue || !bIsValidClient(client) || !g_bSpedUp[client])
    {
        return 
Plugin_Stop;
    }
    
SetEntPropFloat(clientProp_Send"m_flLaggedMovementValue"value);
    return 
Plugin_Continue;
}

bool bIsValidClient(int client)
{
    return 
client && client <= MaxClients && IsClientInGame(client) && !IsClientInKickQueue(client) && IsPlayerAlive(client);

Attached Files
File Type: sp Get Plugin or Get Source (set_player_speed.sp - 583 views - 3.6 KB)
__________________
Psyk0tik is offline
Sanctus
New Member
Join Date: Sep 2018
Old 09-01-2018 , 05:31   Re: l4d2 survivor speed plugin
Reply With Quote #9

So, I installed this plugin and it seems to be working, but whenever I enter a command which changes player's speed nothing happens. I don't know why this happens, maybe the command I enter is wrong. I'd like to know what exactly do I need to type, if, for example, I want to make a player with a nickname XYZ run at 200 HU/s
Sanctus is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-01-2018 , 05:54   Re: l4d2 survivor speed plugin
Reply With Quote #10

Quote:
Originally Posted by Sanctus View Post
So, I installed this plugin and it seems to be working, but whenever I enter a command which changes player's speed nothing happens. I don't know why this happens, maybe the command I enter is wrong. I'd like to know what exactly do I need to type, if, for example, I want to make a player with a nickname XYZ run at 200 HU/s
sm_speedplayer XYZ 200.0 1 // Toggle XYZ's speed to 200.0
sm_speedplayer XYZ 1.0 0 // Toggle XYZ's speed back to normal
__________________
Psyk0tik is offline
Reply


Thread Tools
Display Modes

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 11:01.


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