Jump to content
Ryanblm

Trying to make a interact player while in a vehicle

Recommended Posts

Hey guys so im trying to get the Vinteractmenu to work so that when pressed and the cop selects Ticket player or eventually checks license's it will allow them to not have to step out of the car, this is to improve roleplay, however everything i have tried so far doesn't work and i dont know sqf scripting well enough yet to figure it out :(
 

what i have tried so far,

    // -- Button 7 (ticket player)
        _Btn7 ctrlSetText localize "STR_pInAct_TicketBtn";
        _Btn7 buttonSetAction "driver call life_fnc_ticketAction;";

    // -- Button 7 (ticket player)
        _Btn7 ctrlSetText localize "STR_pInAct_TicketBtn";
        _Btn7 buttonSetAction "[life_vInact_curTarget] call life_fnc_ticketAction;";

but im also not sure whether it might be better to somehow have the ticket script itself be able to target the driver or not...

 

thankyou guys, any help will be helpful :)

 

Share this post


Link to post
Share on other sites

Not Tested!

This will allow you to access the cop interaction menu for the driver whilst they are in the vehicle(dah they're the driver).

It will then only show the check licenses and ticket options.

 

Firstly you need to add another button to your "vIteraction_Menu" dialog,

Example: https://hastebin.com/idaqunekuy.hs

Then do  this in your "fn_vInteractionMenu",

Define you new button at the top:

Spoiler
#define Btn1 37450
#define Btn2 37451
#define Btn3 37452
#define Btn4 37453
#define Btn5 37454
#define Btn6 37455
#define Btn7 37456
#define Title 37401

 

Define the local variable for your new button:

Spoiler
_display = findDisplay 37400;
_Btn1 = _display displayCtrl Btn1;
_Btn2 = _display displayCtrl Btn2;
_Btn3 = _display displayCtrl Btn3;
_Btn4 = _display displayCtrl Btn4;
_Btn5 = _display displayCtrl Btn5;
_Btn6 = _display displayCtrl Btn6;
_Btn7 = _display displayCtrl Btn7;

 

Add the following variable:

_driver = driver life_vInact_curTarget;

The above variable must be added after:

life_vInact_curTarget = _curTarget;

Then after:

Spoiler
    if (_curTarget isKindOf "Ship") then {
        _Btn6 ctrlSetText localize "STR_vInAct_PushBoat";
        _Btn6 buttonSetAction "[] spawn life_fnc_pushObject; closeDialog 0;";
        if (_curTarget isKindOf "Ship" && {local _curTarget} && {crew _curTarget isEqualTo []}) then { _Btn6 ctrlEnable true;} else {_Btn6 ctrlEnable false};
    } else {
        if (!isNil "_id") then {
            if !(_id in getDLCs 1) then {
                _Btn6 ctrlSetText localize "STR_vInAct_GetInVehicle";
                _Btn6 buttonSetAction "player moveInDriver life_vInact_curTarget; closeDialog 0;";
                if (crew _curTarget isEqualTo [] && {canMove _curTarget} && {locked _curTarget isEqualTo 0}) then {_Btn6 ctrlEnable true;} else {_Btn6 ctrlEnable false};
            };
        } else {
            _Btn6 ctrlSetText localize "STR_vInAct_Unflip";
            _Btn6 buttonSetAction "life_vInact_curTarget setPos [getPos life_vInact_curTarget select 0, getPos life_vInact_curTarget select 1, (getPos life_vInact_curTarget select 2)+0.5]; closeDialog 0;";
            if (alive _curTarget && {crew _curTarget isEqualTo []} && {canMove _curTarget}) then { _Btn6 ctrlEnable false;} else {_Btn6 ctrlEnable true;};
        };
    };

 

Add:

Spoiler
    if !(isNull _driver) then {
        _inCar = true;
        _Btn7 ctrlSetText "Driver Interact Menu";
        _Btn7 buttonSetAction "[_driver,_inCar] call life_fnc_copInteractionMenu";
    } else {
        _Btn7 ctrlEnable false;
    };

 

Then in your "fn_copInteractionMenu" do the following:

Underneath,

_curTarget = param [0,objNull,[objNull]];

Add,

_inCar = param [1,false,[false]];

Then do:

Below or above,

if (player getVariable ["isEscorting",false]) then {
    { _x ctrlShow false; } forEach [_Btn1,_Btn2,_Btn3,_Btn5,_Btn6,_Btn7,_Btn8];
};

Add,

if (_inCar) then {
    { _x ctrlShow false; } forEach [_Btn1,_Btn3,_Btn4,_Btn6,_Btn7,_Btn8];
};

Let me know how it goes.

  • Like 2

Share this post


Link to post
Share on other sites

hey @KillerAussie thankyou for this help so far, right now the registering the driver works on the vehicle interaction menu side of things, however when it transfers other to the copinteraction menu, it comes up as target is null :(

however thankyou so far

Share this post


Link to post
Share on other sites

Interesting,

Try adding the following code into your fn_copInteraction

Below,

_inCar = param [1,false,[false]];

Add,

_curTarget = if (_inCar) then { driver life_vInact_curTarget } else { _curTarget };

 

Share this post


Link to post
Share on other sites

Hey @KillerAussie

     i have now tried that part aswell and still the check licenses doesnt do anything and the ticket player still comes up with , player target is nil.

thankyou so far for helping me KillerAussie

Edited by Ryanblm
removed stuff that i put in, didnt read properly

Share this post


Link to post
Share on other sites

Hey mate, I am finding it hard to recreate and test this on my own. If you PM your TS or Discord I will join and give you a hand to sort this out. Thanks.

 

Edited by KillerAussie

Share this post


Link to post
Share on other sites
On 3/13/2018 at 6:36 AM, ToxicRageTv said:

Did you guys get this working or did you want help?

 

We got it working to some extent. It needs more work done though. Sorry for the late reply.

Edited by KillerAussie

Share this post


Link to post
Share on other sites
1 hour ago, KillerAussie said:

We got it working to some extent. It needs more work done though. Sorry for the late reply.

np, lmk if you guys want a hand

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×