Jump to content

[PROJECT] Gold Coin based Single Currency & Banking System


Recommended Posts

I have a custom Gem trader on my servers, problem now is that it is displaying coins as the prices instead of the gems..

Any way to get that to still work? :)

 

Edit; Any way to get vehicles purchased to spawn LOCKED instead of unlocked? 

Link to comment
Share on other sites

I have a custom Gem trader on my servers, problem now is that it is displaying coins as the prices instead of the gems..

Any way to get that to still work? :)

Edit; Any way to get vehicles purchased to spawn LOCKED instead of unlocked?

They should spawn locked already.

Also for the traders you would need to modify a lot of zupa's code.

Link to comment
Share on other sites

might be a good thing to check if player input is an integer value and nothing else.

 

here use this function zupa.

KRON_StrToArray =
{
    private["_in","_i","_arr","_out"];
    _in=_this select 0;
    _arr = toArray(_in);
    _out=[];
    for "_i" from 0 to (count _arr)-1 do {_out=_out+[toString([_arr select _i])];};
    _out
};
fnc_isnumber =
{
    private["_valid","_value","_compare"];
    _value = _this select 0;
    _valid = ["0","1","2","3","4","5","6","7","8","9"];
    _array = [_value] call KRON_StrToArray;
    _return = true;    
    {
        if(_x in _valid) then {} else {_return = false;};
    } foreach _array;
    _return
};

On a side note, you might want to use pvs/pvc methods to do the actual hive read/writes server side.

Having that in your mission pbo is utterly dangereous considering where already using the hiveext with 999 methods.

Link to comment
Share on other sites

Here is how to get the commas in trader menus, bank dialogs, give player dialog and hud.

If you don't already have bis_fns number already take a look at this: 

If you have already done this part then do this part

 

Open up init.sqf in your mpmissions main file

Add this

coins							= "Coins";

Above

DZE_ConfigTrader 				= true;

Next open up the gold folder

Replace gold\init.sqf with this one

https://github.com/UPGStorm/Customs/blob/master/gold/init.sqf

 

Replace gold\player_traderMenu.sqf with this one

https://github.com/UPGStorm/Customs/blob/master/gold/player_traderMenu.sqf

 

Next open up addons\PlayerHud\playerHud.sqf

Replace

AsReMixhud_headshots,//3

with

[AsReMixhud_headshots] call BIS_fnc_numberText,

That is it, all done.

 

 

If you want a comma on the bank balance 

[Zupa_bank] call BIS_fnc_numberText,
Link to comment
Share on other sites

I have no scroll option at banks.

 

I used the supplied fnselfactions and all the other ones for that matter. I have the thing saying the amount of coins.

 

I run infistar antihack on the server. I put all three bank dialogs in the approved list.

 

I have gone over every inch of code and I just can't figure it out. 

 

Any help would be appreciated.

Link to comment
Share on other sites

@Zupa:

 

Why do you have this in trade_items.sqf

cid =	player getVariable ["CharacterID","0"];
_headShotsZupa = player getVariable ["headShots",0];
_key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_cid];
_result = _key call server_hiveReadWrite;

While right above it you already tell the server to sync the characters information with

PVDZE_plr_Save = [player,(magazines player),true,true] ;
publicVariableServer "PVDZE_plr_Save";
Link to comment
Share on other sites

I have no scroll option at banks.

 

I used the supplied fnselfactions and all the other ones for that matter. I have the thing saying the amount of coins.

 

I run infistar antihack on the server. I put all three bank dialogs in the approved list.

 

I have gone over every inch of code and I just can't figure it out. 

 

Any help would be appreciated.

Take look at this:
Link to comment
Share on other sites

I have a custom Gem trader on my servers, problem now is that it is displaying coins as the prices instead of the gems..

Any way to get that to still work? :)

 

Edit; Any way to get vehicles purchased to spawn LOCKED instead of unlocked? 

I still seem to only get purchased vehicles to spawn unlocked.. Any fix for it?

Link to comment
Share on other sites

i have pinned the gold duping to trade_items.sqf

 

btw if anyone cares to know

CCG doesnt use the hiveext with 999 calls

they piggy back on the inventory field, added a 4th array element that holds the cash money as integer.

then it comes down to editing the inventory saving in player_sync.sqf server sided so that it stores the inventory array with the 4th element for cash currency.

player_setup reads the cash back by calling the 4th array index of the inventory array... as for bank money its probably similar by using one of the unused fields

in the player_data table.

Link to comment
Share on other sites

i have pinned the gold duping to trade_items.sqf

 

It was for some reason doing the same operation twice thus doubling the gold for each item sold to traders.

You can try the trade_items.sqf in the spoiler, not fully tested but the duping bug is fixed with it.


 

btw if anyone cares to know

CCG doesnt use the hiveext with 999 calls

they piggy back on the inventory field, added a 4th array element that holds the cash money as integer.

then it comes down to editing the inventory saving in player_sync.sqf server sided so that it stores the inventory array with the 4th element for cash currency.

player_setup reads the cash back by calling the 4th array index of the inventory array... as for bank money its probably similar by using one of the unused fields

in the player_data table.

 

hmm ya could be the problem ya. my bad

Link to comment
Share on other sites

 

 

they piggy back on the inventory field, added a 4th array element that holds the cash money as integer.

 

 

Thats how i make newer scripts ^^ 

 

This money system ( the backbone) is made a year ago ^^. But nevertheless. 

 

the  player_data is the harder part ^^

Link to comment
Share on other sites

I can easily reproduce the coin duplication bug. Anytime you receive money in your personal inventory and immediately logout and come back in, you will double the amount just given. For example:

 

  1. I have 10k on my character and 50k in the bank.
  2. I take out 2k from bank and hit esc and logout to lobby and come right back in.
  3. I now have 48k in the bank and 14k on me.

The same works for looting from a wallet.

 

I see this error in the client logs.

 

player removeAction s_givemoney_dialog;
s_givemoney_dialog =>
  Error position: <s_givemoney_dialog;
s_givemoney_dialog =>
  Error Undefined variable in expression: s_givemoney_dialog
File mpmissions\__CUR_MP.Chernarus\compile\fn_selfActions.sqf, line 972

 

 

Here's that block of code:

		// Zupa - SC - reset.
	player removeAction s_givemoney_dialog;
	s_givemoney_dialog = -1;
	player removeAction s_bank_dialog;
	s_bank_dialog = -1;
	player removeAction s_bank_dialog2;
	s_bank_dialog2 = -1;
	player removeAction s_player_packOBJ;
	s_player_packOBJ = -1;


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...