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

SantaHat different for C4 carrier


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 12-22-2018 , 00:55   SantaHat different for C4 carrier
Reply With Quote #1

Hi, i have this plugin to set santa hat models, blue for ct, red for terrorists and pink to girls set by flag.

i want to add 1 more model, to the c4 carrier, can any one add this for me plz?

here is the code:
PHP Code:
#include < amxmodx >  
#include < engine >  
#include < cstrike >  
#include < hamsandwich >  

new const g_szGirlsHatModel[] = "models/pinkhat.mdl" 
#define PINK_HAT_ACCESS ADMIN_LEVEL_D 

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

new 
has_phat[33
new 
g_iHats33 ];  

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

public 
plugin_precache( ) {  
//  create_entity( "env_snow" );  
      
    
precache_modelg_szHatModelCS_TEAM_T ] );  
    
precache_modelg_szHatModelCS_TEAM_CT ] );  
    
precache_model(g_szGirlsHatModel
}  

public 
client_putinserver(id) { 
    if(
get_user_flags(id) & PINK_HAT_ACCESS
        
has_phat[id]=1


public 
client_disconnectid ) { 
    if( 
is_valid_entg_iHatsid ] ) )  
        
remove_entityg_iHatsid ] ); 
    
has_phat[id]=0


public 
FwdHamPlayerSpawn( const id ) {  
    if( 
is_user_aliveid ) ) {  
        new 
iEntity g_iHatsid ];  
          
        if( !
is_valid_entiEntity ) ) {  
            if( !( 
iEntity g_iHatsid ] = create_entity"info_target" ) ) )  
                return;  
              
            new 
CsTeams:iTeam cs_get_user_teamid );  
              
            if( 
iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )  
                
iTeam CS_TEAM_T;  
            if(
has_phat[id]) 
                
entity_set_modeliEntityg_szGirlsHatModel
            else 
                
entity_set_modeliEntityg_szHatModeliTeam ] );  
            
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FOLLOW );  
            
entity_set_edictiEntityEV_ENT_aimentid );  
        }  
    }  
}  

public 
EventTeamInfo( ) {  
    new 
id read_data), iEntity g_iHatsid ];  
      
    if( !
is_valid_entiEntity ) ) {  
        if( 
iEntity )  
            
g_iHatsid ] = 0;  
          
        return;  
    }  
      
    new 
szTeam];  
    
read_data2szTeam);  
    if(
has_phat[id]) 
        
entity_set_modeliEntityg_szGirlsHatModel
    else if( 
szTeam] == 'C' 
        
entity_set_modeliEntityg_szHatModelCS_TEAM_CT ] );  
    else  
        
entity_set_modeliEntityg_szHatModelCS_TEAM_T ] ); 
    return; 

this is the model for the c4, can be any name, i can change:



if anyone wants the model for the c4, or the pink hat too, just ask me and i'll post here

merry christmas
tarsisd2 is offline
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-22-2018 , 01:45   Re: SantaHat different for C4 carrier
Reply With Quote #2

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

new const g_szGirlsHatModel[] = "models/pinkhat.mdl"  
#define PINK_HAT_ACCESS ADMIN_LEVEL_D 
#define christmastree "models/cristmastree.mdl" 

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

new has_phat[33]  
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" );   
    register_forward(FM_SetModel,"fw_setmodel"); 
    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 ] );   
    precache_model(g_szGirlsHatModel)
    precache_model(christmastree);   
}   

public client_putinserver(id) {  
    if(get_user_flags(id) & PINK_HAT_ACCESS)  
        has_phat[id]=1;  
}  

public client_disconnect( id ) {  
    if( is_valid_ent( g_iHats[ id ] ) )   
        remove_entity( g_iHats[ id ] );  
    has_phat[id]=0;  
}  

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;   
            if(has_phat[id])  
                entity_set_model( iEntity, g_szGirlsHatModel)  
            else  
                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(has_phat[id])  
        entity_set_model( iEntity, g_szGirlsHatModel)  
    else if( szTeam[ 0 ] == 'C' )  
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );   
    else   
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );  
    return;  
}

 public fw_setmodel(ent,model[]) 
 { 
    if(equali(model,"models/w_c4.mdl")) 
    { 
        engfunc(EngFunc_SetModel,ent,christmastree); 
        return FMRES_SUPERCEDE; 
    } 

    return FMRES_IGNORED; 
 }
Saint Sinner is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 12-22-2018 , 03:00   Re: SantaHat different for C4 carrier
Reply With Quote #3

Quote:
Originally Posted by Saint Sinner View Post
Code:
#include < amxmodx >   
#include < engine > 
#include < fakemeta >
#include < cstrike >   
#include < hamsandwich >   

new const g_szGirlsHatModel[] = "models/pinkhat.mdl"  
#define PINK_HAT_ACCESS ADMIN_LEVEL_D 
#define christmastree "models/cristmastree.mdl" 

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

new has_phat[33]  
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" );   
    register_forward(FM_SetModel,"fw_setmodel"); 
    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 ] );   
    precache_model(g_szGirlsHatModel)
    precache_model(christmastree);   
}   

