Jump to content

Recommended Posts

This is a major glitch in giving players money. When both players have equal amount of money, and they give money to each other at the same time. The money duplicates. Then Use the duplicated money to dupe again, then it double duplicates. Keep going to be a millionaire in seconds

 

Lets say i got 500, you got 500. We both give our 500 coins to each other at the same time. It duplicates

 

There is an easy fix:

 

In your Gold/init.sqf

 

Find:

GivePlayerAmount = {
..
..
..
..
};

Replace the whole block with this:

GivePlayerAmount = {
private ["_amount","_target","_wealth"];
_amount = parseNumber (_this select 0);
_target = cursorTarget;
_wealth = player getVariable["cashMoney",0];
_twealth = _target getVariable["cashMoney",0];
_InTrd = _target getVariable ["TrBsy",false];
_isMan = _target isKindOf "Man";
if (_amount < 1 or _amount > _wealth) exitWith {
cutText ["You can not give more than you currently have.", "PLAIN DOWN"];
};
if (!_isMan) exitWith {
cutText ["You are not facing anyone.", "PLAIN DOWN"];
};
if (_InTrd) exitWith {
cutText ["Other Player is busy, please wait.", "PLAIN DOWN"];
};
PVDZE_account_Doublecheck = [player];
publicVariableServer "PVDZE_account_Doublecheck";
player setVariable["cashMoney",_wealth - _amount, true];
_target setVariable["cashMoney",_twealth + _amount, true];


PVDZE_plr_Save = [player,(magazines player),true,true] ;
publicVariableServer "PVDZE_plr_Save";
PVDZE_plr_Save = [_target,(magazines _target),true,true] ;
publicVariableServer "PVDZE_plr_Save";


cutText [format["You gave %1 %2.", _amount, CurrencyName], "PLAIN DOWN"];
};

Now Replace your bank_dialog.sqf and give_player_dialog.sqf with these: 

 

bank_dialog.sqf

private ["_dialog"];
player setVariable["TrBsy",true,0];
_dialog = createdialog "BankDialog";
call BankDialogUpdateAmounts;
waitUntil { !dialog };
uiSleep 3;
player setVariable ["TrBsy",false,0];

give_player_dialog.sqf

private ["_dialog"];player setVariable["TrBsy",true,0];
_dialog = createdialog "GivePlayerDialog";
call GivePlayerDialogAmounts;
waitUntil { !dialog };
uiSleep 3;
player setVariable ["TrBsy",false,0];

Share this post


Link to post
Share on other sites

So this only works if both sides have the exact same amount of money? I don't get it.. Where's the logic behind this?

 

Lets say i got 500, you got 500. We both give our 500 coins to each other at the same time. It duplicates

Share this post


Link to post
Share on other sites

Lets say i got 500, you got 500. We both give our 500 coins to each other at the same time. It duplicates

 

No yeah I understand that but what's the logic behind this glitch? I mean why the same amount. If this really works it should work with any number amount of coins, wouldn't it?

Share this post


Link to post
Share on other sites

No yeah I understand that but what's the logic behind this glitch? I mean why the same amount. If this really works it should work with any number amount of coins, wouldn't it?

 

Dunno the logic, maybe it works with different numbers too 0.o

Share this post


Link to post
Share on other sites

it seems at least on my test server if both players trade at the same time the money is added together and given to both people.  Example is if I have 200 coins and my friend has 500 coins.  We both select give coins to each other and give our full amount.  If we both select the Give option we both end up with 700 coins.  Waiting to test this on my live server to see if the behavior is the same.  I could have sworn I tested this earlier and it did not do this.  The same amount however is fixed using the above.

Share this post


Link to post
Share on other sites

it seems at least on my test server if both players trade at the same time the money is added together and given to both people.  Example is if I have 200 coins and my friend has 500 coins.  We both select give coins to each other and give our full amount.  If we both select the Give option we both end up with 700 coins.  Waiting to test this on my live server to see if the behavior is the same.  I could have sworn I tested this earlier and it did not do this.  The same amount however is fixed using the above.

 

