fix error

This commit is contained in:
ineedbots 2021-09-14 15:46:34 -06:00
parent e0ad486ee0
commit ca2f3c8f7c

View File

@ -5,47 +5,49 @@
init() init()
{ {
setDvarIfUninitialized( "scr_showHP", false ); setDvarIfUninitialized( "scr_showHP", false );
level.showHP = getDvarInt("scr_showHP"); level.showHP = getDvarInt( "scr_showHP" );
level thread onPlayerConnect(); level thread onPlayerConnect();
} }
onPlayerConnect() onPlayerConnect()
{ {
for(;;) for ( ;; )
{ {
level waittill( "connected", player); level waittill( "connected", player );
player thread onPlayerSpawned(); player thread onPlayerSpawned();
} }
} }
onPlayerSpawned() onPlayerSpawned()
{ {
self endon("disconnect"); self endon( "disconnect" );
for(;;)
{
self waittill("spawned_player");
if(level.showHP) for ( ;; )
self thread drawHP(); {
} self waittill( "spawned_player" );
if ( level.showHP )
self thread drawHP();
}
} }
destoryHPdraw() destoryHPdraw()
{ {
self waittill_either("disconnect", "death"); self endon( "disconnect" );
self waittill( "death" );
self.drawHP destroy(); self.drawHP destroy();
self.drawSpeed destroy(); self.drawSpeed destroy();
} }
initHPdraw() initHPdraw()
{ {
self.drawHP = self createFontString("default", 1.2); self.drawHP = self createFontString( "default", 1.2 );
self.drawHP setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -150, -20); self.drawHP setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -150, -20 );
self thread destoryHPdraw(); self thread destoryHPdraw();
self.drawSpeed = self createFontString("default", 1.2); self.drawSpeed = self createFontString( "default", 1.2 );
self.drawSpeed setPoint("BOTTOMRIGHT", "BOTTOMRIGHT", -150, -10); self.drawSpeed setPoint( "BOTTOMRIGHT", "BOTTOMRIGHT", -150, -10 );
self thread destoryHPdraw(); self thread destoryHPdraw();
} }
@ -54,13 +56,14 @@ drawHP()
self endon( "disconnect" ); self endon( "disconnect" );
self endon( "death" ); self endon( "death" );
self initHPdraw(); self initHPdraw();
for(;;)
for ( ;; )
{ {
//self.drawHP setText("HP: "+self.health+" KS: "+self.pers["cur_kill_streak"]); //self.drawHP setText("HP: "+self.health+" KS: "+self.pers["cur_kill_streak"]);
self.drawHP setValue(self.health); self.drawHP setValue( self.health );
vel = self getVelocity(); vel = self getVelocity();
self.drawSpeed setValue(int(length((vel[0], vel[1], 0)))); self.drawSpeed setValue( int( length( ( vel[0], vel[1], 0 ) ) ) );
wait 0.05; wait 0.05;
} }
} }