No more dupe

This commit is contained in:
macchky 2016-09-07 20:41:06 +09:00
parent d46f8170ba
commit 7515e187c4

View File

@ -6,8 +6,17 @@ Exile_RevivePlayer.sqf
© 2016 Enigma
*/
private["_handguntype","_handgunammo","_player","_playerID","_playerPos","_reviveused","_reviverownerID","_bambiPlayerID","_playerPos","_data","_extDB2Message","_revivername","_msg","_reviveused","_ind","_playerID","_sessionID","_requestingPlayer", "_requestingPlayerUID", "_items", "_dir", "_location", "_type", "_weapon", "_attachments", "_currWeap", "_itemSlot", "_itemqtys", "_goggles", "_headgear", "_vest", "_backpack", "_uniform", "_weapons", "_magazinesAmmo", "_itemsplayer", "_weaponsplayer", "_group", "_primaryWeapon", "_secondaryWeapon", "_attachment", "_equipped", "_wMags", "_requestingPlayerGroup", "_droppedWeapons", "_bambiPlayer", "_ownerID", "_reviver"];
private["_handguntype","_handgunammo","_player","_playerID","_playerPos",
"_reviveused","_reviverownerID","_bambiPlayerID","_playerPos","_data",
"_extDB2Message","_revivername","_msg","_reviveused","_ind","_playerID",
"_sessionID","_requestingPlayer", "_requestingPlayerUID", "_items", "_dir",
"_location", "_type", "_weapon", "_attachments", "_currWeap", "_itemSlot",
"_itemqtys", "_goggles", "_headgear", "_vest", "_backpack", "_uniform",
"_weapons", "_magazinesAmmo", "_itemsplayer", "_weaponsplayer", "_group",
"_primaryWeapon", "_secondaryWeapon", "_attachment", "_equipped", "_wMags",
"_requestingPlayerGroup", "_droppedWeapons", "_bambiPlayer", "_ownerID", "_reviver","_playerUID"];
_bambiPlayer = objNull;
_requestingPlayer = _this select 0;
_ownerID = owner _requestingPlayer;
_reviver = _this select 1;
@ -17,6 +26,7 @@ _reviversessionID = _reviver getVariable ["ExileSessionID",""];
_name = name _requestingPlayer;
_revivername = name _reviver;
_playerID = _requestingPlayer getVariable["ExileDatabaseID", -1];
_playerUID = getPlayerUID _requestingPlayer;
if (isNull _requestingPlayer) exitWith{ diag_log "EnigmaRevive - No requesting player"};
@ -24,7 +34,7 @@ if (_requestingPlayer distance _reviver > 5) exitWith{ diag_log "EnigmaRevive -
if (!local _requestingPlayer) then
{
_requestingPlayerUID = getPlayerUID _requestingPlayer;
_requestingPlayerUID = _playerUID;
if (!isNil "_requestingPlayerUID" && !alive _requestingPlayer) then
{
if (_requestingPlayer == _reviver) exitWith {
@ -34,7 +44,8 @@ if (!local _requestingPlayer) then
_ind = ((count ReviveChk_cache) - 1);
{
if (_playerID in _x) then {
if (_playerID in _x) then
{
_reviveused = _x select 1;
_ind = _forEachIndex;
};
@ -86,6 +97,29 @@ if (!local _requestingPlayer) then
_weaponsplayer = [getWeaponCargo(uniformContainer _requestingPlayer), getWeaponCargo(vestContainer _requestingPlayer), getWeaponCargo(backpackContainer _requestingPlayer)];
_weapons = [currentWeapon _requestingPlayer, (weaponsItems _requestingPlayer), [_primaryWeapon, _secondaryWeapon, handgunWeapon _requestingPlayer]];
hideObjectGlobal _requestingPlayer;
//[_requestingPlayer] joinSilent ExileServerGraveyardGroup;
//deleteVehicle _requestingPlayer;
_money = _requestingPlayer getVariable ["ExileMoney", 0];
//diag_log format ["Body money is %1" , _money];
_clear = {
_this = _object;
removeAllActions _object;
removeAllAssignedItems _object;
removeHeadgear _object;
removeGoggles _object;
clearBackpackCargoGlobal _object;
clearWeaponCargoGlobal _object;
clearItemCargoGlobal _object;
clearMagazineCargoGlobal _object;
removeAllContainers _object;
};
_requestingPlayer call _clear;
if (_money > 0) then {
_moneyHolder = createVehicle ["Exile_PopTabs",_location,[], 0, "can_collide"];
_moneyHolder setVariable ["ExileMoney", _money, true];
};
_accountData = format["getAccountStats:%1", _requestingPlayerUID] call ExileServer_system_database_query_selectSingle;
@ -114,7 +148,7 @@ if (!local _requestingPlayer) then
{
_clanGroup = (_clanData select 5);
};
[_player] joinSilent _clanGroup;
[_bambiPlayer] joinSilent _clanGroup;
};
_bambiPlayer setFatigue FatiguewhenRevived;
@ -156,10 +190,13 @@ if (!local _requestingPlayer) then
switch _type do {
case 1: { removeAllPrimaryWeaponItems _bambiPlayer; { _bambiPlayer addPrimaryWeaponItem _x }forEach _attachments;};
case 2: { removeAllHandgunItems _bambiPlayer; { _bambiPlayer addHandgunItem _x }forEach _attachments;};
case 4: { { _bambiPlayer addSecondaryWeaponItem _x }forEach _attachments;};};
case 4: { { _bambiPlayer addSecondaryWeaponItem _x }forEach _attachments;};
};
} else {{_bambiPlayer addItem _x;}forEach _attachments;
if (_wMags) then {_bambiPlayer addMagazine(_x select 4);};};} forEach (_weapons select 1);
if (_wMags) then {_bambiPlayer addMagazine(_x select 4);};
};
} forEach (_weapons select 1);
_currWeap = (_weapons select 0);
@ -215,7 +252,7 @@ _bambiPlayer setVariable ["ExileTemperature", 36];
_bambiPlayer setVariable ["ExileWetness", 0];
_bambiPlayer setVariable ["ExileAlcohol", 0];
_bambiPlayer setVariable ["ExileName", _name];
_bambiPlayer setVariable ["ExileOwnerUID", getPlayerUID _requestingPlayer];
_bambiPlayer setVariable ["ExileOwnerUID", _playerUID];
_bambiPlayer setVariable ["ExileIsBambi", true];
_bambiPlayer setVariable ["ExileXM8IsOnline", false, true];
_bambiPlayer setVariable ["ExileLocker", (_accountData select 4), true];
@ -300,10 +337,10 @@ _extDB2Message call ExileServer_system_database_query_fireAndForget;
_reviverownerID publicVariableClient "EnigmaReviveMSG";
_newScore = _requestingPlayer getVariable ["ExileScore", 0];
_newScore = _reviver getVariable ["ExileScore", 0];
_newScore = _newScore + 100;
_requestingPlayer setVariable ["ExileScore", _newScore];
format["setAccountScore:%1:%2", _newScore, getPlayerUID _requestingPlayer] call ExileServer_system_database_query_fireAndForget;
_reviver setVariable ["ExileScore", _newScore];
format["setAccountScore:%1:%2", _newScore, getPlayerUID _reviver] call ExileServer_system_database_query_fireAndForget;
_player addMPEventHandler ["MPKilled", {_this call ExileServer_object_player_event_onMpKilled}];
@ -330,9 +367,17 @@ if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision")
call ExileServer_system_network_send_to;
[_sessionID, _player] call ExileServer_system_session_update;
[_requestingPlayer] joinSilent ExileServerGraveyardGroup;
//_requestingPlayer call ExileServer_system_garbageCollector_deleteObject;
/*_requestingPlayer spawn
{
_requestingPlayer = _this;
//uiSleep 2;
if !(isNull _requestingPlayer) then
{
diag_log "EnigmaRevive - Delete Body Now!";
deleteVehicle _requestingPlayer;
};
};*/
EnigmaRevive = [_player];
_ownerID publicVariableClient "EnigmaRevive";
@ -344,16 +389,16 @@ call ExileServer_system_network_send_to;
};
//test to see if this stops duping
/*
[] spawn
{
uiSleep 4;
if (isNull _player) then
if (isNull _bambiPlayer) then
{
diag_log "EnigmaRevive - Something went horribly wrong!";
[_player] joinSilent ExileServerGraveyardGroup;
deleteVehicle _player;
};
[_bambiPlayer] joinSilent ExileServerGraveyardGroup;
deleteVehicle _bambiPlayer;
};
};*/