Jump to content
  • 0
mgm

HOWTO deposit/withdraw money (from bankAccount) & (from player's cash)?

Question

Hi guys,

 

In Arma2Epoch I was using Zupa's Single Currency system and the developer functions allowed me to add/remove money:

 

How can I do the same in Arma3Epoch? Simply put, from inside a server-side SQF script, I would like to do things like:

  • add n krypto to playerBankAccount
  • remove n krypto from playerBankAccount
  • add n krypto to playerCash
  • remove n krypto from playerCash

Thanks!

Share this post


Link to post
Share on other sites

16 answers to this question

Recommended Posts

  • 0

I have a paycheque script running on my server, you can see from that how you can check the amount players have and how to add Krypto, not sure of the commands for the bank balance though (if there are any).

while {true} do 
{
	sleep 300;
	if(EPOCH_playerCrypto < 991) then
	{
		EPOCH_playerCrypto = EPOCH_playerCrypto + 10;
		systemchat("You have just received 10 Krypto");
	};

	if(EPOCH_playerEnergy < 991) then
	{
		EPOCH_playerEnergy = EPOCH_playerEnergy + 10;
		systemchat("You have just received 10 Energy");
	};		
};

Share this post


Link to post
Share on other sites
  • 0

I have a paycheque script running on my server, you can see from that how you can check the amount players have and how to add Krypto, not sure of the commands for the bank balance though (if there are any).

 

while {true} do 
{
	sleep 300;
	if(EPOCH_playerCrypto < 991) then
	{
		EPOCH_playerCrypto = EPOCH_playerCrypto + 10;
		systemchat("You have just received 10 Krypto");
	};

	if(EPOCH_playerEnergy < 991) then
	{
		EPOCH_playerEnergy = EPOCH_playerEnergy + 10;
		systemchat("You have just received 10 Energy");
	};		
};

Thanks buddy, I will test this soon.

 

 

 

Still need the bank functions :(

Share this post


Link to post
Share on other sites
  • 0

Infistar have this, I have a php bank script

where is this money stored? redis db, isn't it? can we not run external commands to manipulate db contents (just like executing mysql client with sql query files)?

Share this post


Link to post
Share on other sites
  • 0

The money is in the redis you can add/subtract money there, I had a script that every night would give an interest for the money in the bank

10 hours alive where 1% of the money in your bank, had a guy that just spawn in his base and stayed there he had over 100 hours alive wich is 10%

Share this post


Link to post
Share on other sites
  • 0

The money is in the redis you can add/subtract money there, I had a script that every night would give an interest for the money in the bank

10 hours alive where 1% of the money in your bank, had a guy that just spawn in his base and stayed there he had over 100 hours alive wich is 10%

Thanks for this.

I was hoping to add/remove from within an SQF - just like Zupa's simple and bril SCadd SCremove functions.

How did you do this, as O/S level scheduled maintenance task?

You think it can be done from SQF? I called SQF from an SQF but never a BAT/CMD/EXE from an SQF (even if it's possible).

You think it'd ve too slow?

Sorry for the 20 questions. My first. I'm scared :)

Share this post


Link to post
Share on other sites
  • 0

You would trigger the batch file using BEC scheduling and use either the redis command line or php to perform the database changes.

Thanks for this - let me see if I got that right:

 

Let's say playerA wish to use the taxi service - he will have to pay (say 100 krypto)  for the service but he has no cash on him, no worries we accept bank transfer too, right?

 

We provide the service and at the same time make a record of playerA's playerUID and the outstanding amount (100 krypto in this case). ArmaServer.exe is still running and this underlined information above is in memory allocated to ArmaServer.exe.

 

As a separate process, Bec's scheduled task launcher [or Windows or Cygwin scheduler] launch a Windows process, it is a process that launches redis command line utilities, connects to the live Arma3Epoch database, and  manipulates the "PlayerA_PlayerUID: BANK_BALANCE=9000"  key in the database. Is that right?

 

How would the 2nd process know which playerUID to modify and how much exactly to add/remove?

It has, so far, no connection to the underlined bit of information, which resides in server memory.

 

How do you connect these two processes?

Share this post


Link to post
Share on other sites
  • 0

I'm not sure adjusting the balance in the database reflects in game immediately, I'd try editing it manually using RedisDesktopManager and see if it works before investing any effort into it.

I would have thought there was a way to manipulate the bank balance in the same way you can manipulate the currency that people have on them

Share this post


Link to post
Share on other sites
  • 0

I'm not sure adjusting the balance in the database reflects in game immediately, I'd try editing it manually using RedisDesktopManager and see if it works before investing any effort into it.

I would have thought there was a way to manipulate the bank balance in the same way you can manipulate the currency that people have on them

I assumed that was the case...

 

*bump*

Could an enlightened one please tell us how (or whether) can it be done? epochBankBal = epochBankBal - 50; //no?

Share this post


Link to post
Share on other sites
  • 0

I have a paycheque script running on my server, you can see from that how you can check the amount players have and how to add Krypto, not sure of the commands for the bank balance though (if there are any).

 

while {true} do 
{
	sleep 300;
	if(EPOCH_playerCrypto < 991) then
	{
		EPOCH_playerCrypto = EPOCH_playerCrypto + 10;
		systemchat("You have just received 10 Krypto");
	};

	if(EPOCH_playerEnergy < 991) then
	{
		EPOCH_playerEnergy = EPOCH_playerEnergy + 10;
		systemchat("You have just received 10 Energy");
	};		
};

But this script in bugy....

 

10:13:37 Error in expression <e.sqf" while {true} do { sleep 300; if(EPOCH_playerCrypto < 991) then { EPOCH_p> 10:13:37 Error position: <EPOCH_playerCrypto < 991) then { EPOCH_p> 10:13:37 Error Undefined variable in expression: epoch_playercrypto 10:13:37 File mpmissions\__cur_mp.Altis\custom\paycheque.sqf, line 4

 

Know some1 where is the problem?

Share this post


Link to post
Share on other sites
  • 0

But this script in bugy....

 

10:13:37 Error in expression <e.sqf" while {true} do { sleep 300; if(EPOCH_playerCrypto < 991) then { EPOCH_p> 10:13:37 Error position: <EPOCH_playerCrypto < 991) then { EPOCH_p> 10:13:37 Error Undefined variable in expression: epoch_playercrypto 10:13:37 File mpmissions\__cur_mp.Altis\custom\paycheque.sqf, line 4

 

Know some1 where is the problem?

 

You can't modify Crypto client side any more, it has to be done server side.

Share this post


Link to post
Share on other sites
  • 0

Since when? It was working last night for me on the latest version, I think?

 

Subtracting Krypto still works, if you try to add it, then it zeros your balance. It's possible that it is iniSTAR stopping it though as I haven't tried the stock AH recently.

Share this post


Link to post
Share on other sites
  • 0

Subtracting Krypto still works, if you try to add it, then it zeros your balance. It's possible that it is iniSTAR stopping it though as I haven't tried the stock AH recently.

Gotcha thx

Edit what's this lame anti hack? Lol

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By Thug
      I have an overpoch Sauerland server. The vehicle traders are not spawning when you buy. The SOB takes your money and gives you a key, but no vehicle.  The arrow comes up for about 12 seconds.  After the restart, they are there, all on top of each other.
      NO, I do not have infistar installed.  It brakes the server. No admin tools at all.
      Here are my server and client RPTs. Can someone please take a look for me?
      Client
      Server
      All other traders work.
       
    • By chi
      Can someone tell me if im doing something wrong here? Im trying to spawn a random amount of coins on Zombies when they die.
      This is my zombie_generate.sqf and im calling it from my custom compiles. Sorry, but im on my phone and cant find a spoiler box button.
      #include "\z\addons\dayz_code\loot\Loot.hpp"
      private ["_bypass","_position","_unitTypes","_radius","_method","_agent","_maxlocalspawned","_doLoiter","_wildspawns","_maxControlledZombies",
      "_cantSee","_isOk","_zPos","__FILE__","_fov","_safeDistance","_farDistance","_xasl","_eye","_ed","_deg","_skipFOV","_wildSpawns","_tooClose",
      "_type","_loot","_array","_rnd","_lootType","_index","_weights","_loot_count","_favStance","_lootGroup"];
      _position = _this select 0;
      _doLoiter = _this select 1; // wonder around
      _unitTypes = _this select 2; // class of wanted models
      //_wildspawns = _this select 3;
      _bypass = _this select 3;
      _maxlocalspawned = round(dayz_spawnZombies);
      //Lets check if we need to divide the amount of zeds
      if (r_player_divideinvehicle > 0) then {
          _maxlocalspawned = round(dayz_spawnZombies / r_player_divideinvehicle);
      };
      _maxControlledZombies = round(dayz_maxLocalZombies);
      _cantSee = {
          private "_isOk";
          _isOk = true;
          _zPos = +(_this select 0);
          if (count _zPos < 3) exitWith {
              diag_log format["%1::_cantSee illegal pos %2", __FILE__, _zPos];
              false
          };
          _zPos = ATLtoASL _zPos;
          _fov = _this select 1; // players half field of view
          _safeDistance = _this select 2; // minimum distance. closer is wrong
          _farDistance = _this select 3; // distance further we won't check
          _zPos set [2, (_zPos select 2) + 1.7];
          {
              _xasl = getPosASL _x;
              if (_xasl distance _zPos < _farDistance) then {
                  if (_xasl distance _zPos < _safeDistance) then {
                      _isOk = false;
                  } else {
                      _eye = eyePos _x; // ASL
                      _ed = eyeDirection _x;
                      _ed = (_ed select 0) atan2 (_ed select 1);
                      _deg = [_xasl, _zPos] call BIS_fnc_dirTo;
                      _deg = (_deg - _ed + 720) % 360;
                      if (_deg > 180) then { _deg = _deg - 360; };
                      if ((abs(_deg) < _fov) && {( // in right angle sector?
                              (!(terrainIntersectASL [_zPos, _eye]) // no terrain between?
                              && {(!(lineIntersects [_zPos, _eye]))}) // and no object between?
                          )}) then {
                          _isOk = false;
                      };
                  };
              };
              if (!_isOk) exitWith {false};
          uiSleep 0.001;
          } forEach playableUnits;
          _isOk
      };
      _skipFOV = false;
      if ((_maxlocalspawned < _maxControlledZombies) && (dayz_CurrentNearByZombies < dayz_maxNearByZombies) && (dayz_currentGlobalZombies < dayz_maxGlobalZeds)) then {
          if (_bypass) then {  
              _skipFOV = true;
              _position = [_position,3,20,1] call fn_selectRandomLocation;
          };
          if (surfaceIsWater _position) exitWith { diag_log "Location is in Water Abort"; };
          if ((_skipFOV) or {([_position, 15, 10, 70] call _cantSee)}) then {
              _tooClose = {isPlayer _x} count (_position nearEntities ["CAManBase",30]) > 0;
              if (_tooClose) exitwith { diag_log "Zombie_Generate: was too close to player."; };
              
              if (count _unitTypes == 0) then {
                  _unitTypes = getArray (missionConfigFile >> "CfgLoot" >> "Buildings" >> "Default" >> "zombieClass");
              };
              
              // lets create an agent
              _type = _unitTypes call BIS_fnc_selectRandom;
              _radius = 5;
              //_method = if (_doLoiter) then {"CAN_COLLIDE"} else {"NONE"};
              _agent = createAgent [_type, _position, [], _radius, "CAN_COLLIDE"]; 
              uiSleep 0.03;
              
              //add to global counter 
              dayz_spawnZombies = dayz_spawnZombies + 1;
              dayz_CurrentNearByZombies = dayz_CurrentNearByZombies + 1;
              dayz_currentGlobalZombies = dayz_currentGlobalZombies + 1;
              
              //Add some loot
              if (0.3 > random 1) then {
                  _lootGroup = configFile >> "CfgVehicles" >> _type >> "zombieLoot";
                  if (isText _lootGroup) then {
                      //_lootGroup = dayz_lootGroups find getText (_lootGroup);
                      _lootGroup = Loot_GetGroup(getText _lootGroup);
                      //[_agent, _lootGroup, 1] call loot_insert;
                      Loot_Insert(_agent, _lootGroup, 1);
                  };
              };
              
              _agent setVariable["agentObject",_agent];
              if (!isNull _agent) then {
                  _agent setDir random 360;
                  uiSleep 0.03;
                  _position = getPosATL _agent;
                  _favStance = (
                      switch ceil(random(3^0.5)^2) do {
                          //case 3: {"DOWN"}; // prone
                          case 2: {"middle"}; // Kneel "middle"
                          default {"Up"}; // stand-up
                      }
                  );
                  _agent setUnitPos _favStance;
                  _agent setVariable ["stance", _favStance];
                  _agent setVariable ["BaseLocation", _position];
                  _agent setVariable ["doLoiter", _doLoiter]; // true: Z will be wandering, false: stay still
                  
                  _coinsRandom = random 1;
                  if (_coinsRandom <= 0.5) then {
                  _cash = round(random 20) * 5; // number between 0 and 200 Add Coins to Zombie
                  _agent setVariable["CashMoney",_cash ,true]; // Add Coins to Zombie
                  };
              };
          };
      };
       
    • By iben
      Hello guys,
      because I was couple times asked for updated and unified dev function for single currency (originally posted in ZSC thread),
      I've decided release it here so you can have all info in one place.
      So here it is with specific example (with detailed comments) you can try for fun...
      ===
      First thing first - let's start with giving credits for these great guys:
      DayZ Epoch developers, collaborators and contributors (thank you guys for your excellent work!) (visit them on github) @Zupa : original SC concept creator and author of Universal Dev functions for 1.0.5 version. (see original thread) @salival : for adapting @Zupa's concept to 1.0.6+ version and great community support. (see original thread) All great guys from Epoch comunity participating on SC and banking concept (see original thread) ===
      This function was reworked and updated for Epoch 1.0.6.1+
      ===
      Changelog:
      [2017-05-08], v1.0 | Initial release, published at Epoch forum [2017-05-28], v1.1 | Added: debug (parameters check, exec time to analyze code performace in game) [2017-05-31], v1.2 | Improved: removed unnecessary checks during player sync ===
      Read "Goodbye". Wish you the best guys!
      ===
      How it looks like:
      Check source code (Github)
      ===
      FEATURES:
      Function is able to manage money processing with single line code (see bellow) and can be easily integrated into your code You can use debug option to check your fnc parameters + exec time (code performance) showed on screen (global chat):
      just uncoment line: '#define: __ DEBUG__' is src code; It's pretty fast but remember: use it only if you're developing some addon or you know exactly what to do.
      Otherwise, you can stil use common methods used by addons authors - mostly it's even faster their way, because of scoped approach; It's a function - you can easily maintain your "money" code... ===
      How to install:
      It's actually very easy: practical example is the best way to explain, what needs to be done - see repo structure and files.
      Source files are available at Github repo (specific usage example included!). You can download them from here.
      ===
      How to use it:
      = General usage:
      // [_player,_amount,_action,_target] call fnc_SC_uniCoins; // '_player' : object : player, _killer...etc // '_amount' : number : 1000 // '_action' : string : 'add' / 'remove' // '_target' : string : 'cache' / 'bank' // ========================================================== // @example 01: Remove 5.000 Coins from player's wallet: [player,5000,'remove','cache'] call fnc_SC_uniCoins; // @example 02: Add 1.000 Coins to player's wallet: [player,1000,'add','cache'] call fnc_SC_uniCoins; // @example 03: Remove 7.000 Coins from player's bank account: [player,7000,'remove','bank'] call fnc_SC_uniCoins; // @example 04: Add 15.000 Coins to player's bank account: [player,15000,'add','bank'] call fnc_SC_uniCoins; ===
      ...easy enough, isn't it?
      ===
      = Specific usage (with detailed description):
      // === Scenario: // Award player for killing local zombies. // If player kills zombie, he will receive random amount of money from 0 to 250 Coins for kill. // Let's make it interesting - player receive money only in case he used the gun defined by you: // === What to do: // Save file "local_eventKill.sqf" to your custom compiles folder, load it in your custom compiles file // outside (!isDedicated) and (isServer) - we need this file for both client and server. // (it's in 'dayz_code' folder: you can download file from: // https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_code/compile/local_eventKill.sqf) // Open your custom variables file (or add bellow code to your init.sqf file) and add: playerZedKillAward = true; // ... so you can quickly turn ON/OFF your script // Now, let's create some code in 'local_eventKill.sqf' file: if (local _zed) then { private["_killer","_fnc_uniCoinsTest","_allowedWps"]; // code // ...find last line of code: _killer setVariable["humanity",_humanity,true]; // Bellow we define local function "_fnc_killZedsAward" so we can call it easily: // === _fnc_killZedsAward = { private ["_action","_target","_money","_curWep"]; _action = _this select 0; // @info: we take parameter from call in main code bellow this fnc and assign value to local var _target = _this select 1; // @info: we take parameter from call in main code bellow this fnc and assign value to local var _money = (round(random 5) * 50); // @info: now from 0 to 250 Coins, define to your liking _curWep = getText (configFile >> 'CfgWeapons' >> currentWeapon _killer >> 'displayName'); // @info: What's the name of player current weapon? We need this for info in hint or dayz_rollingMessages call { // Player has 20% chance to get 0 coins from random (if you will use round(random 5) - meaning staying with 5, scale from 0 to 4) // So let's check it first and prevent display msg on screen in such a case if (_money == 0) exitWith { //@info: You can pick 'dayz_rollingMessages' and comment 'hintSilent' if your hint layer is occupied by your debug monitor ["Sorry, our bank is low on money!"] call dayz_rollingMessages; hintSilent "Sorry, our bank is low on money!"; }; // If random money are above zero, let's call dev fnc_SC_uniCoins. // First parameter '_killer' is defined by original code; _money param was defined above, // _action and _target parameters we defined in main code bellow... if ([_killer,_money,_action,_target] call fnc_SC_uniCoins) exitWith { //@info: You can pick 'dayz_rollingMessages' and comment 'hintSilent' if your hint layer is occupied by your debug monitor hintSilent format ["Zed kill award!\nweapon: [%1]\nReceived: [%2 %3]",_curWep,_money,CurrencyName]; [format["Zed kill award! Weapon: [%1] Received: [%2 %3]",_curWep,_money,CurrencyName]] call dayz_rollingMessages; }; // Do not put any default code for call here - if you do, you will trigger code action in cases, // like zombie is killed close to you by some accident (from experience) }; }; // Now let's create main procedure: if (playerZedKillAward) then { // @info: define your custom array of weapons here: _allowedWps = [ 'M110_NVG_EP1', 'M9_SD_DZ','DMR_DZ', 'M9_DZ' ]; if ((currentWeapon _killer) in _allowedWps) exitWith { // @info: if player used allowed weapon, tell '_fnc_killZedsAward', what to do with money. // You can be creative here :)) ["add","cache"] call _fnc_killZedsAward; }; }; }; // === Done! ===
      ...that's all, you can use it wherever money are... Have Fun!!
      Cheers...
      ===
    • By Hetza
      I am currently willing to pay someone if they would be able to set my up a good militarized namalsk overpoch server config and give me a brief run down on how to edit things of my liking e.g. adding extra addons like a coin and bank system and so on.
    • By harcosgoogle
      hi!
      How to add new hpp file,new trader,new items (No wepaons,no truck)
      Static guns trader
       
      Thanks
       
      Im created trader,activated server_trader.sqf,activate mysql,cfgservertrader,napf. Not worked :/
       
      , Not loading Trader menu,
      Does not produce

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...