Jump to content
ruPal

[Addon] Start with lowered weapon

Recommended Posts

I want to make an addon that forces players to start mission with lowered weapons.
Here is my config.cpp:

class CfgPatches
{
    class ruPal_weapon_down
    {
        units[]={};
        weapons[]={};
        requiredVersion=0.1;
        requiredAddons[]=
        {
            "cba_xeh"
        };
    };
};
class Extended_PostInit_Eventhandlers
{
    class CAManBase
    {
        init="_this execVM '\ruPal_weapon_down\weapon_down.sqf'";
    };
};

And script:
 

if (isDedicated) exitWith {};
waitUntil {!isNull findDisplay 46};  
if !(weaponLowered player) then {player action ['WeaponOnBack', player]};

Looks like it works but I am not sure that made it in right way. May somebody check it, please?
Btw, at start I can see how I lower my weapon. Is it possible to improve it somehow and start with lowered weapon?

Share this post


Link to post
Share on other sites

hell GUYS

get away from that extended EH shit ...

class CfgPatches
{
    class ruPal_weapon_down
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {};
        author = "Kukus";
        mail = "YoureEmail@Goes.here";
    };
};
class CfgFunctions
{
    class <GimmeSomeRandomTagThatComesUpInYourMind>
    {
        class RandomCategory
        {
            class myPostInit
            {
                preInit = 0;
                postInit = 1;
                preStart = 0;
                headerType = -1;
                recompile = 0;
                ext = ".sqf";
                file = "Path/To/File.sqf";
            };
        };
    };
};
removed CBA requirement (congrats ...)

 

[] spawn
{
    if (isDedicated) exitWith {};
    waitUntil {!isNull player};
    waitUntil {alive player};
    if (!(weaponLowered player)) then
    {
        player action ['WeaponOnBack', player];
    };
};
cleaned up your code too

for the testing ... just PBO it and check it, the code itself looks fine ...

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×