Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSA human in possession of this item to have glow and aura


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Hello, would someone show me example codes of how to add glow and aura to the model of a player who is in possession of a extra item in a ZM mod?

For example, i want all humans who possess the following extra item:

Code:

#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombie_plague_advance>
       
#define _MarkPlayerHasMask(%0)  _bitPlayerHasMask |= (1 << (%0 & 31))
#define _ClearPlayerWithMask(%0)  _bitPlayerHasMask &= ~(1 << (%0 & 31))
#define _PlayerHasMask(%0)      _bitPlayerHasMask & (1 << (%0 & 31))
       
#define _PLUGIN  "[ZP43] Extra item: Gas Mask"
#define _VERSION            "3.0"
#define _AUTHOR          "H.RED.ZONE"

#define EV_INT_nadetype    EV_INT_flTimeStepSound
#define NADETYPE_INFECTION  1111

new _ItemID

new _bitPlayerHasMask

new _gMaxPlayers, _gIcon, _gMsgSayText

public plugin_init() {
        register_plugin( _PLUGIN, _VERSION, _AUTHOR )
       
        RegisterHam( Ham_Spawn, "player", "_FW_PlayerSpawn", 1 )
        RegisterHam( Ham_Killed, "player", "_FW_PlayerKilled" )
               
        _ItemID = zp_register_extra_item( "Anti-Virus Mask \y(\rSingle-Use\y)", 200, ZP_TEAM_HUMAN )
       
        _gMaxPlayers = get_maxplayers( )
        _gIcon = get_user_msgid( "StatusIcon" )
        _gMsgSayText = get_user_msgid( "SayText" )
}

public plugin_precache() {
        RegisterHam( Ham_Think, "grenade", "_FW_ThinkGrenade", 1 )
}

public zp_extra_item_selected( plr, itemid ) {
       
        if( itemid == _ItemID ) {
                _MarkPlayerHasMask( plr )
                Icon_On( plr )
                ProtoChat(plr, "You now have Anti-Virus Mask. It will neutralize the effect of 1 infection grenade!")
        }
}

public _FW_ThinkGrenade( iEnt ) {
       
        if( is_valid_ent(iEnt) ) {
               
                if( entity_get_int(iEnt, EV_INT_nadetype) == NADETYPE_INFECTION ) {
                       
                        for( new plr = 1; plr <= _gMaxPlayers; plr++ ) {
                               
                                if( is_user_alive(plr)
                               
                                && _PlayerHasMask(plr) ) {
                                       
                                        if( get_entity_distance(iEnt, plr) <= 240 ) {
                                               
                                                _ClearPlayerWithMask( plr )
                                                remove_entity( iEnt )
                                                Icon_Off( plr )
                                               
                                                ProtoChat( plr, "Infection prevented! Your Anti-Virus mask can no longer be used." )
                                        }
                                }
                        }
                }
        }
}

public zp_user_infected_post( plr ) {
        _ClearPlayerWithMask( plr )
        Icon_Off( plr )
}

public _FW_PlayerSpawn( plr ) {
        _ClearPlayerWithMask( plr )
        Icon_Off( plr )
}

public _FW_PlayerKilled( plr ) {
        _ClearPlayerWithMask( plr )
        Icon_Off( plr )
}

public client_disconnect( plr ) {
        Icon_Off( plr )
}

public Icon_On( plr ) {
        message_begin( MSG_ONE_UNRELIABLE, _gIcon, { 0, 0, 0 }, plr );
        write_byte( 1 )
        write_string( "dmg_gas" )
        write_byte( 0 )
        write_byte( 255 )
        write_byte( 0 )
        message_end( )
}

public Icon_Off( plr ) {
        message_begin( MSG_ONE_UNRELIABLE, _gIcon, { 0, 0, 0 }, plr )
        write_byte( 0 )
        write_string( "dmg_gas" )
        write_byte( 0 )
        write_byte( 255 )
        write_byte( 0 )
        message_end( )
}

ProtoChat( plr, const sFormat[], any:... ) {
       
        static i; i = plr ? plr : get_player( )
       
        if ( !i ) {
                return PLUGIN_HANDLED;
        }
       
        new sMessage[ 256 ]
        new len = formatex( sMessage, 255, "^x01[^x04HELL-HOLE^x01] ")
       
        vformat( sMessage[len], 255-len, sFormat, 3 )
        sMessage[ 192 ] = '^0'
       
        Make_SayText( plr, i, sMessage )
       
        return PLUGIN_CONTINUE
}

get_player( ) {
        for ( new plr; plr <= _gMaxPlayers; plr++ ) {
                if ( is_user_connected(plr) ) {
                        return plr
                }
        }
        return PLUGIN_HANDLED
}

Make_SayText( Receiver, Sender, sMessage[] ) {
        if ( !Sender ) {
                return PLUGIN_HANDLED;
        }
       
        message_begin( Receiver ? MSG_ONE_UNRELIABLE : MSG_ALL, _gMsgSayText, {0,0,0}, Receiver )
        write_byte( Sender )
        write_string( sMessage )
        message_end( )
       
        return PLUGIN_CONTINUE;
}

...to emit glow and aura while having the item. Since the item lasts only for a single round and gets removed when an infection grenade is used on the human, the glow and aura should, too, disappear once the round ends or the gas mask is removed using an infection grenade.

Thanks in advance. :)

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...