Jump to content

Rubber Bullets | working on 4.4R3 - 5.0


Recommended Posts

Title: Rubber Bullets / Advanced Tazer

Owner: Mike Black

Difficulty: Easy

This is the handleDamage from V5.0 - 4.4R3

 

Quote
params [
    ["_unit",objNull,[objNull]],
    ["_part","",[""]],
    ["_damage",0,[0]],
    ["_source",objNull,[objNull]],
    ["_projectile","",[""]],
    ["_index",0,[0]]
];

//Handle the tazer first (Top-Priority).
if (!isNull _source) then {
    if (_source != _unit) then {
        if (currentMagazine _source in ["11Rnd_45ACP_Mag"] && _projectile in ["B_45ACP_Ball"]) then { //attention I changed it to mag and projectile!!
            if (side _source isEqualTo west || (side _source isEqualTo civilian) && (playerSide isEqualTo civilian) || (playerSide isEqualTo west)) then {
                _damage = 0;
                if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
                    private ["_distance"];
                    _distance = 100;
                    if (_unit distance _source < _distance) then {
                        if !(isNull objectParent player) then {
                            if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
                                player action ["Eject",vehicle player];
                                [_unit,_source] spawn life_fnc_tazed;
                            };
                        } else {
                            [_unit,_source] spawn life_fnc_tazed;
                        };
                    };
                };
            };

            //Temp fix for super tasers on cops.
            if (side _source isEqualTo west || (side _source isEqualTo civilian) && (playerSide isEqualTo independent)) then {
                _damage = 0;
            };
        };

		//Rubberbullets
		if (currentMagazine _source in ["30Rnd_65x39_caseless_mag_Tracer"] && _projectile in ["B_65x39_Caseless"]) then { //attention I changed it to mag and projectile!!
            if (side _source isEqualTo west && playerSide isEqualTo civilian) then {
                _damage = 0;
                if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
                    private ["_distance"];
                    _distance = 300;
                    if (_unit distance _source < _distance) then {
                        if !(isNull objectParent player) then {
                            if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
                                player action ["Eject",vehicle player];
                                [_unit,_source] spawn life_fnc_tazedRubber; //change this too
                            };
                        } else {
                            [_unit,_source] spawn life_fnc_tazedRubber; // here too
                        };
                    };
                };
            };

            //Temp fix for super tasers on cops.
            if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
                _damage = 0;
            };
        };
    };
};
I think you can see what I've done. If not ask 

-------------------------------------------------------------------------------------------

then you copy your tazed.sqf and rename it with fn_tazedRubber.sqf.

Here you can see what to edit:

 

Quote
#include "..\..\script_macros.hpp"
/*
    File: fn_tazed.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Starts the tazed animation and broadcasts out what it needs to.
*/
private ["_curWep","_curMags","_attach"];
params [
    ["_unit",objNull,[objNull]],
    ["_shooter",objNull,[objNull]]
];

if (isNull _unit || isNull _shooter) exitWith {player allowDamage true; life_istazed = false;};

if (_shooter isKindOf "Man" && alive player) then {
    if (!life_istazed) then {
        life_istazed = true;
        _curWep = currentWeapon player;
        _curMags = magazines player;
        _attach = if (!(primaryWeapon player isEqualTo "")) then {primaryWeaponItems player} else {[]};

        {player removeMagazine _x} forEach _curMags;
        player removeWeapon _curWep;
        player addWeapon _curWep;
        if (!(count _attach isEqualTo 0) && !(primaryWeapon player isEqualTo "")) then {
            {
                _unit addPrimaryWeaponItem _x;
            } forEach _attach;
        };

        if (!(count _curMags isEqualTo 0)) then {
            {player addMagazine _x;} forEach _curMags;
        };

        [_unit] remoteExecCall ["life_fnc_tazeSound",RCLIENT]; //comment this out if you dont want to have an sound
        _obj = "Land_ClutterCutter_small_F" createVehicle ASLTOATL(visiblePositionASL player);
        _obj setPosATL ASLTOATL(visiblePositionASL player);
        [player,"AinjPfalMstpSnonWnonDf_carried_fallwc"] remoteExecCall ["life_fnc_animSync",RCLIENT];
        //[0,"STR_NOTF_Tazed",true,[profileName, _shooter getVariable ["realname",name _shooter]]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
        _unit attachTo [_obj,[0,0,0]];
        disableUserInput true;
        sleep 40; //edit your time you want to tazed the player

        [player,"AmovPpneMstpSrasWrflDnon"] remoteExecCall ["life_fnc_animSync",RCLIENT];

        if (!(player getVariable ["Escorting",false])) then {
            detach player;
        };
        life_istazed = false;
        player allowDamage true;
        disableUserInput false;
    };
} else {
    _unit allowDamage true;
    life_iztazed = false;
};

 

