Jump to content
Repentz

[Tutorial] Seatbelts

Recommended Posts

life_actions pushBack (player addAction["<t color = '#D660D6'>Put on Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' !life_seatbelt && vehicle player != player ']);
life_actions pushBack (player addAction["<t color = '#D660D6'>Remove Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' life_seatbelt && vehicle player != player ']);

 

i did not understand this part, where should i put these strings? Help me pls.

Share this post


Link to post
Share on other sites
22 hours ago, Madanazzi said:
life_actions pushBack (player addAction["<t color = '#D660D6'>Put on Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' !life_seatbelt && vehicle player != player ']);
life_actions pushBack (player addAction["<t color = '#D660D6'>Remove Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' life_seatbelt && vehicle player != player ']);

 

i did not understand this part, where should i put these strings? Help me pls.

See:

On 10/1/2016 at 5:43 PM, Repentz said:

Next, let's go into core/setupActions.sqf, place this at the very bottom to enable for all sides:

 

Share this post


Link to post
Share on other sites

it must be so?

/*
    File: fn_setupActions.sqf
    Author:

    Description:
    Master addAction file handler for all client-based actions.
*/

life_actions = [];

switch (playerSide) do {

    //Civilian
    case civilian: {
        //Drop fishing net
        life_actions pushBack (player addAction[localize "STR_pAct_DropFishingNet",life_fnc_dropFishingNet,"",0,false,false,"",'
        (surfaceisWater (getPos vehicle player)) && (vehicle player isKindOf "Ship") && life_carryWeight < life_maxWeight && speed (vehicle player) < 2 && speed (vehicle player) > -1 && !life_net_dropped ']);

        //Rob person
        life_actions pushBack (player addAction[localize "STR_pAct_RobPerson",life_fnc_robAction,"",0,false,false,"",'
        !isNull cursorObject && player distance cursorObject < 3.5 && isPlayer cursorObject && animationState cursorObject == "Incapacitated" && !(cursorObject getVariable ["robbed",false]) ']);
    };
    
    //Cops
    case west: { };
    
    //EMS
    case independent: { };

life_actions pushBack (player addAction["<t color = '#D660D6'>Put on Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' !life_seatbelt && vehicle player != player ']);
life_actions pushBack (player addAction["<t color = '#D660D6'>Remove Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' life_seatbelt && vehicle player != player ']);

};

Help me pls

Edited by Madanazzi

Share this post


Link to post
Share on other sites
On 1/17/2017 at 12:48 AM, Taco Duck said:

No Crap you have to change the location of the img to what yours is i guessing icons\ico_apple.paa and icons\ico_coffee.paa


So change 

"rg_client\HUD\seatbeltOff.paa";

to 

 

For off or on whatever

 

i have teh same problm and already chage teh location 

Share this post


Link to post
Share on other sites
On 10/1/2016 at 10:43 PM, Repentz said:

SEATBELTS

handledamage: by Snipes mad

dialog, eventHandlers, addaction, etc: by Repentz

 

 

This script allows you to put on/take off your seatbelt when inside a vehicle, I have also fixed the problem of the seatbelt not disabling when exiting your vehicle

Currently, the seatbelt reduces crash damage by 50%, I would put in an ejection function, but arma 3 desync leads to the script thinking you have crashed and ejecting you.

 

Let's begin

 

Go into core/Configuration.sqf, place this in the variables:

life_seatbelt = false;

Next, let's go into core/setupActions.sqf, place this at the very bottom to enable for all sides:

life_actions pushBack (player addAction["<t color = '#D660D6'>Put on Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' !life_seatbelt && vehicle player != player ']);
life_actions pushBack (player addAction["<t color = '#D660D6'>Remove Seatbelt</t>",life_fnc_seatbelt,"",7,false,false,"",' life_seatbelt && vehicle player != player ']);

Go into core/functions/handleDamage.sqf, place this near the bottom before hudUpdate

if ((vehicle _unit) isKindOf "Car" && (isNull _source || _source isEqualTo _unit)) then
{
	_damage = if (life_seatbelt) then { _damage / 2 } else { _damage};
};

Create a file in core/functions called fn_seatBelt.sqf:

/*
//--By Repentz for altisLifeRPG
*/

#include "..\..\script_macros.hpp"
/*
	fn_seatBelt.sqf
*/
//playSound "seatbelt"; //--Enable this to play a sound when you put your seatbelt on
if(!life_seatbelt) then {
	life_seatbelt = true;
} else {
	life_seatbelt = false;
};

//[] call life_fnc_hudUpdate; //--Enable this if you are putting a hud option to display when your seatbelt is on.

Go into functions.hpp in main directory, find functions section, add this:

class seatbelt {};

Go into initPlayerLocal in your main directory, add this after "if (LIFE_SETTINGS(getNumber,"spyGlass_toggle") isEqualTo 1) then {[] execVM "SpyGlass\fn_initSpy.sqf";};"

if (hasInterface) then {
    player addEventHandler ["GetOutMan", {
        life_seatbelt = false;
        //[] call life_fnc_hudUpdate; //--Enable if you are putting a hud option to display when your seatbelt is on
    }];
};

if (hasInterface) then {
    player addEventHandler ["GetInMan", {
        life_seatbelt = false;
        //[] call life_fnc_hudUpdate; //--Enable if you are putting a hud option to display when your seatbelt is on
    }];
};

Optional: If you want to have a icon display when you're inside your vehicle, and your seatbelt is on or off, put this in your hud_stats.hpp:

#define IDC_LIFE_BAR_SeatBelt 4203

then

LIFE_BAR_SeatBelt

then

class LIFE_BAR_SeatBelt: Life_RscPicture
{
    idc = IDC_LIFE_BAR_SeatBelt;
    text = "";
    x = 0.952292 * safezoneW + safezoneX;
    y = 0.664333 * safezoneH + safezoneY;
    w = 0.0331042 * safezoneW;
    h = 0.0589743 * safezoneH;
};

This is still for optional icon display, go into hudUpdate:

#define IDC_LIFE_BAR_SeatBelt 4203

then

if(!isNil "life_seatbelt") then {
    if ( vehicle player != player ) then {
        if(life_seatbelt) then {
            LIFEctrl(IDC_LIFE_BAR_SeatBelt) ctrlSetText "rg_client\HUD\seatbeltOn.paa";
        } else {
            LIFEctrl(IDC_LIFE_BAR_SeatBelt) ctrlSetText "rg_client\HUD\seatbeltOff.paa";
        };
    } else {
        LIFEctrl(IDC_LIFE_BAR_SeatBelt) ctrlSetText "";
    };
};

You will have to find your own icons, sounds, and position the icon wherever you wish if you want these features, also remember for the seatbelt sound to call it in description.ext as a new sound.

 

Done.

Pls fix your script not work the icon command

Share this post


Link to post
Share on other sites

I'm Having issues with mine. Can someone help me out here? I'm fairly sure i'm putting them in right but the 5.0 syntax might be different?

Functions.hpp

initPlayerLocal.sqf

fn_setupActions.sqf

configuration.sqf

fn_handleDamage.sqf

fn_seatbelt.sqf

arma3server_2019-01-07_19-33-34.rpt

Edited by dexatrin82
Added Server RPT file

Share this post


Link to post
Share on other sites
13 hours ago, dexatrin82 said:

I'm Having issues with mine. Can someone help me out here? I'm fairly sure i'm putting them in right but the 5.0 syntax might be different?

You created your own thread for this so responses will be directed there for your issues:

 

Share this post


Link to post
Share on other sites
11 hours ago, StormTrooper said:

i tried to put it on my server but my server never indicated it was on

 

Does the icon show at all? Did you uncomment the lines in initPlayerLocal that mention updating if you have that icon? Do you still take full damage with the belt on?

Share this post


Link to post
Share on other sites
On 1/29/2019 at 6:56 AM, imthatguyhere said:

Does the icon show at all? Did you uncomment the lines in initPlayerLocal that mention updating if you have that icon? Do you still take full damage with the belt on?

didnt have an icon at all its like all the scripts and stuff i out in wasnt there

Share this post


Link to post
Share on other sites

So i have a problem. The seat-belt icon only seems to update as soon as i have injured myself or i have lost some hunger. is there a way to make it update as soon as i get in a vehicle?  i am using 4.4r4

Edited by Josh Bernstein

Share this post


Link to post
Share on other sites
On 7/28/2019 at 11:11 AM, Josh Bernstein said:

So i have a problem. The seat-belt icon only seems to update as soon as i have injured myself or i have lost some hunger. is there a way to make it update as soon as i get in a vehicle?  i am using 4.4r4

Read the tutorial and uncomment all these lines:
 

        //[] call life_fnc_hudUpdate; //--Enable if you are putting a hud option to display when your seatbelt is on

You clearly didn't do that for the getIn/getOut yet.

Share this post


Link to post
Share on other sites
On 8/7/2019 at 4:07 AM, imthatguyhere said:

Read the tutorial and uncomment all these lines:
 

        //[] call life_fnc_hudUpdate; //--Enable if you are putting a hud option to display when your seatbelt is on

You clearly didn't do that for the getIn/getOut yet.

Hi, sorry i realized that just after i posted my comment. 
The script works fine but thanks for answering my question. 

 

Share this post


Link to post
Share on other sites

Anyone as found a solution to make the car play a loop sound of warning because the seatbelt is not on
When the player put the seatbelt on, the sound stop
I try but i can't found a working code :(

Share this post


Link to post
Share on other sites
6 hours ago, MrVoLRoDFr said:

Anyone as found a solution to make the car play a loop sound of warning because the seatbelt is not on
When the player put the seatbelt on, the sound stop
I try but i can't found a working code :(

Can you make a long .ogg? Like 20 minutes long, so it keeps playing until you put it on?

Share this post


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

Can you make a long .ogg? Like 20 minutes long, so it keeps playing until you put it on?

I can but I think when the seat belt is on, the song keep playing, I am afraid of that, I don't found a function to kill the sound then the seat belt is on

I want to found a code like, if the seat belt is off and the engine of the car is started, the sound ring until the seat belt is on, when the seat belt is on, the sound stop and again when the player put off the seat belt (like a actual car) 

I hope you understand me, I am French and I am a little bad in English haha 😂 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.