Hat da jemand eine idee?
Spoiler anzeigen
Code: fn_medicLights.sqf
/*
File: fn_medicLights.sqf
Author: mindstorm, modified by Adanteh
Link: http://forums.bistudio.com/showthread.php?157474-Offroad-Police-sirens-lights-and-underglow
Description:
Adds the light effect to cop vehicles, specifically the offroad.
*/
Private ["_vehicle","_lightRed","_lightBlue","_lightleft","_lightright","_leftRed"];
_vehicle = _this select 0;
if (isNil "_vehicle" || isNull _vehicle || !(_vehicle getVariable "lights")) exitWith {};
_lightRed = [0.1, 0.1, 20];
_lightBlue = [0.1, 0.1, 20];
_lightleft = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightleft setLightColor _lightRed;
_lightleft setLightBrightness 0.2;
_lightleft setLightAmbient [0.1,0.1,1];
switch (typeOf _vehicle) do
{
case "C_Offroad_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
};
case "B_MRAP_01_F":
{
_lightleft lightAttachObject [_vehicle, [-1, -2.8, 0.55]];
};
case "C_Offroad_02_unarmed_black_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
};
case "C_Van_01_box_F":
{
_lightleft lightAttachObject [_vehicle, [-0.75, 0.2, 1.55]];
};
case "B_Quadbike_01_F":
{
_lightright lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
};
case "B_MRAP_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, -1.9, 0.7]];
};
case "C_SUV_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
};
case "C_Hatchback_01_sport_F":
{
_lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
};
case "B_Heli_Light_01_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, -0.80]];
};
case "O_Heli_Light_02_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, 0.56]];
};
case "I_Heli_light_03_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, 0.56]];
};
case "B_Heli_Transport_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.5, 0.0, 0.81]];
};
}
_lightleft setLightAttenuation [0.181, 0, 1000, 130];
_lightleft setLightIntensity 10;
_lightleft setLightFlareSize 0.38;
_lightleft setLightFlareMaxDistance 150;
_lightleft setLightUseFlare true;
_lightright = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightright setLightColor _lightBlue;
_lightright setLightBrightness 0.2;
_lightright setLightAmbient [0.1,0.1,1];
switch (typeOf _vehicle) do
{
case "C_Offroad_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37, 0.0, 0.56]];
};
case "B_MRAP_01_F":
{
_lightleft lightAttachObject [_vehicle, [1, -2.8, 0.55]];
};
case "C_Offroad_02_unarmed_black_F":
{
_lightleft lightAttachObject [_vehicle, [0.37,-1.2,0.42]];
};
case "C_Van_01_box_F":
{
_lightleft lightAttachObject [_vehicle, [0.67, 0.2, 1.55]];
};
case "B_Quadbike_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37, 1.2, 0.42];
};
case "B_MRAP_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37, -1.9, 0.7]];
};
case "C_SUV_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37,-1.2,0.42]];
};
case "C_Hatchback_01_sport_F":
{
_lightright lightAttachObject [_vehicle, [0.35,-0.2,0.25]];
};
case "B_Heli_Light_01_F":
{
_lightright lightAttachObject [_vehicle,[0.37, 0.0, -0.80]];
};
case "O_Heli_Light_02_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[0.37, 0.0, 0.56]];
};
case "I_Heli_light_03_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[0.37, 0.0, 0.56]];
};
case "B_Heli_Transport_01_F":
{
_lightright lightAttachObject [_vehicle, [0.5, 0.0, 0.81]];
};
};
_lightright setLightAttenuation [0.181, 0, 1000, 130];
_lightright setLightIntensity 10;
_lightright setLightFlareSize 0.38;
_lightright setLightFlareMaxDistance 150;
_lightright setLightUseFlare true;
//ARE YOU ALL HAPPY?!?!?!?!?!?!?!?!?%#?@WGD?TGD?BN?ZDHBFD?GA
_lightleft setLightDayLight true;
_lightright setLightDayLight true;
_leftRed = true;
while{ (alive _vehicle)} do
{
if (!(_vehicle getVariable "lights")) exitWith {};
if (_leftRed) then
{
_leftRed = false;
_lightright setLightBrightness 0.0;
sleep 0.05;
_lightleft setLightBrightness 6;
}
else
{
_leftRed = true;
_lightleft setLightBrightness 0.0;
sleep 0.05;
_lightright setLightBrightness 6;
};
sleep (_this select 1);
};
deleteVehicle _lightleft;
deleteVehicle _lightright;
Alles anzeigen
Spoiler anzeigen
Code: fn_copLights.sqf
/*
File: fn_copLights.sqf
Author: mindstorm, modified by Adanteh
Link: http://forums.bistudio.com/showthread.php?157474-Offroad-Police-sirens-lights-and-underglow
Description:
Adds the light effect to cop vehicles, specifically the offroad.
*/
Private ["_vehicle","_lightRed","_lightBlue","_lightleft","_lightright","_leftRed"];
_vehicle = _this select 0;
if (isNil "_vehicle" || isNull _vehicle || !(_vehicle getVariable "lights")) exitWith {};
_lightRed = [20, 0.1, 0.1];
_lightBlue = [0.1, 0.1, 20];
_lightleft = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightleft setLightColor _lightRed;
_lightleft setLightBrightness 0.2;
_lightleft setLightAmbient [0.1,0.1,1];
switch (typeOf _vehicle) do
{
case "C_Offroad_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
};
case "B_MRAP_01_hmg_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
};
case "I_MRAP_03_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
};
case "O_MRAP_02_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, 0.0, 0.56]];
};
case "B_MRAP_01_F":
{
_lightleft lightAttachObject [_vehicle, [-1, -2.8, 0.55]];
};
case "C_Offroad_02_unarmed_black_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
};
case "C_Van_01_box_F":
{
_lightleft lightAttachObject [_vehicle, [-0.75, 0.2, 1.55]];
};
case "B_Quadbike_01_F":
{
_lightright lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
};
case "B_MRAP_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37, -1.9, 0.7]];
};
case "C_SUV_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.37,-1.2,0.42]];
};
case "C_Hatchback_01_sport_F":
{
_lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
};
case "C_Hatchback_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.35,-0.2,0.25]];
};
case "B_Heli_Light_01_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, -0.80]];
};
case "O_Heli_Light_02_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, 0.56]];
};
case "I_Heli_light_03_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, 0.56]];
};
case "B_T_VTOL_01_infantry_F":
{
_lightleft lightAttachObject [_vehicle,[-0.37, 0.0, 0.56]];
};
case "B_Heli_Transport_01_F":
{
_lightleft lightAttachObject [_vehicle, [-0.5, 0.0, 0.81]];
};
};
_lightleft setLightAttenuation [0.181, 0, 1000, 130];
_lightleft setLightIntensity 10;
_lightleft setLightFlareSize 0.38;
_lightleft setLightFlareMaxDistance 150;
_lightleft setLightUseFlare true;
_lightright = "#lightpoint" createVehicle getPos _vehicle;
sleep 0.2;
_lightright setLightColor _lightBlue;
_lightright setLightBrightness 0.2;
_lightright setLightAmbient [0.1,0.1,1];
switch (typeOf _vehicle) do
{
case "C_Offroad_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37, 0.0, 0.56]];
};
case "B_MRAP_01_hmg_F":
{
_lightleft lightAttachObject [_vehicle, [0.37, 0.0, 0.56]];
};
case "I_MRAP_03_F":
{
_lightleft lightAttachObject [_vehicle, [0.37, 0.0, 0.56]];
};
case "O_MRAP_02_F":
{
_lightleft lightAttachObject [_vehicle, [0.37, 0.0, 0.56]];
};
case "B_MRAP_01_F":
{
_lightleft lightAttachObject [_vehicle, [1, -2.8, 0.55]];
};
case "C_Offroad_02_unarmed_black_F":
{
_lightleft lightAttachObject [_vehicle, [0.37,-1.2,0.42]];
};
case "C_Van_01_box_F":
{
_lightleft lightAttachObject [_vehicle, [0.67, 0.2, 1.55]];
};
case "B_Quadbike_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37, 1.2, 0.42];
};
case "B_MRAP_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37, -1.9, 0.7]];
};
case "C_SUV_01_F":
{
_lightright lightAttachObject [_vehicle, [0.37,-1.2,0.42]];
};
case "C_Hatchback_01_sport_F":
{
_lightright lightAttachObject [_vehicle, [0.35,-0.2,0.25]];
};
case "C_Hatchback_01_F":
{
_lightleft lightAttachObject [_vehicle, [0.35,-0.2,0.25]];
};
case "B_Heli_Light_01_F":
{
_lightright lightAttachObject [_vehicle,[0.37, 0.0, -0.80]];
};
case "O_Heli_Light_02_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[0.37, 0.0, 0.56]];
};
case "I_Heli_light_03_unarmed_F":
{
_lightleft lightAttachObject [_vehicle,[0.37, 0.0, 0.56]];
};
case "B_T_VTOL_01_infantry_F":
{
_lightleft lightAttachObject [_vehicle,[0.37, 0.0, 0.56]];
};
case "B_Heli_Transport_01_F":
{
_lightright lightAttachObject [_vehicle, [0.5, 0.0, 0.81]];
};
};
_lightright setLightAttenuation [0.181, 0, 1000, 130];
_lightright setLightIntensity 10;
_lightright setLightFlareSize 0.38;
_lightright setLightFlareMaxDistance 150;
_lightright setLightUseFlare true;
//ARE YOU ALL HAPPY?!?!?!?!?!?!?!?!?%#?@WGD?TGD?BN?ZDHBFD?GA
_lightleft setLightDayLight true;
_lightright setLightDayLight true;
_leftRed = true;
while{ (alive _vehicle)} do
{
if (!(_vehicle getVariable "lights")) exitWith {};
if (_leftRed) then
{
_leftRed = false;
_lightright setLightBrightness 0.0;
sleep 0.05;
_lightleft setLightBrightness 6;
}
else
{
_leftRed = true;
_lightleft setLightBrightness 0.0;
sleep 0.05;
_lightright setLightBrightness 6;
};
sleep (_this select 1);
};
deleteVehicle _lightleft;
deleteVehicle _lightright;
Alles anzeigen
Wollt noch das hier anhängen
Spoiler anzeigen
Code: fn_keyhandler.sqf
#include "..\..\script_macros.hpp"
/*
* File: fn_keyHandler.sqf
* Author: Bryan "Tonic" Boardwine
*
* Description:
* Main key handler for event 'keyDown'
*/
private ["_handled","_shift","_alt","_code","_ctrl","_alt","_ctrlKey","_veh","_locked","_interactionKey","_mapKey","_interruptionKeys"];
_ctrl = _this select 0;
_code = _this select 1;
_shift = _this select 2;
_ctrlKey = _this select 3;
_alt = _this select 4;
_speed = speed cursorObject;
_handled = false;
_interactionKey = if (count (actionKeys "User10") isEqualTo 0) then {219} else {(actionKeys "User10") select 0};
_mapKey = (actionKeys "ShowMap" select 0);
//hint str _code;
_interruptionKeys = [17,30,31,32]; //A,S,W,D
//Vault handling...
if ((_code in (actionKeys "GetOver") || _code in (actionKeys "salute") || _code in (actionKeys "SitDown") || _code in (actionKeys "Throw") || _code in (actionKeys "GetIn") || _code in (actionKeys "GetOut") || _code in (actionKeys "Fire") || _code in (actionKeys "ReloadMagazine") || _code in [16,18]) && ((player getVariable ["restrained",false]) || (player getVariable ["playerSurrender",false]) || life_isknocked || life_istazed)) exitWith {
true;
};
if (life_action_inUse) exitWith {
if (!life_interrupted && _code in _interruptionKeys) then {life_interrupted = true;};
_handled;
};
//Hotfix for Interaction key not being able to be bound on some operation systems.
if (!(count (actionKeys "User10") isEqualTo 0) && {(inputAction "User10" > 0)}) exitWith {
//Interaction key (default is Left Windows, can be mapped via Controls -> Custom -> User Action 10)
if (!life_action_inUse) then {
[] spawn {
private "_handle";
_handle = [] spawn life_fnc_actionKeyHandler;
waitUntil {scriptDone _handle};
life_action_inUse = false;
};
};
true;
};
if (life_container_active) then {
switch (_code) do {
//space key
case 57: {
[] spawn life_fnc_placestorage;
};
};
true;
};
switch (_code) do {
//Space key for Jumping
case 57: {
if (!_shift && life_barrier_active) then {
0 spawn life_fnc_placeablesPlaceComplete;
};
if (isNil "jumpActionTime") then {jumpActionTime = 0;};
if (_shift && {!(animationState player isEqualTo "AovrPercMrunSrasWrflDf")} && {isTouchingGround player} && {stance player isEqualTo "STAND"} && {speed player > 2} && {!life_is_arrested} && {((velocity player) select 2) < 2.5} && {time - jumpActionTime > 1.5}) then {
if (life_barrier_active) then { [true] call life_fnc_placeableCancel; };
jumpActionTime = time; //Update the time.
[player] remoteExec ["life_fnc_jumpFnc",RANY]; //Global execution
_handled = true;
};
};
case 200 : {
if(vehicle player != player && (typeOf vehicle player) in ["B_Quadbike_01_F","C_Offroad_01_F","B_G_Offroad_01_F","C_Hatchback_01_F","C_Hatchback_01_sport_F","C_SUV_01_F"]) then {
[vehicle player,"warning"] spawn life_fnc_blinkerManage;
_handled = true;
};
};
case 205 : {
if(vehicle player != player && (typeOf vehicle player) in ["B_Quadbike_01_F","C_Offroad_01_F","B_G_Offroad_01_F","C_Hatchback_01_F","C_Hatchback_01_sport_F","C_SUV_01_F"]) then {
[vehicle player,"right"] spawn life_fnc_blinkerManage;
_handled = true;
};
};
case 203 : {
if(vehicle player != player && (typeOf vehicle player) in ["B_Quadbike_01_F","C_Offroad_01_F","B_G_Offroad_01_F","C_Hatchback_01_F","C_Hatchback_01_sport_F","C_SUV_01_F"]) then {
[vehicle player,"left"] spawn life_fnc_blinkerManage;
_handled = true;
};
};
//Ö-Key
case 39: {
if ((isNull(findDisplay 20000)) && (playerSide in ([west,independent]))) then {
0 spawn life_fnc_placeablesMenu;
_handled = true;
};
_handled = true;
};
//Surrender (Shift + B)
case 48: {
if (_shift) then {
if (player getVariable ["playerSurrender",false]) then {
player setVariable ["playerSurrender",false,true];
} else {
[] spawn life_fnc_surrender;
};
_handled = true;
};
};
//ENTF-Key
case 211: {
if ((playerSide in [west,independent]) && ((typeOf cursorTarget) in life_definePlaceables)) then {
deleteVehicle cursorTarget;
hintSilent "Die Absperrung wurde entfernt";
};
};
//Map Key
case _mapKey: {
switch (playerSide) do {
case west: {if (!visibleMap) then {[] spawn life_fnc_copMarkers;}};
case independent: {if (!visibleMap) then {[] spawn life_fnc_medicMarkers;}};
case civilian: {if (!visibleMap) then {[] spawn life_fnc_civMarkers;}};
};
};
//Holster / recall weapon. (Shift + H)
case 35: {
if (_shift && !_ctrlKey && !(currentWeapon player isEqualTo "")) then {
life_curWep_h = currentWeapon player;
player action ["SwitchWeapon", player, player, 100];
player switchCamera cameraView;
};
if (!_shift && _ctrlKey && !isNil "life_curWep_h" && {!(life_curWep_h isEqualTo "")}) then {
if (life_curWep_h in [primaryWeapon player,secondaryWeapon player,handgunWeapon player]) then {
player selectWeapon life_curWep_h;
};
};
};
//Interaction key (default is Left Windows, can be mapped via Controls -> Custom -> User Action 10)
case _interactionKey: {
if (!life_action_inUse) then {
[] spawn {
private "_handle";
_handle = [] spawn life_fnc_actionKeyHandler;
waitUntil {scriptDone _handle};
life_action_inUse = false;
};
};
};
//Restraining (Shift + R)
case 19: {
if (_shift) then {_handled = true;};
if (_shift && playerSide isEqualTo west && {!isNull cursorObject} && {cursorObject isKindOf "Man"} && {(isPlayer cursorObject)} && {(side cursorObject in [civilian,independent])} && {alive cursorObject} && {cursorObject distance player < 3.5} && {!(cursorObject getVariable "Escorting")} && {!(cursorObject getVariable "restrained")} && {speed cursorObject < 1}) then {
[] call life_fnc_restrainAction;
};
};
//Knock out, this is experimental and yeah... (Shift + G)
case 34: {
if (_shift) then {_handled = true;};
if (_shift && playerSide isEqualTo civilian && !isNull cursorObject && cursorObject isKindOf "Man" && isPlayer cursorObject && alive cursorObject && cursorObject distance player < 4 && speed cursorObject < 1) then {
if ((animationState cursorObject) != "Incapacitated" && (currentWeapon player == primaryWeapon player || currentWeapon player == handgunWeapon player) && currentWeapon player != "" && !life_knockout && !(player getVariable ["restrained",false]) && !life_istazed && !life_isknocked) then {
[cursorObject] spawn life_fnc_knockoutAction;
};
};
};
//T Key (Trunk)
case 20: {
if (!_alt && !_ctrlKey && !dialog && {!life_action_inUse}) then {
if (vehicle player != player && alive vehicle player) then {
if ((vehicle player) in life_vehicles) then {
[vehicle player] spawn life_fnc_openInventory;
};
} else {
private "_list";
_list = ((ASLtoATL (getPosASL player)) nearEntities [["Box_IND_Grenades_F","B_supplyCrate_F"], 2.5]) select 0;
if (!(isNil "_list")) then {
_house = nearestObject [(ASLtoATL (getPosASL _list)), "House"];
if (_house getVariable ["locked", false]) then {
hint localize "STR_House_ContainerDeny";
} else {
[_list] spawn life_fnc_openInventory;
};
} else {
_list = ["landVehicle","Air","Ship"];
if (KINDOF_ARRAY(cursorObject,_list) && {player distance cursorObject < 7} && {isNull objectParent player} && {alive cursorObject} && {!life_action_inUse}) then {
if (cursorObject in life_vehicles) then {
[cursorObject] spawn life_fnc_openInventory;
};
};
};
};
};
};
//L Key?
case 38: {
//If cop run checks for turning lights on.
if (_shift && playerSide in [west,independent]) then {
if (vehicle player != player && (typeOf vehicle player) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F","C_Van_01_box_F"]) then {
if (!isNil {vehicle player getVariable "lights"}) then {
if (playerSide isEqualTo west) then {
[vehicle player] call life_fnc_sirenLights;
} else {
[vehicle player] call life_fnc_medicSirenLights;
};
_handled = true;
};
};
};
//if (!_alt && !_ctrlKey) then { [] call life_fnc_radar; };
if (_shift && vehicle player == player && playerside in [civilian,west,independent]) then {
[vehicle player] call life_fnc_useFlashlight;
};
};
//Y Player Menu
case 21: {
if (!_alt && !_ctrlKey && !dialog && !(player getVariable ["restrained",false]) && {!life_action_inUse}) then {
if (!_shift) then {
[] call life_fnc_p_openMenu;
} else {
[] call life_fnc_altisPhone;
};
};
};
//F Key
case 33: {
if (playerSide in [west,independent] && {vehicle player != player} && {!life_siren_active} && {((driver vehicle player) == player)}) then {
[] spawn {
life_siren_active = true;
sleep 4.7;
life_siren_active = false;
};
_veh = vehicle player;
if (isNil {_veh getVariable "siren"}) then {_veh setVariable ["siren",false,true];};
if ((_veh getVariable "siren")) then {
titleText [localize "STR_MISC_SirensOFF","PLAIN"];
_veh setVariable ["siren",false,true];
} else {
titleText [localize "STR_MISC_SirensON","PLAIN"];
_veh setVariable ["siren",true,true];
if (playerSide isEqualTo west) then {
[_veh] remoteExec ["life_fnc_copSiren",RCLIENT];
} else {
[_veh] remoteExec ["life_fnc_medicSiren",RCLIENT];
};
};
};
};
//O Key
case 24: {
if (_shift) then {
if (soundVolume != 1) then {
1 fadeSound 1;
systemChat localize "STR_MISC_soundnormal";
} else {
1 fadeSound 0.1;
systemChat localize "STR_MISC_soundfade";
};
};
};
//Takwondo(Traditional Martial arts in korea)(Shift + Num 1)
case 79: {
if(_shift) then {_handled = true;};
if ((_shift) && (vehicle player == player)) then {
cutText [format["Takwondo!!!"], "PLAIN DOWN"];
player playMove "AmovPercMstpSnonWnonDnon_exerciseKata";
};
};
//Kneebend Slow(Shift + Num 2)
case 80: {
if(_shift) then {_handled = true;};
if ((_shift) && (vehicle player == player)) then {
cutText [format["KneeBend Slow baby~"], "PLAIN DOWN"];
player playMove "AmovPercMstpSnonWnonDnon_exercisekneeBendA";
};
};
//Kneebend Fast(Shift + Num 3)
case 81: {
if(_shift) then {_handled = true;};
if ((_shift) && (vehicle player == player)) then {
cutText [format["KneeBend more Hard!!!Move!!Move!!"], "PLAIN DOWN"];
player playMove "AmovPercMstpSnonWnonDnon_exercisekneeBendB";
};
};
//Pushup(Shift + Num 4)
case 75: {
if(_shift) then {_handled = true;};
if ((_shift) && (vehicle player == player)) then {
cutText [format["Pushup!!!!!!"], "PLAIN DOWN"];
player playMove "AmovPercMstpSnonWnonDnon_exercisePushup";
};
};
//U Key
case 22: {
if (!_alt && !_ctrlKey) then {
if (isNull objectParent player) then {
_veh = cursorObject;
} else {
_veh = vehicle player;
};
if (_veh isKindOf "House_F" && {playerSide isEqualTo civilian}) then {
if (_veh in life_vehicles && player distance _veh < 8) then {
_door = [_veh] call life_fnc_nearestDoor;
if (_door isEqualTo 0) exitWith {hint localize "STR_House_Door_NotNear"};
_locked = _veh getVariable [format["bis_disabled_Door_%1",_door],0];
if (_locked isEqualTo 0) then {
_veh setVariable [format["bis_disabled_Door_%1",_door],1,true];
_veh animate [format["door_%1_rot",_door],0];
systemChat localize "STR_House_Door_Lock";
} else {
_veh setVariable [format["bis_disabled_Door_%1",_door],0,true];
_veh animate [format["door_%1_rot",_door],1];
systemChat localize "STR_House_Door_Unlock";
};
};
} else {
_locked = locked _veh;
if (_veh in life_vehicles && player distance _veh < 8) then {
if (_locked isEqualTo 2) then {
if (local _veh) then {
_veh lock 0;
// BI
_veh animateDoor ["door_back_R",1];
_veh animateDoor ["door_back_L",1];
_veh animateDoor ['door_R',1];
_veh animateDoor ['door_L',1];
_veh animateDoor ['Door_L_source',1];
_veh animateDoor ['Door_rear',1];
_veh animateDoor ['Door_rear_source',1];
_veh animateDoor ['Door_1_source',1];
_veh animateDoor ['Door_2_source',1];
_veh animateDoor ['Door_3_source',1];
_veh animateDoor ['Door_LM',1];
_veh animateDoor ['Door_RM',1];
_veh animateDoor ['Door_LF',1];
_veh animateDoor ['Door_RF',1];
_veh animateDoor ['Door_LB',1];
_veh animateDoor ['Door_RB',1];
_veh animateDoor ['DoorL_Front_Open',1];
_veh animateDoor ['DoorR_Front_Open',1];
_veh animateDoor ['DoorL_Back_Open',1];
_veh animateDoor ['DoorR_Back_Open ',1];
} else {
[_veh,0] remoteExecCall ["life_fnc_lockVehicle",_veh];
_veh animateDoor ["door_back_R",1];
_veh animateDoor ["door_back_L",1];
_veh animateDoor ['door_R',1];
_veh animateDoor ['door_L',1];
_veh animateDoor ['Door_L_source',1];
_veh animateDoor ['Door_rear',1];
_veh animateDoor ['Door_rear_source',1];
_veh animateDoor ['Door_1_source',1];
_veh animateDoor ['Door_2_source',1];
_veh animateDoor ['Door_3_source',1];
_veh animateDoor ['Door_LM',1];
_veh animateDoor ['Door_RM',1];
_veh animateDoor ['Door_LF',1];
_veh animateDoor ['Door_RF',1];
_veh animateDoor ['Door_LB',1];
_veh animateDoor ['Door_RB',1];
_veh animateDoor ['DoorL_Front_Open',1];
_veh animateDoor ['DoorR_Front_Open',1];
_veh animateDoor ['DoorL_Back_Open',1];
_veh animateDoor ['DoorR_Back_Open ',1];
};
systemChat localize "STR_MISC_VehUnlock";
[_veh,"UnlockCarSound"] remoteExec ["life_fnc_say3D",RANY];
} else {
if (local _veh) then {
_veh lock 2;
_veh animateDoor ["door_back_R",0];
_veh animateDoor ["door_back_L",0];
_veh animateDoor ['door_R',0];
_veh animateDoor ['door_L',0];
_veh animateDoor ['Door_L_source',0];
_veh animateDoor ['Door_rear',0];
_veh animateDoor ['Door_rear_source',0];
_veh animateDoor ['Door_1_source',0];
_veh animateDoor ['Door_2_source',0];
_veh animateDoor ['Door_3_source',0];
_veh animateDoor ['Door_LM',0];
_veh animateDoor ['Door_RM',0];
_veh animateDoor ['Door_LF',0];
_veh animateDoor ['Door_RF',0];
_veh animateDoor ['Door_LB',0];
_veh animateDoor ['Door_RB',0];
_veh animateDoor ['DoorL_Front_Open',0];
_veh animateDoor ['DoorR_Front_Open',0];
_veh animateDoor ['DoorL_Back_Open',0];
_veh animateDoor ['DoorR_Back_Open ',0];
} else {
[_veh,2] remoteExecCall ["life_fnc_lockVehicle",_veh];
_veh animateDoor ["door_back_R",0];
_veh animateDoor ["door_back_L",0];
_veh animateDoor ['door_R',0];
_veh animateDoor ['door_L',0];
_veh animateDoor ['Door_L_source',0];
_veh animateDoor ['Door_rear',0];
_veh animateDoor ['Door_rear_source',0];
_veh animateDoor ['Door_1_source',0];
_veh animateDoor ['Door_2_source',0];
_veh animateDoor ['Door_3_source',0];
_veh animateDoor ['Door_LM',0];
_veh animateDoor ['Door_RM',0];
_veh animateDoor ['Door_LF',0];
_veh animateDoor ['Door_RF',0];
_veh animateDoor ['Door_LB',0];
_veh animateDoor ['Door_RB',0];
_veh animateDoor ['DoorL_Front_Open',0];
_veh animateDoor ['DoorR_Front_Open',0];
_veh animateDoor ['DoorL_Back_Open',0];
_veh animateDoor ['DoorR_Back_Open ',0];
};
systemChat localize "STR_MISC_VehLock";
[_veh,"LockCarSound"] remoteExec ["life_fnc_say3D",RANY];
};
};
};
};
};
};
_handled;
Alles anzeigen
Und das hier aucn noch
Spoiler anzeigen
Code: fn_spawnVehicle.sqf
#include "\life_server\script_macros.hpp"
/*
File: fn_spawnVehicle.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sends the query request to the database, if an array is returned then it creates
the vehicle if it's not in use or dead.
*/
private ["_vid","_sp","_pid","_query","_sql","_vehicle","_nearVehicles","_name","_side","_tickTime","_dir","_servIndex","_damage","_wasIllegal","_location","_thread"];
_vid = [_this,0,-1,[0]] call BIS_fnc_param;
_pid = [_this,1,"",[""]] call BIS_fnc_param;
_sp = [_this,2,[],[[],""]] call BIS_fnc_param;
_unit = [_this,3,objNull,[objNull]] call BIS_fnc_param;
_price = [_this,4,0,[0]] call BIS_fnc_param;
_dir = [_this,5,0,[0]] call BIS_fnc_param;
_spawntext = _this select 6;
_unit_return = _unit;
_name = name _unit;
_side = side _unit;
_unit = owner _unit;
if (_vid isEqualTo -1 || _pid isEqualTo "") exitWith {};
if (_vid in serv_sv_use) exitWith {};
serv_sv_use pushBack _vid;
_servIndex = serv_sv_use find _vid;
_query = format ["SELECT id, side, classname, type, pid, alive, active, plate, color, inventory, gear, fuel, damage, blacklist FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];
_tickTime = diag_tickTime;
_queryResult = [_query,2] call DB_fnc_asyncCall;
if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
diag_log "------------- Client Query Request -------------";
diag_log format ["QUERY: %1",_query];
diag_log format ["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
diag_log format ["Result: %1",_queryResult];
diag_log "------------------------------------------------";
};
if (_queryResult isEqualType "") exitWith {};
_vInfo = _queryResult;
if (isNil "_vInfo") exitWith {serv_sv_use deleteAt _servIndex;};
if (count _vInfo isEqualTo 0) exitWith {serv_sv_use deleteAt _servIndex;};
if ((_vInfo select 5) isEqualTo 0) exitWith {
serv_sv_use deleteAt _servIndex;
[1,"STR_Garage_SQLError_Destroyed",true,[_vInfo select 2]] remoteExecCall ["life_fnc_broadcast",_unit];
};
if ((_vInfo select 6) isEqualTo 1) exitWith {
serv_sv_use deleteAt _servIndex;
[1,"STR_Garage_SQLError_Active",true,[_vInfo select 2]] remoteExecCall ["life_fnc_broadcast",_unit];
};
if (!(_sp isEqualType "")) then {
_nearVehicles = nearestObjects[_sp,["Car","Air","Ship"],10];
} else {
_nearVehicles = [];
};
if (count _nearVehicles > 0) exitWith {
serv_sv_use deleteAt _servIndex;
[_price,_unit_return] remoteExecCall ["life_fnc_garageRefund",_unit];
[1,"STR_Garage_SpawnPointError",true] remoteExecCall ["life_fnc_broadcast",_unit];
};
_query = format ["UPDATE vehicles SET active='1', damage='""[]""' WHERE pid='%1' AND id='%2'",_pid,_vid];
_trunk = [(_vInfo select 9)] call DB_fnc_mresToArray;
_gear = [(_vInfo select 10)] call DB_fnc_mresToArray;
_damage = [(_vInfo select 12)] call DB_fnc_mresToArray;
_wasIllegal = (_vInfo select 13);
_wasIllegal = if (_wasIllegal isEqualTo 1) then { true } else { false };
[_query,1] call DB_fnc_asyncCall;
if (_sp isEqualType "") then {
_vehicle = createVehicle[(_vInfo select 2),[0,0,999],[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _sp,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
uiSleep 0.6;
} else {
_vehicle = createVehicle [(_vInfo select 2),_sp,[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_vehicle setPos _sp;
_vehicle setVectorUp (surfaceNormal _sp);
_vehicle setDir _dir;
};
_vehicle allowDamage true;
//Send keys over the network.
[_vehicle] remoteExecCall ["life_fnc_addVehicle2Chain",_unit];
[_pid,_side,_vehicle,1] call TON_fnc_keyManagement;
_vehicle lock 2;
//Reskin the vehicle
[_vehicle,(_vInfo select 8)] remoteExecCall ["life_fnc_colorVehicle",_unit];
_vehicle setVariable ["vehicle_info_owners",[[_pid,_name]],true];
_vehicle setVariable ["dbInfo",[(_vInfo select 4),(_vInfo select 7)],true];
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
[_vehicle] call life_fnc_clearVehicleAmmo;
// Avoid problems if u keep changing which stuff to save!
if (LIFE_SETTINGS(getNumber,"save_vehicle_virtualItems") isEqualTo 1) then {
_vehicle setVariable ["Trunk",_trunk,true];
if (_wasIllegal) then {
if (_sp isEqualType "") then {
_location= (nearestLocations [getPos _sp,["NameCityCapital","NameCity","NameVillage"],1000]) select 0;
} else {
_location= (nearestLocations [_sp,["NameCityCapital","NameCity","NameVillage"],1000]) select 0;
};
_location = text _location;
[1,"STR_NOTF_BlackListedVehicle",true,[_location,_name]] remoteExecCall ["life_fnc_broadcast",west];
_query = format ["UPDATE vehicles SET blacklist='0' WHERE id='%1' AND pid='%2'",_vid,_pid];
_thread = [_query,1] call DB_fnc_asyncCall;
};
}else{
_vehicle setVariable ["Trunk",[[],0],true];
};
if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {
_vehicle setFuel (_vInfo select 11);
}else{
_vehicle setFuel 1;
};
if (count _gear > 0 && (LIFE_SETTINGS(getNumber,"save_vehicle_inventory") isEqualTo 1)) then {
_items = _gear select 0;
_mags = _gear select 1;
_weapons = _gear select 2;
_backpacks = _gear select 3;
for "_i" from 0 to ((count (_items select 0)) - 1) do {
_vehicle addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)];
};
for "_i" from 0 to ((count (_mags select 0)) - 1) do {
_vehicle addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)];
};
for "_i" from 0 to ((count (_weapons select 0)) - 1) do {
_vehicle addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)];
};
for "_i" from 0 to ((count (_backpacks select 0)) - 1) do {
_vehicle addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)];
};
};
if (count _damage > 0 && (LIFE_SETTINGS(getNumber,"save_vehicle_damage") isEqualTo 1)) then {
_parts = getAllHitPointsDamage _vehicle;
for "_i" from 0 to ((count _damage) - 1) do {
_vehicle setHitPointDamage [format ["%1",((_parts select 0) select _i)],_damage select _i];
};
};
//Sets of animations
if ((_vInfo select 1) isEqualTo "civ" && (_vInfo select 2) isEqualTo "B_Heli_Light_01_F" && !((_vInfo select 8) isEqualTo 13)) then {
[_vehicle,"civ_littlebird",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};
if ((_vInfo select 1) isEqualTo "cop" && ((_vInfo select 2)) in ["B_Quadbike_01_F","C_Offroad_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","C_Offroad_02_unarmed_black_F","C_Hatchback_01_F","B_MRAP_01_F","O_MRAP_02_F","I_MRAP_03_F","B_MRAP_01_hmg_F","B_Heli_Light_01_F","I_Heli_light_03_unarmed_F","B_T_VTOL_01_infantry_F","B_Heli_Transport_01_F"]) then {
_vehicle setVariable["lights",false,true];
};
if ((_vInfo select 1) isEqualTo "med" && ((_vInfo select 2)) in ["C_Van_01_box_F","C_SUV_01_F","C_Hatchback_01_sport_F","C_Offroad_01_F","C_Offroad_02_unarmed_black_F","B_MRAP_01_F","B_Heli_Light_01_F","O_Heli_Light_02_unarmed_F","I_Heli_light_03_unarmed_F"]) then {
_vehicle setVariable["lights",false,true];
};
if ((_vInfo select 1) isEqualTo "cop" && ((_vInfo select 2)) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"]) then {
[_vehicle,"cop_offroad",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};
if ((_vInfo select 1) isEqualTo "med" && (_vInfo select 2) isEqualTo "C_Offroad_01_F") then {
[_vehicle,"med_offroad",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};
[1,_spawntext] remoteExecCall ["life_fnc_broadcast",_unit];
serv_sv_use deleteAt _servIndex;
Alles anzeigen