Then go to your Function.hpp and search under class Civilian:

(This calls the script to work ;))

Quote
class tazed {};  //add under this

class tazedRubber {}; //this

Ready!!

 

If something not work ask me please ;)

 

Have fun with this

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

My Server!

b_560_95_1.png

Hello everyone I am happy to say we have got a server its a Altis Life server So why not come check us out it can't hurt ;)

Project Narnia Website: www.project-narnia-rpg.com

In-game server IP: 164.132.200.207:2302

Teamspeak: ts.project-narnia-rpg.com

Edited by Josh
Link to post
Share on other sites
15 hours ago, DEVIL666 said:

How can i add it to a rifle or mx 6.5mm for example?

 

 

if (currentMagazine _source in ["30Rnd_65x39_caseless_mag_Tracer"] && _projectile in ["B_65x39_Caseless"]) then { //attention I changed it to mag and projectile!!

It's already set up for the MX weapons.

 

If you want to change it, go here and find the Magazine class name, along with the projectile name https://community.bistudio.com/wiki/Arma_3_CfgMagazines

MX Tracer Magazine is 30Rnd_65x39_caseless_mag_Tracer

The projectile is B_65x39_Caseless

Link to post
Share on other sites

Thought I'd share my rubber bullet script, and I use the term mine very loosely. This script use to belong on an old 3.1.4.8 MidgetGrimm server that he himself posted on his github a long time ago, I believe right before he quit Arma??? I'm not sure, someone correct me if I am wrong. Anyway heres what I use for the tazedRubber.sqf. Once again I take no credit for this, and all credit is given to Skalicon, Mahribar, and MidgetGrimm. I included my ingame name in the authors because I updated this script from 3.1.4.8 to run on 5.0 and since this no longer is available anywhere, I thought I'd include my game name in it.

#include "..\..\script_macros.hpp"
/*
	File: fn_tazedRubber.sqf
	Author: Skalicon modded by Mahribar
	Further modded and updated to 5.0 by Edward Cullen
	
	Description: Downed state for rubber bullets
*/
private["_curWep","_curMags","_attach"];
params [
    ["_unit",objNull,[objNull]],
    ["_shooter",objNull,[objNull]]
];

if(isNull _unit OR isNull _shooter) exitWith {player allowDamage true; life_isdowned = false;};

if(_shooter isKindOf "Man" && alive player) then
{
	if(!life_isdowned) then
	{
		life_isdowned = true;
		player setDamage 0.5;
		
		_curWep = currentWeapon player;
		_curMags = magazines player;
		_attach = if(primaryWeapon player != "") then {primaryWeaponItems _unit} else {[]};
		{player removeMagazine _x} foreach _curMags;
		player removeWeapon _curWep;
		player addWeapon _curWep;
		if(count _attach != 0 && primaryWeapon _unit != "") then
		{
			{
				_unit addPrimaryWeaponItem _x;
			} foreach _attach;
		};
		if(count _curMags != 0) then
		{
			{player addMagazine _x;} foreach _curMags;
		};
	
		_obj = "Land_ClutterCutter_small_F" createVehicle (getPosATL _unit);
		_obj setPosATL (getPosATL _unit);
		[player,"AinjPfalMstpSnonWnonDf_carried_fallwc"] remoteExecCall ["life_fnc_animSync",RCLIENT];
		[0,"STR_NOTF_Rubber",true,[profileName, _shooter getVariable ["realname",name _shooter]]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
		_unit attachTo [_obj,[0,0,0]];
		disableUserInput true;
		sleep 8;
		if(!(player getVariable "restrained")) then {
			[player,"AinjPpneMstpSnonWrflDnon"] remoteExecCall ["life_fnc_animSync",RCLIENT];
			sleep 22;
		};
		// Check Restrain every 15 seconds for "disableUserInput"
		// I�m sure, it can be done better. Haven�t find a better way until now.
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if (!(player getVariable "restrained")) then {
			[player,"amovppnemstpsraswrfldnon"] remoteExecCall ["life_fnc_animSync",RCLIENT];
		};
		disableUserInput false;
		detach player;
		life_isdowned = false;
		player allowDamage true;
	};
}
	else
{
	_unit allowDamage true;
	life_isdowned = false;
};

Now please keep in mind, I'm not a programmer whatsoever, I'm extremely basic in terms of understanding programming language. However this script does work perfectly on my terms. It does have bugs such as the line with "player setdamage 0.5". If you shoot a person again, it will heal them back to full health after doing 50% damage to them. The sleep functions are merely in place to check if the person gets restrained (I think??) meaning that you lose all ability to control your character until you are restrained or the rubber-bullet "state" is done. You need to create a stringtable.xml for STR_NOTF_Rubber and also create a life_isdowned variable in configurations.sqf For the setdamage component I'm pretty sure you can just remove that damage part, because the magazine clip that this script uses wont damage the player regardless, since its been designated as a rubber bullet instead (someone confirm for me cause I'm not 100% sure). This has also been modified (by me) to run on the ArmaLife github version of Tanoa Life 5.0. When I say modified I mean that the areas that have the remoteExecCall weren't there since the original script had used the life_broadcast, and life_MP (3.1.4.8) methods instead of remoteExec.

My stringtable.xml (Insert under STR_NOTF_Tazed)

	<Key ID="STR_NOTF_Rubber">
            <Original>%1 was taken down by %2 with rubber bullets</Original>
        </Key>

Configuration.sqf (Insert right under life_istazed)

/*
*****************************
****** Life Variables *******
*****************************
*/

life_istazed = false;
life_isdowned = false;

If you encounter weird bugs or it doesn't work, honestly I don't think I could help and I wouldn't know how you have set up your server files, but I can try and help? Unless someone experienced steps in.

Link to post
Share on other sites
On 2.4.2017 at 4:26 PM, Ilusionz said:

 

if (currentMagazine _source in ["30Rnd_65x39_caseless_mag_Tracer"] && _projectile in ["B_65x39_Caseless"]) then { //attention I changed it to mag and projectile!!

It's already set up for the MX weapons.

 

If you want to change it, go here and find the Magazine class name, along with the projectile name https://community.bistudio.com/wiki/Arma_3_CfgMagazines

MX Tracer Magazine is 30Rnd_65x39_caseless_mag_Tracer

The projectile is B_65x39_Caseless

ok thanks m8 but is it fully working?

 

Link to post
Share on other sites
On 4/3/2017 at 7:35 PM, Rubidium said:

Thought I'd share my rubber bullet script, and I use the term mine very loosely. This script use to belong on an old 3.1.4.8 MidgetGrimm server that he himself posted on his github a long time ago, I believe right before he quit Arma??? I'm not sure, someone correct me if I am wrong. Anyway heres what I use for the tazedRubber.sqf. Once again I take no credit for this, and all credit is given to Skalicon, Mahribar, and MidgetGrimm. I included my ingame name in the authors because I updated this script from 3.1.4.8 to run on 5.0 and since this no longer is available anywhere, I thought I'd include my game name in it.

#include "..\..\script_macros.hpp"
/*
	File: fn_tazedRubber.sqf
	Author: Skalicon modded by Mahribar
	Further modded and updated to 5.0 by Edward Cullen
	
	Description: Downed state for rubber bullets
*/
private["_curWep","_curMags","_attach"];
params [
    ["_unit",objNull,[objNull]],
    ["_shooter",objNull,[objNull]]
];

if(isNull _unit OR isNull _shooter) exitWith {player allowDamage true; life_isdowned = false;};

if(_shooter isKindOf "Man" && alive player) then
{
	if(!life_isdowned) then
	{
		life_isdowned = true;
		player setDamage 0.5;
		
		_curWep = currentWeapon player;
		_curMags = magazines player;
		_attach = if(primaryWeapon player != "") then {primaryWeaponItems _unit} else {[]};
		{player removeMagazine _x} foreach _curMags;
		player removeWeapon _curWep;
		player addWeapon _curWep;
		if(count _attach != 0 && primaryWeapon _unit != "") then
		{
			{
				_unit addPrimaryWeaponItem _x;
			} foreach _attach;
		};
		if(count _curMags != 0) then
		{
			{player addMagazine _x;} foreach _curMags;
		};
	
		_obj = "Land_ClutterCutter_small_F" createVehicle (getPosATL _unit);
		_obj setPosATL (getPosATL _unit);
		[player,"AinjPfalMstpSnonWnonDf_carried_fallwc"] remoteExecCall ["life_fnc_animSync",RCLIENT];
		[0,"STR_NOTF_Rubber",true,[profileName, _shooter getVariable ["realname",name _shooter]]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
		_unit attachTo [_obj,[0,0,0]];
		disableUserInput true;
		sleep 8;
		if(!(player getVariable "restrained")) then {
			[player,"AinjPpneMstpSnonWrflDnon"] remoteExecCall ["life_fnc_animSync",RCLIENT];
			sleep 22;
		};
		// Check Restrain every 15 seconds for "disableUserInput"
		// I�m sure, it can be done better. Haven�t find a better way until now.
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if(!(player getVariable "restrained")) then {
			sleep 15;
		};
		if (!(player getVariable "restrained")) then {
			[player,"amovppnemstpsraswrfldnon"] remoteExecCall ["life_fnc_animSync",RCLIENT];
		};
		disableUserInput false;
		detach player;
		life_isdowned = false;
		player allowDamage true;
	};
}
	else
{
	_unit allowDamage true;
	life_isdowned = false;
};

Now please keep in mind, I'm not a programmer whatsoever, I'm extremely basic in terms of understanding programming language. However this script does work perfectly on my terms. It does have bugs such as the line with "player setdamage 0.5". If you shoot a person again, it will heal them back to full health after doing 50% damage to them. The sleep functions are merely in place to check if the person gets restrained (I think??) meaning that you lose all ability to control your character until you are restrained or the rubber-bullet "state" is done. You need to create a stringtable.xml for STR_NOTF_Rubber and also create a life_isdowned variable in configurations.sqf For the setdamage component I'm pretty sure you can just remove that damage part, because the magazine clip that this script uses wont damage the player regardless, since its been designated as a rubber bullet instead (someone confirm for me cause I'm not 100% sure). This has also been modified (by me) to run on the ArmaLife github version of Tanoa Life 5.0. When I say modified I mean that the areas that have the remoteExecCall weren't there since the original script had used the life_broadcast, and life_MP (3.1.4.8) methods instead of remoteExec.

My stringtable.xml (Insert under STR_NOTF_Tazed)

	<Key ID="STR_NOTF_Rubber">
            <Original>%1 was taken down by %2 with rubber bullets</Original>
        </Key>

Configuration.sqf (Insert right under life_istazed)

/*
*****************************
****** Life Variables *******
*****************************
*/

life_istazed = false;
life_isdowned = false;

If you encounter weird bugs or it doesn't work, honestly I don't think I could help and I wouldn't know how you have set up your server files, but I can try and help? Unless someone experienced steps in.

Hi Rubidium i like the look of your script please could you help me on where i can locate on where i am meant to put the magazine if u can tell me that would be great :)

Link to post
Share on other sites
On 4/6/2017 at 4:33 PM, Josh said:

Hi Rubidium i like the look of your script please could you help me on where i can locate on where i am meant to put the magazine if u can tell me that would be great :)

