Custom Weapon HUD

chinadayz

New Member
https://github.com/DAmNRelentless/CustomWeaponHUD
my server 1.0.5.1
There was a thread about the same script for 1.0.5.1?
Where do i find it? Or, if someone has the github link, share please.
Looks like this

e755f2f826be4307bdbaa163c825147f.png
 
ripped from my 1.0.5 repack

lets you switch weapons and use bandage, only has 1 primary weapon

create a folder called scripts then create a folder called weaponswitch inside

description.ext
add at top
Code:
//Weapon HUD
#include "scripts\weaponswitch\weaponHud.hpp"

dayz_spaceInterrupt.sqf
add just above _handled
Code:
//Weapon Switch
if (_dikCode == 0x02) then {player selectWeapon (primaryWeapon player);};
if (_dikCode == 0x03) then { _handgun ="";{if((getNumber (configFile >> "CfgWeapons" >> (_x) >> "type")) == 2) then {_handgun = _x;};}foreach weapons player;player selectweapon _handgun;};
if (_dikCode == 0x04) then {[0,0,0,[player]] execVM "\z\addons\dayz_code\medical\bandage.sqf";};
if (_dikCode == 0x05) then { };

init.sqf
Code:
if (!isserver) then {
execvm "scripts\weaponswitch\weaponHud.sqf";
};

weaponhud.hpp
create new file called weaponhud.hpp and save in scripts/weaponswitch
Code:
class weaponHud
    {
        idd = -1;
        movingenable = true;
        duration = 3;
        onLoad = "((_this select 0) displayCtrl 1200) ctrlSetText (gettext (configFile >> 'cfgWeapons' >> (primaryWeapon player) >> 'picture'));{if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith {((_this select 0) displayCtrl 1201) ctrlSetText (gettext(configFile >> 'cfgWeapons' >> _x >> 'picture'));};} foreach weapons player;_hasbandage = 'ItemBandage' in magazines player;if (_hasbandage) then {(_this select 0) displayCtrl 1202 ctrlSetText (gettext (configFile >> 'cfgMagazines' >> 'itembandage' >> 'picture'));};";
        class Controls
        {

         
//START DIALOG         

class RscText_1002: RscText
{
    idc = 1002;
    text = "1";
    x = 0.276647 * safezoneW + safezoneX;
    y = 0.909196 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};

class RscText_1003: RscText
{
    idc = 1003;
    text = "2";
    x = 0.387408 * safezoneW + safezoneX;
    y = 0.908743 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};

class RscText_1000: RscText
{
    idc = 1000;
    text = "3";
    x = 0.500773 * safezoneW + safezoneX;
    y = 0.911168 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};
class RscText_1001: RscText
{
    idc = 1001;
    text = "4";
    x = 0.611519 * safezoneW + safezoneX;
    y = 0.90753 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};


class RscPicture_1200: RscPicture
{
    idc = 1200;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.290628 * safezoneW + safezoneX;
    y = 0.911168 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

class RscPicture_1201: RscPicture
{
    idc = 1201;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.401556 * safezoneW + safezoneX;
    y = 0.90753 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

class RscPicture_1202: RscPicture
{
    idc = 1202;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.51492 * safezoneW + safezoneX;
    y = 0.909955 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

class RscPicture_1203: RscPicture
{
    idc = 1203;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.626441 * safezoneW + safezoneX;
    y = 0.905106 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
}; 

//END DIALOG

        };
    };

weaponHud.sqf
create new file called weaponhud.sqf and save in scripts/weaponswitch
Code:
disableserialization;
_layer = 100;
while {true} do {
sleep 2.5;
if (_layer == 100) then {_layer = 101;} else { _layer = 100;};
_layer cutrsc ["weaponHud","Plain",1];
};


hope this helps :)

i will try make it support 2 primary weapons if i get time
 
ripped from my 1.0.5 repack

lets you switch weapons and use bandage, only has 1 primary weapon

create a folder called scripts then create a folder called weaponswitch inside

description.ext
add at top
Code:
//Weapon HUD
#include "scripts\weaponswitch\weaponHud.hpp"

dayz_spaceInterrupt.sqf
add just above _handled
Code:
//Weapon Switch
if (_dikCode == 0x02) then {player selectWeapon (primaryWeapon player);};
if (_dikCode == 0x03) then { _handgun ="";{if((getNumber (configFile >> "CfgWeapons" >> (_x) >> "type")) == 2) then {_handgun = _x;};}foreach weapons player;player selectweapon _handgun;};
if (_dikCode == 0x04) then {[0,0,0,[player]] execVM "\z\addons\dayz_code\medical\bandage.sqf";};
if (_dikCode == 0x05) then { };

init.sqf
Code:
if (!isserver) then {
execvm "scripts\weaponswitch\weaponHud.sqf";
};

weaponhud.hpp
create new file called weaponhud.hpp and save in scripts/weaponswitch
Code:
class weaponHud
    {
        idd = -1;
        movingenable = true;
        duration = 3;
        onLoad = "((_this select 0) displayCtrl 1200) ctrlSetText (gettext (configFile >> 'cfgWeapons' >> (primaryWeapon player) >> 'picture'));{if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith {((_this select 0) displayCtrl 1201) ctrlSetText (gettext(configFile >> 'cfgWeapons' >> _x >> 'picture'));};} foreach weapons player;_hasbandage = 'ItemBandage' in magazines player;if (_hasbandage) then {(_this select 0) displayCtrl 1202 ctrlSetText (gettext (configFile >> 'cfgMagazines' >> 'itembandage' >> 'picture'));};";
        class Controls
        {

        
//START DIALOG        

class RscText_1002: RscText
{
    idc = 1002;
    text = "1";
    x = 0.276647 * safezoneW + safezoneX;
    y = 0.909196 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};

class RscText_1003: RscText
{
    idc = 1003;
    text = "2";
    x = 0.387408 * safezoneW + safezoneX;
    y = 0.908743 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};

class RscText_1000: RscText
{
    idc = 1000;
    text = "3";
    x = 0.500773 * safezoneW + safezoneX;
    y = 0.911168 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};
class RscText_1001: RscText
{
    idc = 1001;
    text = "4";
    x = 0.611519 * safezoneW + safezoneX;
    y = 0.90753 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
};


class RscPicture_1200: RscPicture
{
    idc = 1200;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.290628 * safezoneW + safezoneX;
    y = 0.911168 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

class RscPicture_1201: RscPicture
{
    idc = 1201;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.401556 * safezoneW + safezoneX;
    y = 0.90753 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

class RscPicture_1202: RscPicture
{
    idc = 1202;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.51492 * safezoneW + safezoneX;
    y = 0.909955 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

class RscPicture_1203: RscPicture
{
    idc = 1203;
    text = "#(argb,8,8,3)color(0,0,0,0)";
    x = 0.626441 * safezoneW + safezoneX;
    y = 0.905106 * safezoneH + safezoneY;
    w = 0.0700046 * safezoneW;
    h = 0.0700182 * safezoneH;
    colorBackground[] = {0,0,0,0};
};

//END DIALOG

        };
    };

weaponHud.sqf
create new file called weaponhud.sqf and save in scripts/weaponswitch
Code:
disableserialization;
_layer = 100;
while {true} do {
sleep 2.5;
if (_layer == 100) then {_layer = 101;} else { _layer = 100;};
_layer cutrsc ["weaponHud","Plain",1];
};


hope this helps :)

i will try make it support 2 primary weapons if i get time
Thank you very much,I already have this,I need to 2 primary weapons。
非常感谢您·这个脚本我之前已经实现了,还是非常期待2个 primary weapons。
 
Back
Top