public client_putinserver(id) {  
    if(get_user_flags(id) & PINK_HAT_ACCESS)  
        has_phat[id]=1;  
}  

public client_disconnect( id ) {  
    if( is_valid_ent( g_iHats[ id ] ) )   
        remove_entity( g_iHats[ id ] );  
    has_phat[id]=0;  
}  

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;   
            if(has_phat[id])  
                entity_set_model( iEntity, g_szGirlsHatModel)  
            else  
                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(has_phat[id])  
        entity_set_model( iEntity, g_szGirlsHatModel)  
    else if( szTeam[ 0 ] == 'C' )  
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_CT ] );   
    else   
        entity_set_model( iEntity, g_szHatModel[ CS_TEAM_T ] );  
    return;  
}

 public fw_setmodel(ent,model[]) 
 { 
    if(equali(model,"models/w_c4.mdl")) 
    { 
        engfunc(EngFunc_SetModel,ent,christmastree); 
        return FMRES_SUPERCEDE; 
    } 

    return FMRES_IGNORED; 
 }
thanks but it didn't work, i get the 3 hats, blue, red and pink, the c4 carrier don't get the christmastree hat
tarsisd2 is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 12-22-2018 , 12:26   Re: SantaHat different for C4 carrier
Reply With Quote #4

Not Tested.

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

new const g_szGirlsHatModel[] = "models/pinkhat.mdl"
#define PINK_HAT_ACCESS ADMIN_LEVEL_D
#define HatC4 "models/cristmastree.mdl"
new const g_szHatModelCsTeams ][ ] = {
    
"",
    
"models/santahat.mdl",
    
"models/santahat_blue.mdl",
    
""
};

new 
bool:HasC4[33]
new 
has_phat[33]
new 
g_iHats33 ];

public 
plugin_init( ) {
    
register_plugin"Santa Hat + Snow""1.3""xPaw" );

    
register_cvar"santa_hat""1.3"FCVAR_SERVER );

    
register_event"TeamInfo""EventTeamInfo""a" );
    
register_forward(FM_SetModel,"fw_setmodel");
    
RegisterHamHam_Spawn"player""FwdHamPlayerSpawn");
}

public 
plugin_precache( ) {
//  create_entity( "env_snow" );

    
precache_modelg_szHatModelCS_TEAM_T ] );
    
precache_modelg_szHatModelCS_TEAM_CT ] );
    
precache_model(g_szGirlsHatModel)
    
precache_model(HatC4)
}

public 
client_putinserver(id) {
    if(
get_user_flags(id) & PINK_HAT_ACCESS)
        
has_phat[id]=1;
}

public 
client_disconnectid ) {
    if( 
is_valid_entg_iHatsid ] ) )
        
remove_entityg_iHatsid ] );
    
has_phat[id]=0;
}

public 
FwdHamPlayerSpawn( const id ) {
    if( 
is_user_aliveid ) ) {
        new 
iEntity g_iHatsid ];

        if (
user_has_weapon(idCSW_C4))
            
HasC4[id] = true
        
else
            
HasC4[id] = false

        
if( !is_valid_entiEntity ) ) {
            if( !( 
iEntity g_iHatsid ] = create_entity"info_target" ) ) )
                return;

            new 
CsTeams:iTeam cs_get_user_teamid );

            if( 
iTeam != CS_TEAM_T && iTeam != CS_TEAM_CT )
                
iTeam CS_TEAM_T;

            if(
HasC4[id])
                
entity_set_modeliEntityHatC4)

            if(
has_phat[id])
                
entity_set_modeliEntityg_szGirlsHatModel)
            else
                
entity_set_modeliEntityg_szHatModeliTeam ] );
            
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FOLLOW );
            
entity_set_edictiEntityEV_ENT_aimentid );
        }
    }
}

public 
EventTeamInfo( ) {
    new 
id read_data), iEntity g_iHatsid ];

    if( !
is_valid_entiEntity ) ) {
        if( 
iEntity )
            
g_iHatsid ] = 0;

        return;
    }

    new 
szTeam];
    
read_data2szTeam);

    if(
HasC4[id])
        
entity_set_modeliEntityHatC4)

    if(
has_phat[id])
        
entity_set_modeliEntityg_szGirlsHatModel)
    else if( 
szTeam] == 'C' )
        
entity_set_modeliEntityg_szHatModelCS_TEAM_CT ] );
    else
        
entity_set_modeliEntityg_szHatModelCS_TEAM_T ] );
    return;

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Apb hq
Senior Member
Join Date: Apr 2014
Old 12-23-2018 , 06:46   Re: SantaHat different for C4 carrier
Reply With Quote #5

Can you send us pink and c4 carrier hat thanks in advance
Apb hq is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 12-30-2018 , 12:42   Re: SantaHat different for C4 carrier
Reply With Quote #6

Quote:
Originally Posted by Apb hq View Post
Can you send us pink and c4 carrier hat thanks in advance
since more people asked for the models, i decided to post the models i used this xmas, there are 4 of them, hope anyone like it:



happy new year
Attached Files
File Type: zip christmashats.zip (206.1 KB, 43 views)
tarsisd2 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 04:53.


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