You mean where the magazine clip is? Essentially I used the original script for handleDowned.sqf. Heres what my script looks like. Look for the comments saying //RubberBullets. That portion of the code is needed to make the file tazedRubber.sqf work properly. As for the magazine, its the "30Rnd_65x39_caseless_mag_Tracer". I recommend using the tracer rounds because regular rounds may break other guns or other rounds if you have alot of guns setup in your police shops. All you have to do is add this magazine into the Config_Weapons.hpp file in your mission folder.

#include "..\..\script_macros.hpp"
/*
    File: fn_handleDamage.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Handles damage, specifically for handling the 'tazer' pistol and nothing else.
*/
params [
    ["_unit",objNull,[objNull]],
    ["_part","",[""]],
    ["_damage",0,[0]],
    ["_source",objNull,[objNull]],
    ["_projectile","",[""]],
    ["_index",0,[0]]
];

//Handle the tazer first (Top-Priority).
if (!isNull _source) then {
    if (_source != _unit) then {
        if (currentWeapon _source in ["hgun_P07_snds_F","arifle_SDAR_F"] && _projectile in ["B_9x21_Ball","B_556x45_dual"]) then {
            if (side _source isEqualTo west && playerSide isEqualTo civilian) then {
                _damage = 0;
                if (alive player && !life_istazed && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
                    private ["_distance"];
                    _distance = 35;
                    if (_projectile == "B_556x45_dual") then {_distance = 100;};
                    if (_unit distance _source < _distance) then {
                        if !(isNull objectParent player) then {
                            if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
                                player action ["Eject",vehicle player];
                                [_unit,_source] spawn life_fnc_tazed;
                            };
                        } else {
                            [_unit,_source] spawn life_fnc_tazed;
                        };
                    };
                };
            };

            //Temp fix for super tasers on cops.
            if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
                _damage = 0;
            };
        };
    };
};