I have yet to find out how we can possibly fix that issue. 

Share this post


Link to post
Share on other sites

What if you tried....

GivePlayerAmount = {

    private ["_amount","_target","_wealth"];

    player setVariable ["TrBsy",true,0];

    _InTrd = _target getVariable ["TrBsy",0];

    _amount = parseNumber (_this select 0);

    _target = cursorTarget;

    _wealth = player getVariable["cashMoney",0];

    _twealth = _target getVariable["cashMoney",0];

    _isMan = _target isKindOf "Man";

    if (_amount < 1 or _amount > _wealth) exitWith {

        cutText ["You can not give more than you currently have.", "PLAIN DOWN"];

    };

    if (!_isMan) exitWith {

        cutText ["You are not facing anyone.", "PLAIN DOWN"];

    };

    if (_wealth == _twealth) exitWith {

        cutText ["FAILED : Both Targets have same amount of money.", "PLAIN DOWN"];

    };

    if (_InTrd) exitWith {

        cutText ["Player is busy, please wait.", "PLAIN DOWN"];

    };

    PVDZE_account_Doublecheck = [player];

    publicVariableServer "PVDZE_account_Doublecheck";

    player setVariable["cashMoney",_wealth - _amount, true];
   
    _target setVariable["cashMoney",_twealth + _amount, true];



    PVDZE_plr_Save = [player,(magazines player),true,true] ;

    publicVariableServer "PVDZE_plr_Save";

    PVDZE_plr_Save = [_target,(magazines _target),true,true] ;

    publicVariableServer "PVDZE_plr_Save";



    cutText [format["You gave %1 %2.", _amount, CurrencyName], "PLAIN DOWN"];

    uiSleep 3;

    player setVariable ["TrBsy",false,0];

};

 

Haven't tested it yet.

 

-edit-

Most likely wont work, but what I was thinking was, setting a variable to the player when they open the give money dialog, and remove it a few seconds after it closes. If the variable is true, then it prevents the other person from trading with them until the dialog is closed.

 

-edit 2-

You might try changing... give_player_dialog.sqf to look like...

 

 
private ["_dialog"];
 
player setVariable ["TrBsy",true,0];
_dialog = createdialog "GivePlayerDialog";

call GivePlayerDialogAmounts;
waitUntil { !dialog };
uiSleep3;
player setVariable ["TrBsy",false,0];

 

then remove... both >>player setVariable ["TrBsy",true,0];<< and >>player setVariable ["TrBsy",false,0];<< from the previous script in this reply

 

Will try testing it when I can.

Share this post


Link to post
Share on other sites

Thanks for the idea, 

 

I have fixed the code, tested

 

Init.sqf

GivePlayerAmount = {
private ["_amount","_target","_wealth"];
_amount = parseNumber (_this select 0);
_target = cursorTarget;
_wealth = player getVariable["cashMoney",0];
_twealth = _target getVariable["cashMoney",0];
_InTrd = _target getVariable ["TrBsy",false];
_isMan = _target isKindOf "Man";
if (_amount < 1 or _amount > _wealth) exitWith {
cutText ["You can not give more than you currently have.", "PLAIN DOWN"];
};
if (!_isMan) exitWith {
cutText ["You are not facing anyone.", "PLAIN DOWN"];
};
if (_wealth == _twealth) exitWith {
cutText ["FAILED : Both Targets have same amount of money.", "PLAIN DOWN"];
};
if (_InTrd) exitWith {
        cutText ["Other Player is busy, please wait.", "PLAIN DOWN"];
    };
PVDZE_account_Doublecheck = [player];
publicVariableServer "PVDZE_account_Doublecheck";
player setVariable["cashMoney",_wealth - _amount, true];
_target setVariable["cashMoney",_twealth + _amount, true];


PVDZE_plr_Save = [player,(magazines player),true,true] ;
publicVariableServer "PVDZE_plr_Save";
PVDZE_plr_Save = [_target,(magazines _target),true,true] ;
publicVariableServer "PVDZE_plr_Save";


cutText [format["You gave %1 %2.", _amount, CurrencyName], "PLAIN DOWN"];
};

