Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie
Zombie Mod

Noktowizor dla humanów i zombie

zombie mod

  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
1 odpowiedź w tym temacie

#1 M@CkO

    Nowy

  • Nowy

Reputacja: -1
Nowy

  • Postów:4
  • Lokalizacja:Kamieńsk
Offline

Napisano 22.08.2013 21:24

Witam.

Może ktoś przerobić plugin bez modułu cvar_util i żeby był pod silnik ZP

/*================================================================================
    
    ------------------------
    -*- [ZP] Nightvision -*-
    ------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include < amxmodx >
#include < cvar_util >
#include < fakemeta >
#include < hamsandwich >
#include < zombieplague >

enum _:eColor
{
    red = 0,
    green,
    blue
};

new g_vecNightVisionColor[ 33 ][ eColor ];
new g_bsHasNightVision;
new g_bsToggleNVG;
new g_iMaxClients;
new gmsgScreenFade;
new g_szLightStyle[ 32 ];
new g_iZombieNVG[ eColor ];
new g_iHumanNVG[ eColor ];
new g_iNVGAlpha;

const UNIT_SECOND            = ( 1 << 12 );
const FFADE_STAYOUT            = 0x0004;

#define FBitSet(%0,%1)        ( %0 & ( 1 << ( %1 - 1 ) ) )
#define SetBits(%0,%1)        ( %0 |= ( 1 << ( %1 - 1 ) ) )
#define ClearBits(%0,%1)        ( %0 &= ~( 1 << ( %1 - 1 ) ) )
#define IsValidPrivateData(%0)    ( pev_valid( %0 ) == 2 )
#define IsAlive(%0)            is_user_alive( %0 )
#define IsZombie(%0)            zp_get_user_zombie( %0 )

public plugin_natives( )
{
    register_native( "zp_get_user_nightvision", "_zp_get_user_nightvision_", 1 );
    register_native( "zp_set_user_nightvision", "_zp_set_user_nightvision_", 1 );
    register_native( "zp_reset_user_nightvision", "_zp_reset_user_nightvision_", 1 );
}

public plugin_init( )
{
    register_plugin( "[ZP] NightVision System", ZP_VERSION_STRING, "NiHiLaNTh" );
    
    register_clcmd( "nightvision", "fw_CommandNightVision" );
    
    RegisterHam( Ham_Killed, "player", "fw_PlayerKilled" );
    
    gmsgScreenFade = get_user_msgid( "ScreenFade" );
    
    CvarCache( get_cvar_pointer( "zp_light_style" ), CvarType_String, g_szLightStyle, charsmax( g_szLightStyle ) );
    CvarCache( register_cvar( "zp_nvg_zombie_r", "253" ), CvarType_Int, g_iZombieNVG[ red ] );
    CvarCache( register_cvar( "zp_nvg_zombie_g", "110" ), CvarType_Int, g_iZombieNVG[ green ] );
    CvarCache( register_cvar( "zp_nvg_zombie_b", "110" ), CvarType_Int, g_iZombieNVG[ blue ] );
    CvarCache( register_cvar( "zp_nvg_human_r", "0" ), CvarType_Int, g_iHumanNVG[ red ] );
    CvarCache( register_cvar( "zp_nvg_human_g", "255" ), CvarType_Int, g_iHumanNVG[ green ] );
    CvarCache( register_cvar( "zp_nvg_human_b", "0" ), CvarType_Int, g_iHumanNVG[ blue ] );
    CvarCache( register_cvar( "zp_nvg_alpha", "110" ), CvarType_Int, g_iNVGAlpha );

    g_iMaxClients = get_maxplayers( );
}

public client_putinserver( pPlayer )
{
    ClearBits( g_bsHasNightVision, pPlayer );
    ClearBits( g_bsToggleNVG, pPlayer );
}

public zp_user_infected( pPlayer )
{
    if( FBitSet( g_bsHasNightVision, pPlayer ) )
    {
        ClearBits( g_bsHasNightVision, pPlayer );
        
        if( FBitSet( g_bsToggleNVG, pPlayer ) )
        {
            ClearBits( g_bsToggleNVG, pPlayer );
            MSG_ScreenFade( pPlayer );
            SVC_ModifyLightStyle( pPlayer, g_szLightStyle );
        }
    }
    
    //update nightvision color
    for( new pColor = red; pColor <= blue; pColor++ )
        g_vecNightVisionColor[ pPlayer ][ pColor ] = g_iZombieNVG[ pColor ];
}

public zp_user_humanized( pPlayer )
{
    if( FBitSet( g_bsHasNightVision, pPlayer ) )
    {
        ClearBits( g_bsHasNightVision, pPlayer );
        
        if( FBitSet( g_bsToggleNVG, pPlayer ) )
        {
            ClearBits( g_bsToggleNVG, pPlayer );
            MSG_ScreenFade( pPlayer );
            SVC_ModifyLightStyle( pPlayer, g_szLightStyle );
        }
    }
    
    //update nightvision color
    for( new pColor = red; pColor <= blue; pColor++ )
        g_vecNightVisionColor[ pPlayer ][ pColor ] = g_iHumanNVG[ pColor ];
}

public fw_CommandNightVision( pPlayer )
{
    if( !IsAlive( pPlayer ) || !FBitSet( g_bsHasNightVision, pPlayer ) )
        return PLUGIN_CONTINUE;
        
    if( IsValidPrivateData( pPlayer ) )
    {
        const m_flFlashedUntil = 514;
        
        if( get_pdata_float( pPlayer, m_flFlashedUntil, 5 ) - get_gametime( ) > 0.0 )
            return PLUGIN_CONTINUE;
    }    
    
    if( !FBitSet( g_bsToggleNVG, pPlayer ) )
    {
        SetBits( g_bsToggleNVG, pPlayer );
            
        MSG_ScreenFade
        (
            .pPlayer = pPlayer,
            .sDuration = UNIT_SECOND,
            .sHoldTime = 0,
            .sFlags = FFADE_STAYOUT,
            .r = g_vecNightVisionColor[ pPlayer ][ red ],
            .g = g_vecNightVisionColor[ pPlayer ][ green ],
            .b = g_vecNightVisionColor[ pPlayer ][ blue ],
            .a = g_iNVGAlpha
        );
        
        SVC_ModifyLightStyle( pPlayer, "#" );
        emit_sound( pPlayer, CHAN_ITEM, "items/nvg_on.wav", 0.94, ATTN_NORM, 0, 98 );
    }
    else
    {
        ClearBits( g_bsToggleNVG, pPlayer );
        MSG_ScreenFade( pPlayer );
        SVC_ModifyLightStyle( pPlayer, g_szLightStyle );
        emit_sound( pPlayer, CHAN_ITEM, "items/nvg_off.wav", 0.94, ATTN_NORM, 0, 98 );
    }    
        
    return PLUGIN_HANDLED;        
}

public fw_PlayerKilled( pevVictim )
{
    if( FBitSet( g_bsHasNightVision, pevVictim ) )
    {
        ClearBits( g_bsHasNightVision, pevVictim );
        
        if( FBitSet( g_bsToggleNVG, pevVictim ) )
        {
            ClearBits( g_bsToggleNVG, pevVictim );
            MSG_ScreenFade( pevVictim );
            SVC_ModifyLightStyle( pevVictim, g_szLightStyle );
        }
    }
}

MSG_ScreenFade( pPlayer, sDuration = 0, sHoldTime = 0, sFlags = 0, r = 0, g = 0, b = 0, a = 0 )
{
    message_begin( MSG_ONE_UNRELIABLE, gmsgScreenFade, _, pPlayer );
    write_short( sDuration );
    write_short( sHoldTime );
    write_short( sFlags );
    write_byte( r );
    write_byte( g );
    write_byte( b );
    write_byte( a );
    message_end( );
}

SVC_ModifyLightStyle( pPlayer, const pszLightStyle[ ] )
{
    message_begin( MSG_ONE, SVC_LIGHTSTYLE, .player = pPlayer );
    write_byte( 0 );
    write_string( pszLightStyle );
    message_end( );
}

public _zp_get_user_nightvision_( pPlayer )
{
    if( !( 1 <= pPlayer <= g_iMaxClients ) )
        return -1;
        
    return     FBitSet( g_bsHasNightVision, pPlayer );
}

public _zp_set_user_nightvision_( pPlayer, bool:fGive, bool:fNotice, bool:fToggle, bool:fCustomColor, iColor[ eColor ] )
{
    if( !( 1 <= pPlayer <= g_iMaxClients ) )
        return 0;
    
    if( fGive )
    {
        SetBits( g_bsHasNightVision, pPlayer );
    }
    
    if( fNotice )
    {
        zp_print_director_message
        ( 
            .pPlayer = pPlayer, 
            .message = "Press the NIGHTVISION key to turn on/off nightvision goggles." 
        );
    }
        
    if( fToggle )
    {
        if( fCustomColor )
        {
            for( new pColor = red; pColor <= blue; pColor++ )
                g_vecNightVisionColor[ pPlayer ][ pColor ] = iColor[ pColor ];
        }
        
        fw_CommandNightVision( pPlayer );
    }
    
    return 1;
}

public _zp_reset_user_nightvision_( pPlayer )
{
    if( !pPlayer )
    {
        for( new pClient = 1; pClient <= g_iMaxClients; ++pClient )
        {
            if( !IsAlive( pClient ) || ~g_bsHasNightVision & ( 1 << pClient ) )
                continue;
                    
            if( FBitSet( g_bsHasNightVision, pClient ) )
            {
                ClearBits( g_bsHasNightVision, pClient );
                    
                if( FBitSet( g_bsToggleNVG, pClient ) )
                {
                    ClearBits( g_bsToggleNVG, pClient );
                    MSG_ScreenFade( pClient );
                    SVC_ModifyLightStyle( pClient, g_szLightStyle );
                }
            }    
        }
    }
    else
    {
        if( FBitSet( g_bsHasNightVision, pPlayer ) )
        {
            ClearBits( g_bsHasNightVision, pPlayer );
                
            if( FBitSet( g_bsToggleNVG, pPlayer ) )
            {
                ClearBits( g_bsToggleNVG, pPlayer );
                MSG_ScreenFade( pPlayer );
                SVC_ModifyLightStyle( pPlayer, g_szLightStyle );
            
            }
        }
    }
}

  • +
  • -
  • 0

#2 M@CkO

    Nowy

  • Autor tematu
  • Nowy

Reputacja: -1
Nowy

  • Postów:4
  • Lokalizacja:Kamieńsk
Offline

Napisano 23.08.2013 19:41

up


  • +
  • -
  • 0





Również z jednym lub większą ilością słów kluczowych: zombie mod

Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych