AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Disable ZOOM (https://forums.alliedmods.net/showthread.php?t=233967)

IAmReallyCool 01-23-2014 02:23

Disable ZOOM
 
How can I disable zooming for particular players on some event and then reset zoom (allow to use it for all clients)?

Leonidddd 01-24-2014 04:30

Re: Disable ZOOM
 
Try
But i prefer to use orpheu.

ConnorMcLeod 01-25-2014 06:35

Re: Disable ZOOM
 
PHP Code:

#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

#define PLUGIN "No Zoom"
#define VERSION "0.0.1"

#define cm(%0)    ( sizeof(%0) - 1 )

const XO_CBASEPLAYERITEM 4;
const 
m_pPlayer 41;

const 
XO_CBASEPLAYERWEAPON 4;
const 
m_flNextSecondaryAttack 47;

new 
g_iMaxPlayers;
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

new bool:g_bBlockZoom[33];

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    new 
iZoomWeaponsIndexes[] = {
        
CSW_AWPCSW_SCOUT,        // snipers
        
CSW_SG550CSW_G3SG1,    // riffles snipers
        
CSW_SG552CSW_AUG        // riffles
    
};

    new 
szClass[32];
    for(new 
ii<sizeof(iZoomWeaponsIndexes); i++)
    {
        
get_weaponname(iZoomWeaponsIndexes[i], szClasscharsmax(szClass));
        
RegisterHam(Ham_Item_DeployszClass"OnZoomWpns_Deploy_P"true);
        
RegisterHam(Ham_Weapon_SecondaryAttackszClass"OnZoomWpns_SecondaryAttack"false);
    }

    
g_iMaxPlayers get_maxplayers();
}

public 
client_putinserverid )
{
    
g_bBlockZoom[id] = false;
}

public 
OnZoomWpns_Deploy_Pweapon )
{
    new 
id get_pdata_cbase(weaponm_pPlayerXO_CBASEPLAYERITEM);

    if( 
IsPlayer(id) && g_bBlockZoom[id] )
    {
        
set_pdata_float(weaponm_flNextSecondaryAttack9999.0XO_CBASEPLAYERWEAPON);
    }
}

public 
OnZoomWpns_SecondaryAttackweapon 
{
    new 
id get_pdata_cbase(weaponm_pPlayerXO_CBASEPLAYERITEM);

    if( 
IsPlayer(id) && g_bBlockZoom[id] )
    {
        
ExecuteHam(Ham_CS_Weapon_SendWeaponAnimweapon00);
        
set_pdata_float(weaponm_flNextSecondaryAttack9999.0XO_CBASEPLAYERWEAPON);
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;




All times are GMT -4. The time now is 10:14.

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