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

Santa Hats only for CT team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Carbonzxc
Member
Join Date: Sep 2015
Old 11-28-2016 , 11:58   Santa Hats only for CT team
Reply With Quote #1

Hello, im running a zombie server but santa hats makes problem when a zombie buys invisible. So i need to make that plugin only for Humans (CT) Team. Thanks !

Code:
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < hamsandwich >

new const g_szHatModel[ CsTeams ][ ] = {
    "",
    "models/santahat.mdl",
    "models/santahat_blue.mdl",
    ""
};

new g_iHats[ 33 ];

public plugin_init( ) {
    register_plugin( "Santa Hat + Snow", "1.3", "xPaw" );
    
    register_cvar( "santa_hat", "1.3", FCVAR_SERVER );
    
    register_event( "TeamInfo", "EventTeamInfo", "a" );
    
    RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", 1 );
}

public plugin_precache( ) {
//  create_entity( "env_snow" );
    
    precache_model( g_szHatModel[ CS_TEAM_T ] );
    precache_model( g_szHatModel[ CS_TEAM_CT ] );
}

public client_disconnect( id )
    if( is_valid_ent( g_iHats[ id ] ) )
        remove_entity( g_iHats[ id ] );

public FwdHamPlayerSpawn( const id ) {
    if( is_user_alive( id ) ) {
        new iEntity = g_iHats[ id ];
        
        if( !is_valid_ent( iEntity ) ) {
            if( !( iEntity = g_iHats[ id ] = create_entity( "info_target" ) ) )
                return;
            
            new CsTeams:iTeam = cs_get_user_team( id );
            
            if( iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )
                iTeam = CS_TEAM_T;
            
            entity_set_model( iEntity, g_szHatModel[ iTeam ] );
            entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
            entity_set_edict( iEntity, EV_ENT_aiment, id );
        }
    }
}

public EventTeamInfo( ) {
    new id = read_data( 1 ), iEntity = g_iHats[ id ];
    
    if( !is_valid_ent( iEntity ) ) {
        if( iEntity > 0 )
            g_iHats[ id ] = 0;
        
        return;
    }
    
    new szTeam[ 2 ];
    read_data( 2, szTeam, 1 );
    
    if( szTeam[ 0 ] == 'C' )
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );
    else
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );
}
Carbonzxc is offline
Old 12-09-2016, 00:48
jackseason
This message has been deleted by Arkshine. Reason: Spambot
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 09:10.


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