bank_dialog.sqf

private ["_dialog"];
player setVariable["TrBsy",true,0];
_dialog = createdialog "BankDialog";
call BankDialogUpdateAmounts;
waitUntil { !dialog };
uiSleep 3;
player setVariable ["TrBsy",false,0];

give_player_dialog.sqf

private ["_dialog"];player setVariable["TrBsy",true,0];
_dialog = createdialog "GivePlayerDialog";
call GivePlayerDialogAmounts;
waitUntil { !dialog };
uiSleep 3;
player setVariable ["TrBsy",false,0];

Share this post


Link to post
Share on other sites

Awesome Gr8 (Also, thanks for fixing up my typos)! but why do you attach it to the bank dialog too?

 

Also, you could remove the...

if (_wealth == _twealth) exitWith {
cutText ["FAILED : Both Targets have same amount of money.", "PLAIN DOWN"];
};

 

Since it's already covered with the variable.

Share this post


Link to post
Share on other sites

Very nice :)

 

Do I have to replace all code for bank_dialog.sqf and give_player_dialog.sqf?

Or do I have to insert this code between the existing somehow?

 

Yes, replace this code with your bank_dialog.sqf and give_player_dialog.sqf

Share this post


Link to post
Share on other sites

When I do so, the amount of money is not displayed anymore in any items which can hold coins.

 

Thats shouldnt be happening. Are you using 3.0 ZSC ?

Share this post


Link to post
Share on other sites

If you can...revert to original  bank_dialog.sqf and give_player_dialog.sqf

Then please post the contents of both files.

 

Here we go:

 

bank_dialog.sqf

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_10") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

private ["_dialog"];
ZSC_CurrentStorage = _this select 3;
_dialog = createDialog "BankDialog";
call BankDialogUpdateAmounts;

DZE_ActionInProgress = false;

 

give_player_dialog.sqf

private ["_dialog"];
ZSC_GiveMoneyTarget = cursorTarget;
if( isPlayer ZSC_GiveMoneyTarget)then{
_dialog = createdialog "GivePlayerDialog";
call GivePlayerDialogAmounts;
}else{
systemChat format["You are not looking correctly at a player"];
};

Share this post


Link to post
Share on other sites

Untested.

 

Change Bank Dialog to....

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_10") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
player setVariable["TrBsy",true,0];

private ["_dialog"];
ZSC_CurrentStorage = _this select 3;
_dialog = createDialog "BankDialog";
call BankDialogUpdateAmounts;

DZE_ActionInProgress = false;
uiSleep 3;
player setVariable["TrBsy",false,0];

and give_Player to....

private ["_dialog"];
player setVariable["TrBsy",true,0];
uiSleep 1;
ZSC_GiveMoneyTarget = cursorTarget;
if( isPlayer ZSC_GiveMoneyTarget)then{
_dialog = createdialog "GivePlayerDialog";
call GivePlayerDialogAmounts;
}else{
systemChat format["You are not looking correctly at a player"];
};
uiSleep 3;
player setVariable["TrBsy",false,0];

Share this post


