C++ Code
- #include common_scripts\utility;
- #include maps\mp\_utility;
- #include maps\mp\gametypes\_hud_util;
-
- init()
- {
- level thread onPlayerConnect();
- }
-
- onPlayerConnect()
- {
- while( true )
- {
- level waittill( "connected", player );
- player thread onPlayerSpawned();
- }
- }
-
- onPlayerSpawned()
- {
- self endon( "disconnect" );
-
- while( true )
- {
- self waittill( "spawned_player" );
- self thread spotEnemies();
- }
- }
-
- spotEnemies()
- {
- self endon( "disconnect" );
- self endon( "death" );
-
- distanceText = self createFontString( "smallfixed", 1 );
- distanceText setPoint( "CENTER", "CENTER", 10, 7 );
- distanceText.color = ( 51/255, 215/255, 54/255 );
- self thread destroyOnDeath( distanceText );
-
- while( true )
- {
- wait .05;
-
- //if( self getCurrentWeapon() != "binoculars_mp" )
- // continue;
-
- if( !self playerADS() )
- continue;
-
- start = self getTagOrigin( "tag_eye" );
- end = start + vector_scale( anglesToForward( self getPlayerAngles() ), 50000 );
- trace = bulletTrace( start, end, true, self );
-
- meters = inchesToMetres( distance( start, trace["position"] ) );
- distanceText setText( meters + "m" );
-
- if( !isDefined( trace["entity"] ) )
- continue;
-
- if( !isPlayer( trace["entity"] ) )
- continue;
-
- spottedEnemy = trace["entity"];
- spotFailed = false;
- for( i = 0; i < 30; i++ )
- {
- start = self getTagOrigin( "tag_eye" );
- end = start + vector_scale( anglesToForward( self getPlayerAngles() ), 50000 );
- trace = bulletTrace( start, end, true, self );
-
- meters = inchesToMetres( distance( start, trace["position"] ) );
- distanceText setText( meters + "m" );
-
- if( !isPlayer( trace["entity"] ) || ( trace["entity"] != spottedEnemy ) || !self playerADS() )
- {
- spotFailed = true;
- break;
- }
-
- wait .05;
- }
-
- if( spotFailed )
- continue;
-
- self maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( self, "enemy", "infantry", false );
- self iPrintLnBold( "^2You spotted: " + trace["entity"].name );
- }
- }
-
- destroyOnDeath( hudElem )
- {
- self waittill( "death" );
- hudElem destroy();
- }
-
- inchesToMetres( inches )
- {
- return ( inches * 0.0254 );
- }
so .. it doesn't display a number at all and when I set developer to 1 it gives me a shitload of runtime errors which shouldn't cause problems.
whenever I look at a player for like 3 seconds it doesn't do anything either, and the player should shout "Enemy spotted!" and show which player u spotted.
(08-10-2011, 12:58)Pozzuh Wrote:Se7en Wrote:Stealed, from cod4 mod ...look who's talking
[Release] Old School Mod v2.2
[Release] Scroll menu