Gr8 Posted October 30, 2014 Report Share Posted October 30, 2014 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]; Proximus 1 Link to comment Share on other sites More sharing options...
Tanita-Corp Posted October 30, 2014 Report Share Posted October 30, 2014 nice fix Link to comment Share on other sites More sharing options...
Rocu Posted October 30, 2014 Report Share Posted October 30, 2014 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? Link to comment Share on other sites More sharing options...
Gr8 Posted October 31, 2014 Author Report Share Posted October 31, 2014 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 Link to comment Share on other sites More sharing options...
Rocu Posted October 31, 2014 Report Share Posted October 31, 2014 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? Link to comment Share on other sites More sharing options...
Gr8 Posted November 1, 2014 Author Report Share Posted November 1, 2014 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 Link to comment Share on other sites More sharing options...
Proximus Posted November 1, 2014 Report Share Posted November 1, 2014 Thanks for this! Link to comment Share on other sites More sharing options...
Slimdickens Posted March 30, 2015 Report Share Posted March 30, 2015 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. Link to comment Share on other sites More sharing options...
Gr8 Posted March 30, 2015 Author Report Share Posted March 30, 2015 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. Link to comment Share on other sites More sharing options...
Coda Posted April 10, 2015 Report Share Posted April 10, 2015 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. Link to comment Share on other sites More sharing options...
Gr8 Posted April 10, 2015 Author Report Share Posted April 10, 2015 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]; Link to comment Share on other sites More sharing options...
Coda Posted April 10, 2015 Report Share Posted April 10, 2015 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. Link to comment Share on other sites More sharing options...
Gr8 Posted April 10, 2015 Author Report Share Posted April 10, 2015 depositing in banks while a player is giving u coins ends up in the same result. thanks for pointing the exitWith Link to comment Share on other sites More sharing options...
Stollenwerk Posted April 10, 2015 Report Share Posted April 10, 2015 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? Link to comment Share on other sites More sharing options...
Gr8 Posted April 10, 2015 Author Report Share Posted April 10, 2015 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 Link to comment Share on other sites More sharing options...
Gr8 Posted April 10, 2015 Author Report Share Posted April 10, 2015 OP Updated.. Link to comment Share on other sites More sharing options...
Stollenwerk Posted April 11, 2015 Report Share Posted April 11, 2015 Yes, replace this code with your bank_dialog.sqf and give_player_dialog.sqf When I do so, the amount of money is not displayed anymore in any items which can hold coins. Link to comment Share on other sites More sharing options...
Gr8 Posted April 11, 2015 Author Report Share Posted April 11, 2015 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 ? Link to comment Share on other sites More sharing options...
Stollenwerk Posted April 11, 2015 Report Share Posted April 11, 2015 Yes I do. Link to comment Share on other sites More sharing options...
Coda Posted April 11, 2015 Report Share Posted April 11, 2015 Yes I do. If you can...revert to original bank_dialog.sqf and give_player_dialog.sqf Then please post the contents of both files. Link to comment Share on other sites More sharing options...
Stollenwerk Posted April 11, 2015 Report Share Posted April 11, 2015 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"]; }; Link to comment Share on other sites More sharing options...
Coda Posted April 11, 2015 Report Share Posted April 11, 2015 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]; Link to comment Share on other sites More sharing options...
Gr8 Posted April 11, 2015 Author Report Share Posted April 11, 2015 test Link to comment Share on other sites More sharing options...
Stollenwerk Posted April 11, 2015 Report Share Posted April 11, 2015 test Thank you, that works! ;) Link to comment Share on other sites More sharing options...
Gr8 Posted April 11, 2015 Author Report Share Posted April 11, 2015 The variables are out of order and not resist Duping. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now