diff --git a/README.md b/README.md index d4e4d860..4f933e1a 100644 --- a/README.md +++ b/README.md @@ -365,7 +365,7 @@ * Gain 10% interest on deposited points at the end of each round * No longer costs 100 points to withdraw * Players can deposit and withdraw less than 1000 points -* Account balance is shown when depositing, withdrawing, and going near the triggers +* Account balance is shown * Disabled trading points ## Weapon Locker diff --git a/scripts/zm/replaced/_zm_banking.gsc b/scripts/zm/replaced/_zm_banking.gsc index f99b7cb2..4fcc1d60 100644 --- a/scripts/zm/replaced/_zm_banking.gsc +++ b/scripts/zm/replaced/_zm_banking.gsc @@ -104,7 +104,7 @@ trigger_deposit_think() { player thread do_player_general_vox( "general", "exert_sigh", 10, 50 ); } - player show_balance(); + self thread show_balance(player); } } @@ -150,13 +150,13 @@ trigger_withdraw_think() { player thread do_player_general_vox( "general", "exert_sigh", 10, 50 ); } - player show_balance(); + self thread show_balance(player); } } trigger_deposit_update_prompt( player ) { - player show_balance(); + self thread show_balance(player); if ( (player.score <= 0) || (player.account_value >= level.bank_account_max) ) { self sethintstring( "" ); @@ -168,7 +168,7 @@ trigger_deposit_update_prompt( player ) trigger_withdraw_update_prompt( player ) { - player show_balance(); + self thread show_balance(player); if ( player.account_value <= 0 ) { self sethintstring( "" ); @@ -178,7 +178,52 @@ trigger_withdraw_update_prompt( player ) return 1; } -show_balance() +show_balance(player) { - self iprintlnbold("Account Balance: " + round_up_to_ten(int(self.account_value * level.bank_deposit_ddl_increment_amount))); + stub = self.stub; + + if (!isDefined(stub.bankbalancehud)) + { + stub.bankbalancehud = []; + } + + num = player getentitynumber(); + + if (isDefined(stub.bankbalancehud[num])) + { + stub.bankbalancehud[num] settext( "Account Balance: " + round_up_to_ten(int(player.account_value * level.bank_deposit_ddl_increment_amount)) ); + return; + } + + hud = newclienthudelem( player ); + hud.alignx = "center"; + hud.aligny = "middle"; + hud.horzalign = "center"; + hud.vertalign = "bottom"; + hud.y = -100; + hud.foreground = 1; + hud.hidewheninmenu = 1; + hud.font = "default"; + hud.fontscale = 1; + hud.alpha = 1; + hud.color = ( 1, 1, 1 ); + hud settext( "Account Balance: " + round_up_to_ten(int(player.account_value * level.bank_deposit_ddl_increment_amount)) ); + stub.bankbalancehud[num] = hud; + + while ( isDefined( self ) ) + { + if (!player isTouching(self)) + { + hud.alpha = 0; + wait 0.05; + continue; + } + + hud.alpha = 1; + + wait 0.05; + } + + stub.bankbalancehud[num] destroy(); + stub.bankbalancehud[num] = undefined; } \ No newline at end of file