Raised This Month: $32 Target: $400
 8% 

[CSGO?] Noclipspeed command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cytrus224
AlliedModders Donor
Join Date: Apr 2017
Location: Poland
Old 10-14-2018 , 05:22   [CSGO?] Noclipspeed command
Reply With Quote #1

Need a plugin, that will add a command, f.e. !noclipspeed x, which would allow player to change sv_noclipspeed for him. Thanks.
cytrus224 is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 10-14-2018 , 06:41   Re: [CSGO?] Noclipspeed command
Reply With Quote #2

PHP Code:
#pragma newdecls required
#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>

public Plugin myinfo 
{
    
name "Noclip Speed",
    
author "SlidyBat",
    
description "Allows players to set their noclip speed",
    
version "1.0",
    
url ""
};

ConVar sv_noclipspeed;
int g_iDefaultNoclipSpeed;
int g_iNoclipSpeed[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
RegConsoleCmd"sm_noclipspeed"Command_NoclipSpeed"Sets player's sv_noclipspeed value" );

    
sv_noclipspeed FindConVar"sv_noclipspeed" );
    
sv_noclipspeed.Flags &= ~FCVAR_NOTIFY;
    
    
g_iDefaultNoclipSpeed sv_noclipspeed.IntValue;
    for( 
int i 1<= MaxClientsi++ )
    {
        
g_iNoclipSpeed[i] = g_iDefaultNoclipSpeed;
    }
}

public 
void OnPluginEnd()
{
    
// restore default value before plugin was loaded
    
sv_noclipspeed.IntValue g_iDefaultNoclipSpeed;
}

public 
void OnClientPutInServerint client )
{
    
g_iNoclipSpeed[client] = g_iDefaultNoclipSpeed;
    
SDKHookclientSDKHook_PreThinkPostHook_PreThinkPost );
}

public 
void Hook_PreThinkPostint client )
{
    
sv_noclipspeed.IntValue g_iNoclipSpeed[client];
}

public 
Action Command_NoclipSpeedint clientint args )
{
    if( 
args != )
    {
        
ReplyToCommandclient"[SM] Usage: sm_noclipspeed <speed>" );
        return 
Plugin_Handled;
    }
    
    
char arg[16];
    
GetCmdArgStringargsizeof(arg) );
    
    
sv_noclipspeed.ReplicateToClientclientarg );
    
    
int speed StringToIntarg );
    
g_iNoclipSpeed[client] = speed;
    
    
ReplyToCommandclient"[SM] sv_noclipspeed set to %i"speed );
    return 
Plugin_Handled;


Last edited by hmmmmm; 05-19-2019 at 06:07. Reason: Actually compiles now
hmmmmm 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:11.


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