//Rubberbullets
		if (currentMagazine _source in ["30Rnd_65x39_caseless_mag_Tracer"] && _projectile in ["B_65x39_Caseless"]) then { //attention I changed it to mag and projectile!!
            if (side _source isEqualTo west && playerSide isEqualTo civilian) then {
                _damage = 0;
                if (alive player && !life_isdowned && !life_isknocked && !(_unit getVariable ["restrained",false])) then {
                    private ["_distance"];
                    _distance = 300;
                    if (_unit distance _source < _distance) then {
                        if !(isNull objectParent player) then {
                            if (typeOf (vehicle player) == "B_Quadbike_01_F") then {
                                player action ["Eject",vehicle player];
                                [_unit,_source] spawn life_fnc_tazedRubber; //change this too
                            };
                        } else {
                            [_unit,_source] spawn life_fnc_tazedRubber; // here too
                        };
                    };
                };
            };

            //Temp fix for super tasers on cops.
            if (side _source isEqualTo west && (playerSide isEqualTo west || playerSide isEqualTo independent)) then {
                _damage = 0;
            };
        };

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

[] spawn life_fnc_hudUpdate;
_damage;

 

Config_Weapon File magazine code. Add this after your Taser Rifle magazine

For 4.4.R4

{ "30Rnd_65x39_caseless_mag_Tracer", "Rubber Bullets (6.5x39MM)", 50 },

