Getting the bank balance of all players online

  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Getting the bank balance of all players online

« posted: Feb 05, 2015, 07:57 AM »
Hello ;>

I've had an idea for some time , but am not 100% sure how to go about it ...
I want to change the Laptop hacking mission reward in a way :)

Once hacked , I need to check all the bank balances of all the players online and take a small percentage of their bank money for the person who hacked it ( excluding his own of course )

e.g.

Player hacks the laptop, 10 players online , they each lose a percentage of money in their bank etc , 5% of their total balance.

So basically take 5% of each player onlines bank , add it up into a whole amount and then give it to the hacker :>


now I have some ideas on how to do this, but would just like some input from the smarter coders :>

- from the grassy knoll -

Re: Getting the bank balance of all players online

« Reply #1 posted: Feb 05, 2015, 02:18 PM »
I would really like to see this. ;)

Great Idea!

  • Offline LouD
  • Silent but deadly ;)
  • Moderator
  • Veteran
  • ******
  • Posts: 1415

Re: Getting the bank balance of all players online

« Reply #2 posted: Feb 05, 2015, 02:45 PM »
Well you would have to get all players bmoney variable i guess. Subtract a random percentage. This value should be added to the value for the laptop and the players bmoney variable is saved. When the mission succeeds you win the money and when it fails the money is lost forever.
My guess is you would get a lot of angry players if this mission comes a long often. What you could do is make it random if the money is system generated or detracted from the bankmoney.
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Getting the bank balance of all players online

« Reply #3 posted: Feb 05, 2015, 03:27 PM »
Well you would have to get all players bmoney variable i guess. Subtract a random percentage. This value should be added to the value for the laptop and the players bmoney variable is saved. When the mission succeeds you win the money and when it fails the money is lost forever.
My guess is you would get a lot of angry players if this mission comes a long often. What you could do is make it random if the money is system generated or detracted from the bankmoney.

well you will only do the sum of all players bmoney once the you success on the laptop hacking , then take 5% of each players bmoney that is online.

How would i add up each persons balance ?

Code: [Select]
{   
if (isPlayer _x)  then {   
_bmoney = _x getVariable ["bmoney",0];     

} forEach playableUnits;


I will be looking into this , I think it's a great way to ensure players pay attention to certain missions as it will affect them ..now if we only had a working bounty :P

if the mission fails you get nothing of course, if people see this mission is up , they will pull all the money out their bank :P


- from the grassy knoll -

Re: Getting the bank balance of all players online

« Reply #4 posted: Feb 09, 2015, 12:11 AM »
Subscribed for updates.  ;)

Re: Getting the bank balance of all players online

« Reply #5 posted: Feb 11, 2015, 03:12 PM »
Quote
I will be looking into this , I think it's a great way to ensure players pay attention to certain missions as it will affect them ..now if we only had a working bounty

I put back JoShaaps bounty thing(with some edits), and are rewarding the killer with money equal to the bounty (cbounty) value and adding the targets bounty value to theirs also(so even if you kill a low bounty target yours gets higher and higher), this resets when killed to a starting value. It creates an incentive for them to go after each other, well getting a higher bounty set onto you might counteract that i guess =).

Unfortunately it doesn't do anything more but id like it to be so from time to time you get a global hint and a marker added on the map for players that has a "high" bounty, say 1000. If any of those players gets near any of the towns/villages. The marker should be static and say, "X was last seen here" and then be removed lets say 20 minutes later. this way the bounty targets have a chance to get away or need to keep themselves away from "public" places.

Re: Getting the bank balance of all players online

« Reply #6 posted: Feb 16, 2015, 09:40 AM »
Could you do something like...
(Untested code, just written it inside the forum editor)

Code: [Select]

//After mission success
_totalMoney = 0;
{   
if (isPlayer _x)  then {   
_bmoney = _x getVariable ["bmoney",0];
if ( _bmoney > 0 ) then { //might as well check for zero's
_fivePercent = round(0.05*_bmoney);
_x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
_totalMoney = _totalMoney + _fivePercent;
}
}
} forEach playableUnits;

