Guten Abend ich habe ein kleines problem. ich habe gestern bei den adac´s das gelb nicht eingefügt und seit dem ich das kart licht rein gemacht habe klappt nichts mehr bei mir vielleicht könnt ihr mir ja helfen:
Ich zeige euch erst das was ich rein gemacht habe und dann das was im tutorial steht:
meine keyHandler
Code
/*
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 cursorTarget;
_handled = false;
_interactionKey = if(count (actionKeys "User10") == 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")) && {(player getVariable ["restrained",false])}) 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") != 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;
};
switch (_code) do
{
//Space key for Jumping
case 57:
{
if(isNil "jumpActionTime") then {jumpActionTime = 0;};
if(_shift && {animationState player != "AovrPercMrunSrasWrflDf"} && {isTouchingGround player} && {stance player == "STAND"} && {speed player > 2} && {!life_is_arrested} && {(velocity player) select 2 < 2.5} && {time - jumpActionTime > 1.5}) then {
jumpActionTime = time; //Update the time.
[player,true] spawn life_fnc_jumpFnc; //Local execution
[[player,false],"life_fnc_jumpFnc",nil,FALSE] call life_fnc_MP; //Global execution
_handled = true;
};
};
if (life_barrier_active) then {
switch (_code) do
{
case 56: //space key
{
[] spawn life_fnc_placeablesPlaceComplete;
};
};
true;
};
case 60:
{
closeDialog 0;[] spawn life_fnc_openMenu;
};
//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_gangMarkers;}};
};
};
//Holster / recall weapon.
case 35:
{
if(_shift && !_ctrlKey && currentWeapon player != "") 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 != "")}) 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 == west && !isNull cursorTarget && cursorTarget isKindOf "Man" && (isPlayer cursorTarget) && (side cursorTarget in [civilian,independent]) && alive cursorTarget && cursorTarget distance player < 3.5 && !(cursorTarget getVariable "Escorting") && !(cursorTarget getVariable "restrained") && speed cursorTarget < 1) then
{
[] call life_fnc_restrainAction;
};
};
//Knock out, this is experimental and yeah...
case 34:
{
if(_shift) then {_handled = true;};
if(_shift && playerSide == civilian && !isNull cursorTarget && cursorTarget isKindOf "Man" && isPlayer cursorTarget && alive cursorTarget && cursorTarget distance player < 4 && speed cursorTarget < 1) then
{
if((animationState cursorTarget) != "Incapacitated" && (currentWeapon player == primaryWeapon player OR currentWeapon player == handgunWeapon player) && currentWeapon player != "" && !life_knockout && !(player getVariable["restrained",false]) && !life_istazed) then
{
[cursorTarget] spawn life_fnc_knockoutAction;
};
};
};
//T Key (Trunk)
case 20:
{
if(!_alt && !_ctrlKey) then
{
if(vehicle player != player && alive vehicle player) then
{
if((vehicle player) in life_vehicles) then
{
[vehicle player] call life_fnc_openInventory;
};
}
else
{
if((cursorTarget isKindOf "Car" OR cursorTarget isKindOf "Air" OR cursorTarget isKindOf "Ship" OR cursorTarget isKindOf "House_F") && player distance cursorTarget < 7 && vehicle player == player && alive cursorTarget) then
{
if(cursorTarget in life_vehicles OR {!(cursorTarget getVariable ["locked",true])}) then
{
[cursorTarget] call 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"]) then {
if(!isNil {vehicle player getVariable "lights"}) then {
if(playerSide == 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; };
//Licht für Kart
if(playerSide == civilian) then {
if(vehicle player != player && (typeOf vehicle player in ["C_Kart_01_F","C_Kart_01_Fuel_F","C_Kart_01_Blu_F","C_Kart_01_Red_F","C_Kart_01_Vrana_F","C_Kart_01_green_F","C_Kart_01_orange_F","C_Kart_01_white_F","C_Kart_01_yellow_F","C_Kart_01_black_F"])) then {
if(!isNil {vehicle player getVariable "lights"}) then {
[vehicle player] call life_fnc_cartLights;
_handled = true;
} else {
vehicle player setVariable ["lights", FALSE, TRUE];
[vehicle player] call life_fnc_cartLights;
_handled = true;
};
};
};
};
if(_shift && (playerSide == east)) then {
if(vehicle player != player && (typeOf vehicle player) in ["C_Offroad_01_F"]) then {
if(!isNil {vehicle player getVariable "lights"}) then {
[vehicle player] call life_fnc_adacSirenLights;
_handled = true;
};
};
};
//Y Player Menu
case 21:
{
if(!_alt && !_ctrlKey && !dialog) then
{
[] call life_fnc_p_openMenu;
};
};
//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 == west) then {
[[_veh],"life_fnc_copSiren",nil,true] spawn life_fnc_MP;
} else {
//I do not have a custom sound for this and I really don't want to go digging for one, when you have a sound uncomment this and change medicSiren.sqf in the medical folder.
//[[_veh],"life_fnc_medicSiren",nil,true] spawn life_fnc_MP;
};
};
};
};
//U Key
case 22:
{
if(!_alt && !_ctrlKey) then {
if(vehicle player == player) then {
_veh = cursorTarget;
} else { //www.infinity-core.de
_veh = vehicle player;
};
if(_veh isKindOf "House_F" && playerSide == civilian) then {
if(_veh in life_vehicles && player distance _veh < 8) then {
_door = [_veh] call life_fnc_nearestDoor;
if(_door == 0) exitWith {hint "Du bist nicht in der Nähe einer Tür!"};
_locked = _veh getVariable [format["bis_disabled_Door_%1",_door],0];
if(_locked == 0) then {
_veh setVariable[format["bis_disabled_Door_%1",_door],1,true];
_veh animate [format["door_%1_rot",_door],0];
systemChat "You have locked that door.";
} else {
_veh setVariable[format["bis_disabled_Door_%1",_door],0,true];
_veh animate [format["door_%1_rot",_door],1];
systemChat "Du hast die Tür aufgeschlossen.";
};
};
} else {
_locked = locked _veh;
if(_veh in life_vehicles && player distance _veh < 8) then
{
if(_locked == 2) then
{
if(local _veh) then
{
_veh lock 0;
_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_rear',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];
}
else
{
[[_veh,0], "life_fnc_lockVehicle",_veh,false] spawn life_fnc_MP;
_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_rear',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];
};
hint composeText [ image "icons\unlock.paa", " Fahrzeug aufgeschlossen" ];
player say3D "unlock";
}
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_rear',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];
}
else
{
[[_veh,2], "life_fnc_lockVehicle",_veh,false] spawn life_fnc_MP;
_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_rear',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];
};
hint composeText [ image "icons\lock.paa", " Fahrzeug abgeschlossen" ];
player say3D "car_lock";
};
};
};
};
};
};
_handled;
Alles anzeigen
aus dem tutorial:
Code
...
//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"]) then {
if(!isNil {vehicle player getVariable "lights"}) then {
if(playerSide == 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; };
//VON HIER VON HIER VON HIER VON HIER VON HIER VON HIER
//Licht für Kart
if(playerSide == civilian) then {
if(vehicle player != player && (typeOf vehicle player in ["C_Kart_01_F","C_Kart_01_Fuel_F","C_Kart_01_Blu_F","C_Kart_01_Red_F","C_Kart_01_Vrana_F","C_Kart_01_green_F","C_Kart_01_orange_F","C_Kart_01_white_F","C_Kart_01_yellow_F","C_Kart_01_black_F"])) then {
if(!isNil {vehicle player getVariable "lights"}) then {
[vehicle player] call life_fnc_cartLights;
_handled = true;
} else {
vehicle player setVariable ["lights", FALSE, TRUE];
[vehicle player] call life_fnc_cartLights;
_handled = true;
};
};
};
};
// BIS HIER BIS HIER BIS HIER BIS HIER BIS HIER
//Y Player Menu
...
Alles anzeigen
meine vehicleShopBuy
Code
/*
File: fn_vehicleShopBuy.sqf
Author: Bryan "Tonic" Boardwine
Description:
Does something with vehicle purchasing.
*/
private["_mode","_spawnPoints","_className","_basePrice","_colorIndex","_spawnPoint","_vehicle"];
_mode = _this select 0;
if((lbCurSel 2302) == -1) exitWith {hint localize "STR_Shop_Veh_DidntPick"};
_className = lbData[2302,(lbCurSel 2302)];
_vIndex = lbValue[2302,(lbCurSel 2302)];
_vehicleList = [life_veh_shop select 0] call life_fnc_vehicleListCfg; _basePrice = (_vehicleList select _vIndex) select 1;
if(_mode) then {_basePrice = round(_basePrice * 1.5)};
_colorIndex = lbValue[2304,(lbCurSel 2304)];
//Series of checks (YAY!)
if(_basePrice < 0) exitWith {}; //Bad price entry
if(life_cash < _basePrice) exitWith {hint format[localize "STR_Shop_Veh_NotEnough",[_basePrice - life_cash] call life_fnc_numberText];};
if(!([_className] call life_fnc_vehShopLicenses) && _className != "B_MRAP_01_hmg_F") exitWith {hint localize "STR_Shop_Veh_NoLicense"};
_spawnPoints = life_veh_shop select 1;
_spawnPoint = "";
if((life_veh_shop select 0) == "med_air_hs") then {
if(count(nearestObjects[(getMarkerPos _spawnPoints),["Air"],35]) == 0) exitWith {_spawnPoint = _spawnPoints};
} else {
//Check if there is multiple spawn points and find a suitable spawnpoint.
if(typeName _spawnPoints == typeName []) then {
//Find an available spawn point.
{if(count(nearestObjects[(getMarkerPos _x),["Car","Ship","Air"],5]) == 0) exitWith {_spawnPoint = _x};} foreach _spawnPoints;
} else {
if(count(nearestObjects[(getMarkerPos _spawnPoints),["Car","Ship","Air"],5]) == 0) exitWith {_spawnPoint = _spawnPoints};
};
};
if(_spawnPoint == "") exitWith {hint localize "STR_Shop_Veh_Block";};
life_cash = life_cash - _basePrice;
hint format[localize "STR_Shop_Veh_Bought",getText(configFile >> "CfgVehicles" >> _className >> "displayName"),[_basePrice] call life_fnc_numberText];
//Spawn the vehicle and prep it.
if((life_veh_shop select 0) == "med_air_hs") then {
_vehicle = createVehicle [_className,[0,0,999],[], 0, "NONE"];
waitUntil {!isNil "_vehicle"}; //Wait?
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _spawnPoint,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
_vehicle lock 2;
[[_vehicle,_colorIndex],"life_fnc_colorVehicle",true,false] spawn life_fnc_MP;
[_vehicle] call life_fnc_clearVehicleAmmo;
[[_vehicle,"trunk_in_use",false,true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
[[_vehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
} else {
_vehicle = createVehicle [_className, (getMarkerPos _spawnPoint), [], 0, "NONE"];
waitUntil {!isNil "_vehicle"}; //Wait?
_vehicle allowDamage false; //Temp disable damage handling..
_vehicle lock 2;
_vehicle setVectorUp (surfaceNormal (getMarkerPos _spawnPoint));
_vehicle setDir (markerDir _spawnPoint);
_vehicle setPos (getMarkerPos _spawnPoint);
[[_vehicle,_colorIndex],"life_fnc_colorVehicle",true,false] spawn life_fnc_MP;
[_vehicle] call life_fnc_clearVehicleAmmo;
[[_vehicle,"trunk_in_use",false,true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
[[_vehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
};
//Side Specific actions.
switch(playerSide) do {
case west: {
[_vehicle,"cop_offroad",true] spawn life_fnc_vehicleAnimate;
};
case civilian: {
if((life_veh_shop select 2) == "civ" && {_className == "B_Heli_Light_01_F"}) then {
[_vehicle,"civ_littlebird",true] spawn life_fnc_vehicleAnimate;
};
case independent: {
[_vehicle,"med_offroad",true] spawn life_fnc_vehicleAnimate;
};
case east: {
[_vehicle,"adac_offroad",true] spawn life_fnc_vehicleAnimate;
};
};
_vehicle allowDamage true;
//life_vehicles set[count life_vehicles,_vehicle]; //Add err to the chain.
life_vehicles pushBack _vehicle;
[[getPlayerUID player,playerSide,_vehicle,1],"TON_fnc_keyManagement",false,false] spawn life_fnc_MP;
if(_mode) then {
if(!(_className in ["B_G_Offroad_01_armed_F","B_MRAP_01_hmg_F"])) then {
[[(getPlayerUID player),playerSide,_vehicle,_colorIndex],"TON_fnc_vehicleCreate",false,false] spawn life_fnc_MP;
};
};
[0] call SOCK_fnc_updatePartial;
closeDialog 0; //Exit the menu.
true;
Alles anzeigen
aus dem tutorial:
Code
switch(playerSide) do {
case west: {
[_vehicle,"cop_offroad",true] spawn life_fnc_vehicleAnimate;
};
case civilian: {
if((life_veh_shop select 2) == "civ" && {_className == "B_Heli_Light_01_F"}) then {
[_vehicle,"civ_littlebird",true] spawn life_fnc_vehicleAnimate;
};
// AB HIER AB HIER AB HIER AB HIER AB HIER:
if((life_veh_shop select 2) == "civ" && (_className in ["C_Kart_01_F","C_Kart_01_Fuel_F","C_Kart_01_Blu_F","C_Kart_01_Red_F","C_Kart_01_Vrana_F","C_Kart_01_green_F","C_Kart_01_orange_F","C_Kart_01_white_F","C_Kart_01_yellow_F","C_Kart_01_black_F"])) then {
[_vehicle,"civ_cart",true] spawn life_fnc_vehicleAnimate;
};
// BIS HIER BIS HIER BIS HIER BIS HIER BIS HIER
};
case independent: {
[_vehicle,"med_offroad",true] spawn life_fnc_vehicleAnimate;
};
};
Alles anzeigen
meine vehicleAnimate:
Code
/*
File: fn_vehicleAnimate.sqf
Author: Bryan "Tonic" Boardwine
Description:
Pass what you want to be animated.
*/
private["_vehicle","_animate","_state"];
_vehicle = [_this,0,Objnull,[Objnull]] call BIS_fnc_param;
if(isnull _vehicle) exitwith {}; //FUCK
_animate = [_this,1,"",["",[]]] call BIS_fnc_param;
_preset = [_this,2,false,[false]] call BIS_fnc_param;
if(!_preset) then
{
if(count _animate > 1) then
{
{
_vehicle animate[_x select 0,_x select 1];
} foreach _animate;
}
else
{
_vehicle animate[_animate select 0,_animate select 1];
};
}
else
{
switch (_animate) do
{
case "civ_littlebird":
{
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
_vehicle animate ["addDoors",1];
_vehicle animate ["addBenches",0];
_vehicle animate ["addTread",0];
_vehicle animate ["AddCivilian_hide",1];
_vehicle lockCargo [2,true];
_vehicle lockCargo [3,true];
_vehicle lockCargo [4,true];
_vehicle lockCargo [5,true];
};
case "civ_cart":
{
_lightmidcart = "Land_FloodLight_F" createVehicle getpos _vehicle;
_lightmidcart attachTo [_vehicle, [0.06, 1.0, -0.8]];
_lightmidcart setDir ((getDir _vehicle)-90);
[_vehicle, _lightmidcart] spawn {
waitUntil{not alive (_this select 0)};
deleteVehicle (_this select 1);
};
};
case "service_truck":
{
//waitUntil{!isNil {_vehicle getVariable "color"}};
_vehicle animate ["HideServices", 0];
_vehicle animate ["HideDoor3", 1];
};
case "med_offroad":
{
if(typeOf _vehicle == "C_Offroad_01_F") then {
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
};
_vehicle animate ["HidePolice", 0];
_vehicle setVariable["lights",false,true];
};
case "cop_offroad":
{
if(typeOf _vehicle == "C_Offroad_01_F") then {
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
};
_vehicle animate ["HidePolice", 0];
_vehicle animate ["HideBumper1", 0];
_vehicle setVariable["lights",false,true];
};
case "adac_offroad":
{
if(typeOf _vehicle == "C_Offroad_01_F") then {
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
};
_vehicle animate ["HideServices", 0];
_vehicle animate ["HideConstruction", 0];
_vehicle animate ["HideBumper1", 0];
_vehicle animate ["HideBumper2", 0];
_vehicle setVariable["lights",false,true];
};
};
};
Alles anzeigen
tutorial:
Code
switch (_animate) do
{
case "civ_littlebird":
{
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
_vehicle animate ["addDoors",1];
_vehicle animate ["addBenches",0];
_vehicle animate ["addTread",0];
_vehicle animate ["AddCivilian_hide",1];
_vehicle lockCargo [2,true];
_vehicle lockCargo [3,true];
_vehicle lockCargo [4,true];
_vehicle lockCargo [5,true];
};
// AB HIER AB HIER AB HIER AB HIER AB HIER AB HIER
case "civ_cart":
{
_lightmidcart = "Land_FloodLight_F" createVehicle getpos _vehicle;
_lightmidcart attachTo [_vehicle, [0.06, 1.0, -0.8]];
_lightmidcart setDir ((getDir _vehicle)-90);
[_vehicle, _lightmidcart] spawn {
waitUntil{not alive (_this select 0)};
deleteVehicle (_this select 1);
};
};
//BIS HIER BIS HIER BIS HIER BIS HIER BIS HIER BIS HIER
case "service_truck":
{
//waitUntil{!isNil {_vehicle getVariable "color"}};
_vehicle animate ["HideServices", 0];
_vehicle animate ["HideDoor3", 1];
};
case "med_offroad":
{
if(typeOf _vehicle == "C_Offroad_01_F") then {
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
};
_vehicle animate ["HidePolice", 0];
_vehicle setVariable["lights",false,true];
};
case "cop_offroad":
{
if(typeOf _vehicle == "C_Offroad_01_F") then {
waitUntil {!isNil {_vehicle getVariable "Life_VEH_color"}};
};
_vehicle animate ["HidePolice", 0];
_vehicle animate ["HideBumper1", 0];
_vehicle setVariable["lights",false,true];
};
};
Alles anzeigen
meine spawnVehicle:
Code
/*
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"];
_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;
_unit_return = _unit;
_name = name _unit;
_side = side _unit;
_unit = owner _unit;
if(_vid == -1 OR _pid == "") exitWith {};
if(_vid in serv_sv_use) exitWith {};
serv_sv_use pushBack _vid;
_query = format["SELECT id, side, classname, type, pid, alive, active, plate, color FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];
waitUntil{sleep (random 0.3); !DB_Async_Active};
_tickTime = diag_tickTime;
_queryResult = [_query,2] call DB_fnc_asyncCall;
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(typeName _queryResult == "STRING") exitWith {};
_vInfo = _queryResult;
if(isNil "_vInfo") exitWith {serv_sv_use = serv_sv_use - [_vid];};
if(count _vInfo == 0) exitWith {serv_sv_use = serv_sv_use - [_vid];};
if((_vInfo select 5) == 0) exitWith
{
serv_sv_use = serv_sv_use - [_vid];
[[1,format[(localize "STR_Garage_SQLError_Destroyed"),_vInfo select 2]],"life_fnc_broadcast",_unit,false] spawn life_fnc_MP;
};
if((_vInfo select 6) == 1) exitWith
{
serv_sv_use = serv_sv_use - [_vid];
[[1,format[(localize "STR_Garage_SQLError_Active"),_vInfo select 2]],"life_fnc_broadcast",_unit,false] spawn life_fnc_MP;
};
if(typeName _sp != "STRING") then {
_nearVehicles = nearestObjects[_sp,["Car","Air","Ship"],10];
} else {
_nearVehicles = [];
};
if(count _nearVehicles > 0) exitWith
{
serv_sv_use = serv_sv_use - [_vid];
[[_price,_unit_return],"life_fnc_garageRefund",_unit,false] spawn life_fnc_MP;
[[1,(localize "STR_Garage_SpawnPointError")],"life_fnc_broadcast",_unit,false] spawn life_fnc_MP;
};
_query = format["UPDATE vehicles SET active='1' WHERE pid='%1' AND id='%2'",_pid,_vid];
waitUntil {!DB_Async_Active};
[_query,false] spawn DB_fnc_asyncCall;
if(typeName _sp == "STRING") 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]);
sleep 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],"life_fnc_addVehicle2Chain",_unit,false] spawn life_fnc_MP;
[_pid,_side,_vehicle,1] call TON_fnc_keyManagement;
_vehicle lock 2;
//Reskin the vehicle
[[_vehicle,_vInfo select 8],"life_fnc_colorVehicle",nil,false] spawn life_fnc_MP;
_vehicle setVariable["vehicle_info_owners",[[_pid,_name]],true];
_vehicle setVariable["dbInfo",[(_vInfo select 4),_vInfo select 7]];
//_vehicle addEventHandler["Killed","_this spawn TON_fnc_vehicleDead"]; //Obsolete function?
[_vehicle] call life_fnc_clearVehicleAmmo;
//Sets of animations
if((_vInfo select 1) == "civ" && (_vInfo select 2) == "B_Heli_Light_01_F" && _vInfo select 8 != 13) then
{
[[_vehicle,"civ_littlebird",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
if((_vInfo select 1) == "civ" && (_vInfo select 2) in ["C_Kart_01_F","C_Kart_01_Fuel_F","C_Kart_01_Blu_F","C_Kart_01_Red_F","C_Kart_01_Vrana_F","C_Kart_01_green_F","C_Kart_01_orange_F","C_Kart_01_white_F","C_Kart_01_yellow_F","C_Kart_01_black_F"]) then
{
[[_vehicle,"civ_cart",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
if((_vInfo select 1) == "cop" && (_vInfo select 2) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F"]) then
{
[[_vehicle,"cop_offroad",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
if((_vInfo select 1) == "med" && (_vInfo select 2) == "C_Offroad_01_F") then
{
[[_vehicle,"med_offroad",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
if((_vInfo select 1) in "adac" && (_vInfo select 2) in "C_Offroad_01_F") then
{
[[_vehicle,"adac_offroad",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
[[1,"Your vehicle is ready!"],"life_fnc_broadcast",_unit,false] spawn life_fnc_MP;
serv_sv_use = serv_sv_use - [_vid];
Alles anzeigen
aus dem tutorial:
Code
//Sets of animations
if((_vInfo select 1) == "civ" && (_vInfo select 2) == "B_Heli_Light_01_F" && _vInfo select 8 != 13) then
{
[[_vehicle,"civ_littlebird",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
//AB HIER AB HIER AB HIER AB HIER AB HIER:
if((_vInfo select 1) == "civ" && (_vInfo select 2) in ["C_Kart_01_F","C_Kart_01_Fuel_F","C_Kart_01_Blu_F","C_Kart_01_Red_F","C_Kart_01_Vrana_F","C_Kart_01_green_F","C_Kart_01_orange_F","C_Kart_01_white_F","C_Kart_01_yellow_F","C_Kart_01_black_F"]) then
{
[[_vehicle,"civ_cart",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
// BIS HIER BIS HIER BIS HIER BIS HIER BIS HIER BIS HIER
if((_vInfo select 1) == "cop" && (_vInfo select 2) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F"]) then
{
[[_vehicle,"cop_offroad",true],"life_fnc_vehicleAnimate",_unit,false] spawn life_fnc_MP;
};
Alles anzeigen