Defuse Bomb / Itemdisplayname

Moving "Epoch_Itemdisplayname" also to server will rename it to "EPOCH_fnc_Itemdisplayname", so we now only link to the new function.
Means, that you can now use:
Client side:
"EPOCH_Itemdisplayname" or "EPOCH_fnc_Itemdisplayname"
Server side:
"EPOCH_fnc_Itemdisplayname"
So no eventually third-party scripts will take effect.
This commit is contained in:
He-Man 2019-01-11 15:32:00 +01:00
parent b2957de2a2
commit 2ef6790a8f
6 changed files with 77 additions and 5 deletions

View File

@ -12,9 +12,7 @@ if (alive player && !isnull _object) then {
if !(_reward isequalto "") then {
_chance = ["CfgEpochClient", "DefuseBombChance", 0.4] call EPOCH_fnc_returnConfigEntryV2;
if (_chance >= ((random 100) / 100)) then {
deletevehicle _object;
_reward call EPOCH_fnc_addItemOverflow;
[format ['Sucessfully defused %1 - You have it now in your Inventory',_reward call Epoch_ItemDisplayName],5] call Epoch_Message;
[_object,false,player,Epoch_personalToken] remoteexec ["EPOCH_server_DefuseBomb",2];
}
else {
['Oh No... The Bomb will explode in a few seconds... RUN!!!!',5] call Epoch_Message;
@ -22,8 +20,7 @@ if (alive player && !isnull _object) then {
playSound3D ['a3\sounds_f\air\heli_attack_02\alarm.wss', player, false,getposasl _object, 1, 1, 300];
uisleep 1;
};
'HelicopterExploSmall' createVehicle (position _object);
deletevehicle _object;
[_object,true,player,Epoch_personalToken] remoteexec ["EPOCH_server_DefuseBomb",2];
};
}
else {

View File

@ -0,0 +1,26 @@
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Returns the DisplayName of a Vehicle, Weapon, or Magazine.
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_itemDisplayName.sqf
Example:
_displayName = _part call EPOCH_itemDisplayName;
Parameter(s):
_this: STRING - Vehicle, Weapon, or Magazine config class name
Returns:
STRING
*/
// Changed function name for usage Server and Client side
_this call EPOCH_fnc_itemDisplayName;

View File

@ -144,6 +144,7 @@ class CfgClientFunctions
class fnc_addMagazineOverflow {};
class itemData {};
class itemPicture {};
class itemDisplayName {};
class SortArrayByDistance {};
class fnc_findRandomPosBehind {};
class fnc_stringLeft {};

View File

@ -345,6 +345,11 @@ class CfgRemoteExec
{
allowedTargets = 2;
jip = 0;
};
class EPOCH_server_DefuseBomb
{
allowedTargets = 2;
jip = 0;
};
};
class Commands

View File

@ -0,0 +1,42 @@
/*
Author: He-Man - EpochMod.com
Contributors:
Description:
Defuse server side bombs (triggerd by Clients)
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_server/EPOCH_server_Defusebomb.sqf
Example:
[_bomb,true,player,Epoch_personalToken] remoteexec ["EPOCH_server_DefuseBomb",2];
Returns:
NOTHING
*/
params [
["_object",objNull,[objNull]],
["_value",true,[true]],
["_player",objNull,[objNull]],
["_token","",[""]]
];
if (isNull _object) exitWith{};
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
if (_player distance _object > 20) exitWith{};
if (_value) then {
'HelicopterExploSmall' createVehicle (position _object);
deletevehicle _object;
}
else {
deletevehicle _object;
_reward = gettext (configfile >> "cfgammo" >> (typeof _object) >> "defaultMagazine");
if !(_reward isequalto "") then {
_reward remoteexec ["EPOCH_fnc_addItemOverflow",_player];
[format ['Sucessfully defused %1 - You have it now in your Inventory',_reward call Epoch_fnc_Itemdisplayname],5] remoteexec ["Epoch_Message",_player];
};
};

View File

@ -128,6 +128,7 @@ class CfgServerFunctions
class server_createGlobalMarkerSet {};
class server_deleteGlobalMarkerSet {};
class server_isNearChecks {};
class server_DefuseBomb {};
};
class epoch_missions {
class Server_createObject {};