//award winning player the money
_theHacker setVariable["bmoney", (_theHacker getVariable["bmoney",0] + _totalMoney), true];


Just an idea.
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Getting the bank balance of all players online

« Reply #7 posted: Feb 16, 2015, 10:14 AM »
Added with some minor changes - seems to work great =)

Code: [Select]
//After mission success
_totalMoney = 0;
{   
if (isPlayer _x)  then {   
_bmoney = _x getVariable ["bmoney",0];
if ( _bmoney > 0 ) then { //might as well check for zero's
_fivePercent = round(0.05*_bmoney);
_x setVariable [ "bmoney", (_bmoney - _fivePercent), true ];
_totalMoney = _totalMoney + _fivePercent;
}
}
} forEach playableUnits;


if (_totalMoney > 25000) then {
player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + _totalMoney, true];
}
else {
player setVariable ["cmoney", (player getVariable ["cmoney", 0]) + 25000, true];
};
};

Dynamic Hacker Mission Reward

- from the grassy knoll -
  • Offline LouD
  • Silent but deadly ;)
  • Moderator
  • Veteran
  • ******
  • Posts: 1415

Re: Getting the bank balance of all players online

« Reply #8 posted: Feb 16, 2015, 01:34 PM »
I think you will get a lot of angry players with this mission lol... Hard earned money gone
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Getting the bank balance of all players online

« Reply #9 posted: Feb 16, 2015, 01:43 PM »
I think you will get a lot of angry players with this mission lol... Hard earned money gone

haha naaw ! It just makes this mission that much more appealing :)

e.g if a player has 100k in the bank , they only lose 5k ?, it's not alot really , but can add up if your server is quite busy :)

my bank limit is set to 500k anyways , so the most a player can lose is 25k ? best the do the mission then ? :)

- from the grassy knoll -

Re: Getting the bank balance of all players online

« Reply #10 posted: Feb 16, 2015, 07:00 PM »
I have yet to look at the script, so this might already be in.

However, it would be cool to place down one of them circles (like what the gunstore has for example) off of the hackers position a little bit (randomly!), notify all of the other players that their bank accounts are being hacked and put a radar icon up for it.

A group of players could protect the hacker while other players attempt to kill the person hacking.
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Getting the bank balance of all players online

« Reply #11 posted: Feb 17, 2015, 11:23 AM »
I've added a small check to make sure you only hack enemy bank accounts - busy testing it at the moment :)

Thanks again for the help !

- from the grassy knoll -

Re: Getting the bank balance of all players online

« Reply #12 posted: Feb 18, 2015, 07:06 AM »
I tested your script today but it's giving the player around 260,000 with 20 players on and people bank account have dropped 100,000 each time someone hacked the laptop (3 times the mission ran so far)

Re: Getting the bank balance of all players online

« Reply #13 posted: Feb 18, 2015, 07:42 AM »
also the player loses money also ;-)
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Getting the bank balance of all players online

« Reply #14 posted: Feb 18, 2015, 08:06 AM »
also the player loses money also ;-)

When did you get the mission file ? I've made a few "tweaks" to the code.

I've included a check that you only hack enemy bank accounts
I've changed the amount down from 5% to 3.5%.
OPFOR hack all indi and BLUFOR accounts
BLUFOR hack all OPFOR and INDI accounts
Only Independant hacks everyones accounts ( including his own - will change that ).

The amount given is based on 3.5% of the TOTAL bank balance they have - so the more they , the more they lose.My bank balance cap on the server is set to $500k, so the most a player can lose is $17.5k if they have max cash in the bank.

If the value of the hack is less than $25k  the player will hack $25k and the other players all still lose 3.5% from their bank.

Works well so far - results varied last night between 25 and 200k on a busier server :)


- from the grassy knoll -