Jump to content

Recommended Posts

Hello there,

 

I seem to have a little of an issues regarding the multiplayer frameweork. Long story short, I am using the multiplayer framework to add an actionand to remove it afterwards (see example below). However, removing that specific action doesn't seem to work, does anyone have an idea why?

 

Thanks in advance!


	_gear = [nil , _unit, rAddAction, "Gear", "client\gear.sqf",[],-1,false] call RE;

			
	[nil, _unit, "per", rREMOVEACTION, _gear] call RE;

Everything seems to work in my script, but the removeaction part. There's also stuff going on after the Removeaction part which works perfectly well.

Share this post


Link to post
Share on other sites

An RE call won't return an action ID, it returns the results of validation checks, true when all is good, false or nil when it fails.

 

rAddAction stores locally the action ID as a variable in the target object.  You have to pass in a variable name or it doesn't get stored.  To have the variable name stored, the full addAction parameters have to also be passed in (default values can be used).  The rAddAction script receives parameters:

(required:)
-----------
caller = select 0		// not used
target = select 1		// object receiving the action
title = select 2		// title of the action that appears
script = select 3		// script that executes

(optional:)
-----------
arguments = select 4		// arguments to pass into the script, default: []
priority = select 5		// priority in action list, default: 100 (rAddAction makes it very high priority)
showWindow = select 6		// show action text mid-screen, default: true
hideOnUse = select 7		// hide action when used, default: true
shortcut = select 8		// action shortcut key, default: ""
condition = select 9		// (stringed) condition for action to appear, default: "true"
variableName = select 10	// variable name for storing the action ID (string, you decide the variable name)

Not passing in a variable name results in the action getting added without the ID being stored.  That would be for actions that won't be removed.

 

For actions that will get removed, pass in all parameters + variable name and the action ID is stored locally in the object.  rRemoveAction uses the variable name to identify the action and remove it.

 

The object keeps the variable with the action ID, rRemoveAction won't nil it away.  If an rAddAction with the same variable name is added again, the variable gets updated with the new ID number.

 

Untested, but might see if this works, "addedGearAction" is the stored variable name:

_nic = [nil, _unit, rAddAction, "Gear", "client\gear.sqf", [], 0, false, true, "", "true", "addedGearAction"] call RE;

_nic = [nil, _unit, rRemoveAction, "addedGearAction"] call RE;

 

Share this post


Link to post
Share on other sites

I will try that out later, I will keep you updated.

 

Thanks in advance!

 

~ Creative

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
Sign in to follow this  

×