DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionStopEngine.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STOPENGINE;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7 m_Text = "#stop_engine";
8 }
9
11 {
14 }
15
16 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
17 {
18 HumanCommandVehicle vehCmd = player.GetCommand_Vehicle();
19 if (vehCmd && vehCmd.GetVehicleSeat() == DayZPlayerConstants.VEHICLESEAT_DRIVER)
20 {
21 Transport trans = vehCmd.GetTransport();
22 if (trans)
23 {
24 Car car;
25 if (Class.CastTo(car, trans) && car.EngineIsOn())
26 {
27 return car.GetSpeedometerAbsolute() <= 8;
28 }
29 }
30 }
31
32 return false;
33 }
34
35 override void OnExecuteServer(ActionData action_data)
36 {
37 HumanCommandVehicle vehCmd = action_data.m_Player.GetCommand_Vehicle();
38 if (vehCmd)
39 {
40 Transport trans = vehCmd.GetTransport();
41 if (trans)
42 {
43 CarScript car;
44 if (Class.CastTo(car, trans))
45 {
46 car.EngineStop();
47 }
48 }
49 }
50 }
51
52 override void OnExecuteClient(ActionData action_data) {}
53
54 override bool CanBeUsedInVehicle()
55 {
56 return true;
57 }
58
59 override bool UseMainItem()
60 {
61 return false;
62 }
63};
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
protected int m_StanceMask
Definition ActionBase.c:53
class ActionTargets ActionTarget
PlayerBase m_Player
Definition ActionBase.c:33
override void OnExecuteServer(ActionData action_data)
override void CreateConditionComponents()
override void OnExecuteClient(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override bool UseMainItem()
override bool CanBeUsedInVehicle()
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native Transport GetTransport()
proto native int GetVehicleSeat()
Base native class for all motorized wheeled vehicles.
Definition Car.c:80
float GetSpeedometerAbsolute()
Returns the current speed of the vehicle in km/h. Value is absolute.
Definition Car.c:88
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.