View Single Post
Author Message
isinho
New Member
Join Date: Sep 2022
Location: Brazil
Old 09-22-2022 , 14:25   [REQ] TF2 (Fix Spy Improvement) [Solved]
Reply With Quote #1

It is my first post here. I am making a request since I have No knowledge on writing plugins and because the server owner using it, hes stubborn.
The plugin thread : Spy Improvement

theres this old simple plugin, it gives faster walk speed for spys while clocked
but as it is an old plugin theres some issues

List of issues : Spy walkspeed is set to (300) instead of (320) , Spy walkspeed is capped
Dead Ringer Speed boost, Discplinary Action Speed boost, Concheror Speed boost / (Any)
rtd Speed boost doesnt work, (vsh) GentleSpy and others Hales with spy, all speed is capped at 300
ANY Walk Speed Boost Doesnt Work!


able to walk at 320
walk speed boosts working Going out of dead ringer Etc
keep server owner being able to adjust the cloaked walkspeed

Spy Improvement

Actually found another plugin that does the same thing and it works
QuickCloak




PHP Code:
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <tf2>
#include <tf2_stocks>

#define PLUGIN_VERSION "1.3"
#define PLUGIN_PREFIX "\x04[Spy Improvements]\x01"

public Plugin:myinfo 
{
    
name "Spy Improvements",
    
author "Matheus28",
    
description "",
    
version PLUGIN_VERSION,
    
url ""
}

new 
speedOffset;

new 
Float:spySpeed;

new 
Handle:cv_admin;
new 
Handle:cv_cloakedSpeed;

public 
OnPluginStart(){
    
CreateConVar("sm_spyi_version"PLUGIN_VERSION"Spy Improvements Version",
    
FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
    
    
cv_admin CreateConVar("sm_spyi_admin""0",
    
"If 1, only admins with with access to sm_spyi will be able to use the improvements",
    
FCVAR_PLUGIN|FCVAR_NOTIFYtrue0.0true1.0);
    
    
cv_cloakedSpeed CreateConVar("sm_spyi_cloaked_speed""350.0",
    
"Spy speed when he is cloaked, 300 = Disabled",
    
FCVAR_PLUGIN|FCVAR_NOTIFYtrue220.0true400.0);
    
    
    
spySpeed TF2_GetClassBaseSpeed(TFClass_Spy);
    
speedOffset FindSendPropInfo("CTFPlayer""m_flMaxspeed");
}

public 
OnGameFrame(){
    new 
bool:adminOnly GetConVarBool(cv_admin);
    new 
Float:cloakedSpeed GetConVarFloat(cv_cloakedSpeed);
    
    for(new 
i=1;i<=MaxClients;++i){
        if(!
IsClientInGame(i)) continue;
        if(
TF2_GetPlayerClass(i)!=TFClass_Spy) continue;
        if(!
IsPlayerAlive(i)) continue;
        if(
adminOnly
        
&& !CheckCommandAccess(i"sm_spyi"ADMFLAG_RESERVATION)){
            continue;
        }
        
        new 
buttons=GetClientButtons(i);
        new 
flags=TF2_GetPlayerConditionFlags(i);
        
        if(
cloakedSpeed!=spySpeed){
            if(
flags TF_CONDFLAG_CLOAKED){
                if(
GetEntDataFloat(ispeedOffset)!=cloakedSpeed){
                    
SetEntDataFloat(ispeedOffsetcloakedSpeedtrue);
                }
            }else{
                if(
GetEntDataFloat(ispeedOffset)==cloakedSpeed){
                    
SetEntDataFloat(ispeedOffsetspySpeedtrue);
                }
                if(
buttons IN_RELOAD){
                    
SetEntDataFloat(ispeedOffsetspySpeedtrue);
                }else{
                    
SetSpyDisguiseSpeed(i);
                }
            }
        }
    }
}

stock SetSpyDisguiseSpeed(i){
    new 
TFClassType:class = TFClassType:GetEntProp(iProp_Send"m_nDisguiseClass");
    new 
Float:speed;
    if(!(
TF2_GetPlayerConditionFlags(i) & TF_CONDFLAG_DISGUISED)){
        
speed=spySpeed;
    }else{
        
speed=TF2_GetClassBaseSpeed(class);
        if(
speed>spySpeed){
            
speed=spySpeed;
        }
    }
    
SetEntDataFloat(ispeedOffsetspeedtrue);
}



stock Float:TF2_GetClassBaseSpeed(TFClassType:class){
    switch (class){
        case 
TFClass_Scout:     return 400.0;
        case 
TFClass_Soldier:   return 240.0;
        case 
TFClass_DemoMan:   return 280.0;
        case 
TFClass_Medic:     return 320.0;
        case 
TFClass_Heavy:     return 230.0;
    }
    return 
300.0;
}

stock IsValid(i){
    if(
i>MaxClients) return false;
    if(
i<=0) return false;
    return 
IsClientInGame(i);


Last edited by isinho; 11-09-2022 at 05:23. Reason: Solved
isinho is offline