Page 1 of 1

Santa hat

Posted: 22 Oct 2021, 04:33
by Mero^
hello, i used this plugin in the furien server and i got a problem like the (furien - terrorists) their hats don't hide when they're disappear
| Afiseaza codul
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < hamsandwich >

new const g_szHatModel[ CsTeams ][ ] = {
	"",
	"models/make/santa_capt.mdl",
	"models/make/santa_capct.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 ] );
}


Re: Santa hat

Posted: 23 Oct 2021, 19:25
by GENERALU'
put here plugins.ini file please, i don't see where is problem..........

Re: Santa hat

Posted: 25 Oct 2021, 16:36
by Addicted:-
Mero^ wrote:
22 Oct 2021, 04:33
hello, i used this plugin in the furien server and i got a problem like the (furien - terrorists) their hats don't hide when they're disappear
| Afiseaza codul
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < hamsandwich >

new const g_szHatModel[ CsTeams ][ ] = {
	"",
	"models/make/santa_capt.mdl",
	"models/make/santa_capct.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 ] );
}



what are you trying to say with "they're hats don't hide when they disappear"? try this one https://forums.alliedmods.net/showthread.php?t=81172

Re: Santa hat

Posted: 28 Oct 2021, 12:36
by dragonCSX
Addicted:- wrote:
25 Oct 2021, 16:36
Mero^ wrote:
22 Oct 2021, 04:33
hello, i used this plugin in the furien server and i got a problem like the (furien - terrorists) their hats don't hide when they're disappear
| Afiseaza codul
#include < amxmodx >
#include < engine >
#include < cstrike >
#include < hamsandwich >

new const g_szHatModel[ CsTeams ][ ] = {
	"",
	"models/make/santa_capt.mdl",
	"models/make/santa_capct.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 ] );
}



what are you trying to say with "they're hats don't hide when they disappear"? try this one https://forums.alliedmods.net/showthread.php?t=81172
se refera la faptul ca palariile inca raman vizibile pentru toti ceilalti dupa ce furien ul devine invizibil.

Re: Santa hat

Posted: 29 Oct 2021, 21:58
by L E V I N
use bb-code '[ code ]' instead of that shit, if u want help :)

Re: Santa hat

Posted: 29 Oct 2021, 22:34
by Mero^
L E V I N wrote:
29 Oct 2021, 21:58
use bb-code '[ code ]' instead of that shit, if u want help :)
Sorry i didn't know