Link to post
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

  • Similar Content

    • By Tricks
      We are back! Ranked 7th overall in 2014! Classic DayZ Epoch PvP Server!! No stupid start bonus, no heavy military. Just classic Epoch gameplay with new updates!

       
      - Top of the Line Hardware - Overclocked 8700k servers with SSDs. Super high FPS!!

      - XP System & XP Trader - Acquire handy Perks, Skills, and Permits with our XP system!

      - Custom Traders - Totally custom traders unique to this server!

      - Military Bases - High Loot areas perfect for gearing up.

      - Custom Map Content - Aircraft Carriers, Secret Military Bases, New Towns, and more!

      - All The Major Mods - All the major mods like Coin System, Heli Evac, Hide from Zeds, and many more.

      - Lots of AI Missions - Challenging AI missions color-coded by difficulty.

      - Custom AI Missions for Groups - Static missions with super high difficulty and major loot rewards!

      - Realistic Loot Spawns - You wont find high-powered weapons while hunting for loot, realistic loot spawns.

      - No Heavy Weapons, Tanks, Attack Choppers, Jets - Just the classic Epoch vehicles with a few new additions!

      - Lots of Vehicles - Lots of vehicles scattered around the map. Some are ready to go, others need to be fixed first!

      - Base Building - Fully modular base building system with unique build items and crafting recipes.

      - Full Day/Night Cycle - Realistic day and night cycle, no stupid 24 hours daylight!!

      - Full Weather System - Rain, thunderstorms and snow in the winter!!

      - Destructible Base/Garage Doors - Base raiding without losing your whole base! Just the doors are destructible.

      - Abandoned Safes/Lockboxes - Abandoned bases will have their safes unlocked for you to raid!!

      - Fresh Server, All The Best Base Locations Still Available! - No more wipes, server is done and all progress will be saved.

      - Regular Updates/Suggestions Considered - Pass along ideas to the admin staff. We consider all changes.

      - Admin Events - Events with High Loot and great times! See pic below.

      - Active Admin Staff - Find us on Discord anytime or by email!





      Connect to us on DayZ Launcher or directly:

      [SHG]ClassicEpoch|XPSystem|CustomTraders|CustomAImissions|Coins|FPS++

      144.217.62.76:2302

      Discord: http://xn--discrd-zxa.com/join.php?v=OXHD95

      Email: [email protected]

      Website: Under construction


    • By JakeQue
      Hi, me again.
       
      For some reason when i spawn in and collect coins or loadout the next time i disconnect and come back it puts me back into spawn and money is all disappeared. 

      There's no hive errors.
      The only error in the Server RPT is :
      And I have 2 errors in my client RPT. Looks like they relate to zsc but I have reinstalled it from scratch and still the same.
      and 
       
      Sorry to be such a noob with this one!!
    • By xTimeToShine
      Hey guys,
      i'm proud to present our new "Epic Illusion Gaming - DayZ Overpoch server".
       
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
      [EIG] DayZ Overpoch | Chernarus | 1.0.6.2 | Coins | Lift | Groups | Missions | Events | Deploy Bike |
      IP: 94.250.209.139:2302
       
      We are searching for some Players and also for some Admins. Please visit our Server or come to our Teamspeak or Discrod.
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       
      Visit us on ...
      ...Teamspeak:  94.250.223.10:15111
      ...Discord:  https://discord.gg/MTQuUHP
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Our new special features:
      Global Coins System Deploy a bike (Toolbox) Lift & Tow Selfbloodbagging Groupsystem Virtual Garage AI Missions Special PVP Events Custom Loadout ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Upcoming features:
      Weaponswitch Enhanced Spawn Selection and much more...  
    • By Vladick
      BSBS Server IP: 207.244.146.179
      Website: https://bsbsepoch.000webhostapp.com/
      Discord: https://discord.gg/PVn8PvG
      Server Features:
      PvPvE Database wiped 1/5/18 ESS V3 spawn selection Coins and Global Banking WAI missions and Roaming DZAI Bandits Customized map additions Skalisky Bridge Skalisky Island Bandit Camp with high loot (fun mission!) Garage Door Opener Virtual Garage Deploy bike Refuel, Repair, Rearm Take clothes Bury Body Butcher Body Locate vehicle with keys and GPS One plot poll per player Indestructible bases Trader Safe Zones Day/Night Schedule 4-hour restarts
  • Advertisement
  • Advertisement
  • Supporters
  • Advertisement
  • Discord

×