From b519a1f44c483bd4702a04a153615094392eb2d5 Mon Sep 17 00:00:00 2001 From: Schalldampfer Date: Fri, 27 Jul 2018 23:28:20 +0900 Subject: [PATCH] check puid instead of spawned object --- .../deploy_vehicle/Epoch_Deploy_server_PackVehicle.sqf | 2 +- .../deploy_vehicle/Epoch_Deploy_server_SpawnVehicle.sqf | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_PackVehicle.sqf b/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_PackVehicle.sqf index 6223a84..f7f908a 100644 --- a/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_PackVehicle.sqf +++ b/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_PackVehicle.sqf @@ -11,7 +11,7 @@ _vehObj = _this select 1; _vehClass = typeOf _vehObj; if ((_vehObj getVariable ["EPOCH_DeployOwner","-1"]) == _puid) then {//check owner - Deploy_DeployedVehicles = Deploy_DeployedVehicles - [_vehObj];//remove from array + Deploy_DeployedPlayer = Deploy_DeployedPlayer - [_puid];//remove from array deleteVehicle _vehObj;//remove vehicle format["You've packed a %1!", _vehClass] remoteExec ["Epoch_message",_player]; }; diff --git a/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_SpawnVehicle.sqf b/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_SpawnVehicle.sqf index a58b228..3b59326 100644 --- a/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_SpawnVehicle.sqf +++ b/epoch_server/compile/deploy_vehicle/Epoch_Deploy_server_SpawnVehicle.sqf @@ -12,12 +12,11 @@ _vehClass = _this select 1; diag_log format["[DeployBike] Try spawning %1 by %2",_vehClass,_player]; _isOk = true; -if(isNil "Deploy_DeployedVehicles") then {Deploy_DeployedVehicles = [];}; +if(isNil "Deploy_DeployedPlayer") then {Deploy_DeployedPlayer = [];}; //check player haven't spawned one -{ - if ((_x getVariable ["EPOCH_DeployOwner","-1"]) == _puid) then { _isOk = false;"You've already deployed a vehicle!" remoteExec ["Epoch_message",_player]; }; -} foreach Deploy_DeployedVehicles; +if (_puid in Deploy_DeployedPlayer) exitWith { _isOk = false;"You've already deployed a vehicle!" remoteExec ["Epoch_message",_player]; }; + //spawn if (_isOk) then { @@ -29,7 +28,7 @@ if (_isOk) then { _vehObj setVelocity [0,0,.1]; _vehObj call EPOCH_server_setVToken; //_vehObj call EPOCH_server_vehicleInit; - Deploy_DeployedVehicles set [count Deploy_DeployedVehicles, _vehObj];//add to array + Deploy_DeployedPlayer pushBack _puid;//add to array _vehObj setvariable ["EPOCH_DeployOwner",_puid];//set puid as owner _vehObj addEventHandler ["GetIn", {"WARNING: This vehicle will be deleted at restart!" remoteExec ["Epoch_message",_this select 2];}];//warn when get in