Jump to content
  • 0

What's the correct way to use if statements in ArmA 2 scripts? (ExtraRC specific)


DY357LX

Question

So after installing the - I got thinking about what else I could add right-click menus to.

 

I decided that in order to test a few things, I'd make it so that only Admins could right-click that item.

 

I've modded the extra_rc.hpp file and think this looks right... mostly.

class ExtraRc 
{
    class ItemBloodbag 
	{
        class Use 
		{
            text = "Use Bloodbag";
            script = "execVM 'custom\SelfBB.sqf'";
        };
    };
	if ((getPlayerUID player) in ["ADMINUID1","ADMINUID2"]) then
	{
		class FoodSteakCooked
		{
			class Use
			{
				text = "Script 1 Test.";
				script = "execVM 'custom\customScript1.sqf'";		
			};
		};
	};
};

However, I'm a little concerned that's there's no "else" or "exit with".

I know that in other programming languages you don't always need those but the ArmA 2 Community/Dev Wiki isn't exactly clear on that.

 

Finally, is there a way to add right-click to a key? Checking for "ItemKeyGreen" etc doesn't seem like it would work due to the random 3/4 digits

after the item/class name.

Is there a wildcard type check the ArmA 2 engine lets us use? i.e ItemKeyGreen*

 

 

Thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

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
  • Discord

×
×
  • Create New...