For 5.0 (Which I'm using, you can use this)

{ "30Rnd_65x39_caseless_mag_Tracer", "Rubber Bullets (6.5x39MM)", 55, 15, "call life_coplevel >= 3" },

The two can be used interchangeable, and it wont break the code, but its better to be consistent with everything. Essentially for 5.0 the "55" means the magazine costs $55, and the "15" means it can be sold back for $15, and the "call life_coplevel >=3" means that only cops that are whitelisted to level 3 and higher will be able to view and purchase the rubber bullets. Hope this helps you out.

Currently I'm trying to rework an old script I had that allowed for Paintballs or Airsoft Arenas on my old server, if it all works out, maybe I'll post it here or as a new tutorial.

Cheers,

Allan

Link to post
Share on other sites
  • 2 months later...
  • 10 months later...
On 6/27/2017 at 11:09 AM, Alphabears said:

can u add multiple weapons as a rubber tazer and how . into the script ? becuase it seems like it only works with mx

 

if (currentMagazine _source in ["30Rnd_65x39_caseless_mag_Tracer","Other_Mag"] && _projectile in ["B_65x39_Caseless","Other_Projectile"]) then { //attention I changed it to mag and projectile!!

Personally when i made my rubber bullets i checked the players weapon and then made the tracer mags "rubber bullets" and then regular mags lethal.

Edited by ToxicRageTv
Link to post
Share on other sites
  • 2 years later...

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.