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

Solved [CSGO] Complete remove sniper zooming


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-25-2018 , 07:06   [CSGO] Complete remove sniper zooming
Reply With Quote #1

Is that possible? Not to suppress it or drop the weapon on zooming. Removing that completely.
__________________

Last edited by PinHeaDi; 01-26-2018 at 05:16.
PinHeaDi is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 01-25-2018 , 07:12   Re: [CSGO] Complete remove sniper zooming
Reply With Quote #2

Just remove the secondary attack when a sniper are used. Example here.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-26-2018 , 04:10   Re: [CSGO] Complete remove sniper zooming
Reply With Quote #3

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

bool NoZoomDisabledBhopSpecialRoundMapWithRounds;
int m_flNextSecondaryAttack;

public 
void OnPluginStart()
{
    
HookEvent("round_prestart"RoundStart);
    
HookEvent("round_end"RoundEnd);
    
m_flNextSecondaryAttack FindSendPropInfo("CBaseCombatWeapon""m_flNextSecondaryAttack");
}

public 
void OnMapStart()
{
    
char g_CurrentMap[128];
    
GetCurrentMap(g_CurrentMapsizeof(g_CurrentMap));
    if (
StrEqual(g_CurrentMap"mg_awp_multigames_csgo"true))
    {
        
MapWithRounds true;
    }
    else
    {
        
MapWithRounds false;
    }
}

public 
Action RoundStart(Event event, const char[] namebool dontBroadcast)
{
    if(!
MapWithRounds)
    {
        return 
Plugin_Handled;
    }
    
    static 
int roundcount;
    if(++
roundcount >= 5)
    {
        
int client GetClientOfUserId(GetEventInt(event"userid"));
        
        
CPrintToChatAll("[{lightred}Server{default}] <{green}SPECIAL ROUND{default}> now choosing.");
        
roundcount 0;
        
SpecialRound true;
        
        switch(
GetRandomInt(13))
        {
            case 
1:
            {
                
SDKHook(clientSDKHook_PreThinkOnPreThink);
                
CPrintToChatAll("[{lightred}Server{default}] <{green}SPECIAL ROUND{default}> zooming is {lighred}disabled {default}for this round.");
                
NoZoom true;
            }
            case 
2:
            {
                
Handle bhop FindConVar("abner_bhop_autobhop");
                
CPrintToChatAll("[{lightred}Server{default}] <{green}SPECIAL ROUND{default}> auto bunny-hop is {lighred}disabled {default}for this round.");
                
DisabledBhop true;
                
SetConVarInt(bhop0truefalse);
                
delete bhop;
            }
            case 
3:
            {
                
SDKHook(clientSDKHook_PreThinkOnPreThink);
                
Handle bhop FindConVar("abner_bhop_autobhop");
                
CPrintToChatAll("[{lightred}Server{default}] <{green}SPECIAL ROUND{default}> auto bunny-hop and zooming are both {lighred}disabled {default}for this round.");
                
NoZoom true;
                
DisabledBhop true;
                
SetConVarInt(bhop0truefalse);
                
delete bhop;
            }
        }    
    }
    return 
Plugin_Continue;
}

public 
void RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    if (
SpecialRound)
    {
        if(
DisabledBhop)
        {
            
Handle bhopcvar FindConVar("abner_bhop_autobhop");
            
SetConVarInt(bhopcvar1truefalse); 
            
DisabledBhop false;
            
delete bhopcvar;
        }

        for (
int i 1<= MaxClientsi++) if (IsClientInGame(i))
        {
            if(
NoZoom)
            {
                
SDKUnhook(iSDKHook_PreThinkOnPreThink);
                
NoZoom false;
            }
        }
        
SpecialRound false;
        
CPrintToChatAll("[{lightred}Server{default}] The special round is now over. The next one will be in {green}5 {default}rounds.");
    }
}

void MakeNoScope(int weapon)
{
    if (
NoZoom)
    {
        return;
    }

    if (!
IsValidEdict(weapon))
    {
        return;
    }

    
char classname[MAX_NAME_LENGTH];
    if (
GetEdictClassname(weaponclassnamesizeof(classname)))
    {
        
SetEntDataFloat(weaponm_flNextSecondaryAttackGetGameTime() + 1.0);
    }
}

public 
Action OnPreThink(int client)
{
    
int iWeapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon");

    
MakeNoScope(iWeapon);

    return 
Plugin_Continue;

I tried this way, but I get:
PHP Code:
L 01/26/2018 10:55:30Info (map "mg_awp_multigames_csgo") (file "errors_20180126.log")
L 01/26/2018 10:55:30: [SMException reportedHook type not valid for this type of entity (0/worldspawn)
L 01/26/2018 10:55:30: [SMBlamingminigamesplugins/a_specialround.smx
L 01
/26/2018 10:55:30: [SMCall stack trace:
L 01/26/2018 10:55:30: [SM]   [0SDKHook
L 01
/26/2018 10:55:30: [SM]   [1Line 50D:\Sourcemod Plugins\a_specialround.sp::RoundStart
L 01
/26/2018 10:58:39: [SMException reportedHook type not valid for this type of entity (0/worldspawn)
L 01/26/2018 10:58:39: [SMBlamingminigamesplugins/a_specialround.smx
L 01
/26/2018 10:58:39: [SMCall stack trace:
L 01/26/2018 10:58:39: [SM]   [0SDKHook
L 01
/26/2018 10:58:39: [SM]   [1Line 64D:\Sourcemod Plugins\a_specialround.sp::RoundStart 
__________________
PinHeaDi is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 01-26-2018 , 04:33   Re: [CSGO] Complete remove sniper zooming
Reply With Quote #4

You're trying to call SDKHook on client 0, which is worldspawn. Just do a check to ensure that the index is a valid client before calling SDKHook
hmmmmm is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 01-26-2018 , 05:16   Re: [CSGO] Complete remove sniper zooming
Reply With Quote #5

Yep, that was the problem, all works fine now. Thank you.
__________________
PinHeaDi 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 16:03.


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