mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Take Crypto tweak
This commit is contained in:
parent
b0ae47ffe7
commit
84d071f1fd
@ -1,17 +1,27 @@
|
|||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[cog import generate_private_arrays ]]]
|
||||||
private ["_getCrypto"];
|
private ["_nearCrypto","_CryptoItems","_getCrypto","_addmoney"];
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
if !(isNil "EPOCH_takeCryptoLock") exitWith {};
|
if !(isNil "EPOCH_takeCryptoLock") exitWith {};
|
||||||
EPOCH_takeCryptoLock = true;
|
EPOCH_takeCryptoLock = true;
|
||||||
if (!isNull _this) then {
|
_nearCrypto = (nearestobjects [player,[],5]) select {(_x getvariable ["Crypto",0]) > 0};
|
||||||
_getCrypto = _this getVariable["Crypto", 0];
|
_CryptoItems = [];
|
||||||
if (_getCrypto > 0) then {
|
_getCrypto = 0;
|
||||||
[player, Epoch_personalToken, _this] remoteExec ["EPOCH_server_takeCrypto",2];
|
{
|
||||||
[format["You found %1 Crypto", _getCrypto], 5] call Epoch_message;
|
_addmoney = (_x getvariable ['Crypto',0]);
|
||||||
} else {
|
if (_addmoney > 0) then {
|
||||||
["No Crypto found", 5] call Epoch_message;
|
_CryptoItems pushback _x;
|
||||||
};
|
};
|
||||||
|
_getCrypto = _getCrypto + _addmoney;
|
||||||
|
} foreach _nearCrypto;
|
||||||
|
|
||||||
|
if (_getCrypto > 0) then {
|
||||||
|
[player, Epoch_personalToken, _CryptoItems] remoteExec ["EPOCH_server_takeCrypto",2];
|
||||||
|
[format['You found %1 Crypto', _getCrypto], 5] call Epoch_message;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
['No Crypto found', 5] call Epoch_message;
|
||||||
};
|
};
|
||||||
|
|
||||||
[] spawn{
|
[] spawn{
|
||||||
uiSleep 2;
|
uiSleep 2;
|
||||||
EPOCH_takeCryptoLock = nil;
|
EPOCH_takeCryptoLock = nil;
|
||||||
|
@ -78,7 +78,7 @@ class tra_shop
|
|||||||
|
|
||||||
class player_takeCrypto
|
class player_takeCrypto
|
||||||
{
|
{
|
||||||
condition = "dyna_isDeadPlayer || (dyna_cursorTarget getVariable [""Crypto"",0]) > 0";
|
condition = "dyna_isDeadPlayer || !(((nearestobjects [player,[],5]) select {(_x getvariable ['Crypto',0]) > 0}) isEqualTo [])";
|
||||||
action = "dyna_cursorTarget call EPOCH_takeCrypto;";
|
action = "dyna_cursorTarget call EPOCH_takeCrypto;";
|
||||||
icon = "x\addons\a3_epoch_code\Data\UI\buttons\krypto.paa";
|
icon = "x\addons\a3_epoch_code\Data\UI\buttons\krypto.paa";
|
||||||
tooltip = "Take Crypto";
|
tooltip = "Take Crypto";
|
||||||
|
@ -15,21 +15,21 @@
|
|||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[cog import generate_private_arrays ]]]
|
||||||
private ["_getCrypto"];
|
private ["_getCrypto"];
|
||||||
//[[[end]]]
|
//[[[end]]]
|
||||||
params ["_player",["_token","",[""]],"_object"];
|
params ["_player",["_token","",[""]],["_CryptoItems",[]]];
|
||||||
|
|
||||||
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
if !([_player,_token] call EPOCH_server_getPToken) exitWith {};
|
||||||
if (isNull _object) exitWith {};
|
|
||||||
if (_player distance _object > 10) exitWith {};
|
|
||||||
|
|
||||||
_getCrypto = _object getVariable["Crypto", 0];
|
_getCrypto = 0;
|
||||||
if (_getCrypto > 0) then {
|
{
|
||||||
// remove crypto from object
|
if (_player distance _x < 10) then {
|
||||||
_object setVariable["Crypto", nil, true];
|
_getCrypto = _getCrypto + (_x getVariable ["Crypto", 0]);
|
||||||
if (_object getvariable ["RemoveOnTake",false]) then {
|
_x setVariable ["Crypto", nil, true];
|
||||||
deletevehicle _object;
|
if (_x getvariable ["RemoveOnTake",false]) then {
|
||||||
|
deletevehicle _x;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
// send data back to player
|
} foreach _CryptoItems;
|
||||||
|
if (_getCrypto > 0) then {
|
||||||
[_player,_getCrypto] call EPOCH_server_effectCrypto;
|
[_player,_getCrypto] call EPOCH_server_effectCrypto;
|
||||||
// debug and logging.
|
diag_log format["Epoch: ADMIN: %1 picked up %2 Crypto at %3", getPlayerUID _player, _getCrypto, getposATL _player];
|
||||||
diag_log format["Epoch: ADMIN: %1 picked up %2 Crypto from object %3 with puid %4 at %5", getPlayerUID _player, _getCrypto, [_object, typeOf _object],_object getVariable['PUID', ''],getposATL _object];
|
};
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user