Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. /**
  2. * ExileServer_system_locker_network_lockerDepositRequest
  3. *
  4. * Exile Mod
  5. * www.exilemod.com
  6. * © 2015 Exile Mod Team
  7. *
  8. * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  9. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10. */
  11.  
  12. private["_sessionID", "_parameters", "_deposit", "_player", "_depositAmount", "_playerMoney", "_lockerLimit", "_lockerAmount", "_newLockerAmount", "_newPlayerMoney"];
  13. _sessionID = _this select 0;
  14. _parameters = _this select 1;
  15. _deposit = _parameters select 0;
  16. try
  17. {
  18. _player = _sessionID call ExileServer_system_session_getPlayerObject;
  19. if (isNull _player) then
  20. {
  21. throw "Null player";
  22. };
  23. if !(alive _player) then
  24. {
  25. throw "Dead player";
  26. };
  27. _depositAmount = parseNumber _deposit;
  28. _playerMoney = _player getVariable ["ExileMoney",0];
  29.  
  30.  
  31. if (_playerMoney < _depositAmount) then
  32. {
  33. throw "Not enough pop tabs";
  34. };
  35.  
  36. _lockerAmount = _player getVariable ["ExileLocker", 0];
  37. _newLockerAmount = _depositAmount + _lockerAmount;
  38. _lockerLimit = _player getVariable ["ExileLocker", 0];
  39.  
  40.  
  41.  
  42.  
  43.  
  44. _player setVariable ["ExileLocker", _newLockerAmount, true];
  45. format["updateLocker:%1:%2", _newLockerAmount, getPlayerUID _player] call ExileServer_system_database_query_fireAndForget;
  46. _newPlayerMoney = _playerMoney - _depositAmount;
  47. _player setVariable ["ExileMoney", _newPlayerMoney, true];
  48. format["setPlayerMoney:%1:%2", _newPlayerMoney, _player getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
  49. [_sessionID, "toastRequest", ["SuccessTitleOnly", ["Deposited!"]]] call ExileServer_system_network_send_to;
  50. [_sessionID, "lockerResponse", []] call ExileServer_system_network_send_to;
  51. }
  52. catch
  53. {
  54. _exception call ExileServer_util_log;
  55. };
  56. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement