The hats on hostages are completely bugged, but here is working version
PHP Code:
#include < amxmodx >
#include < engine >
new const g_szHat[ ] = "models/jamaicahat.mdl";
public plugin_init( ) {
register_plugin( "Hostages Hats", "1.0", "xPaw" );
new iEntity, bool:bFound;
while( ( iEntity = find_ent_by_class( iEntity, "hostage_entity" ) ) > 0 ) {
if( !bFound ) {
bFound = true;
register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
}
CreateHat( iEntity );
}
}
public plugin_precache( )
precache_model( g_szHat );
public EventNewRound( ) {
new iEntity;
while( ( iEntity = find_ent_by_class( iEntity, "hostage_entity" ) ) > 0 )
if( !is_valid_ent( entity_get_int( iEntity, EV_INT_iuser1 ) ) )
CreateHat( iEntity );
}
CreateHat( const iHostage ) {
new iEntity = create_entity( "info_target" );
if( !is_valid_ent( iEntity ) )
return 0;
entity_set_int( iHostage, EV_INT_iuser1, iEntity );
entity_set_int( iEntity, EV_INT_movetype, MOVETYPE_FOLLOW );
entity_set_edict( iEntity, EV_ENT_aiment, iHostage );
entity_set_model( iEntity, g_szHat );
return iEntity;
}
__________________