Jump to content
Sign in to follow this  
Norbak

nul = [] execvm... , nul = [player] execVM... and nul = [toon1] execvm...

Recommended Posts

Differences between:

1) Nul = [] execVM "admin.sqf"

2) Nul = [toon1] execVM "admin.sqf"

3) Nul = [player] execVM "admin.sqf"

can anyone help please?. I need that command to be only for some admins. They are inside

Trigger:

Condition:

(local player) && {((getPlayerUID player) in Adminlist)}

On ACT:

1) ,2) or 3) ????

Share this post


Link to post
Share on other sites
Differences between:

1) Nul = [] execVM "admin.sqf"

2) Nul = [toon1] execVM "admin.sqf"

3) Nul = [player] execVM "admin.sqf"

can anyone help please?. I need that command to be only for some admins. They are inside

Trigger:

Condition:

(local player) && {((getPlayerUID player) in Adminlist)}

On ACT:

1) ,2) or 3) ????

4:rolleyes:

_= [player] execVM "admin.sqf"

Share this post


Link to post
Share on other sites

Guys, either you need/wanna keep a handle to the script you're spawning:

_scriptHandle = [player] execVM "admin.sqf";

// ...do something with _scriptHandle later on, 
// e.g. check whether it has already finished or not with scriptDone

...or you don't:

[player] execVM "admin.sqf";

And that "Nul = ..."-nonsense... at least make sure you don't ever write that Null correctly (bwaha).

I think, you will only ever be forced to actually assign that stuff to something while using those little textfields in the ingame-editor (e.g. for triggers); guess that's where this crap comes from in the first place... :rolleyes:

EDIT: ooohhhh... so this is indeed about the ingame-editor textfields, right? Nevermind then... :D

Share this post


Link to post
Share on other sites
4:rolleyes:

_= [player] execVM "admin.sqf"

I can't understand. Why "_= [player]"? . I thought triggers in Editor were always global, but "_" is local.

Share this post


Link to post
Share on other sites

The trigger is global, but you get something back upon calling execVM, namely the script handle. Since you're in the editor, you need to assign this return-value to something, otherwise the editor bitches around. Now you could litter the global namespace and assign it to some global variable. But if you're not going to need that script handle, then that's just littering, so don't do that. Instead it's better to do as shown by Dimon: assign it to some local variable, and your global namespace will remain clean.

Share this post


Link to post
Share on other sites
Differences between:

1) Nul = [] execVM "admin.sqf"

2) Nul = [toon1] execVM "admin.sqf"

3) Nul = [player] execVM "admin.sqf"

can anyone help please?. I need that command to be only for some admins. They are inside

Trigger:

Condition:

(local player) && {((getPlayerUID player) in Adminlist)}

On ACT:

1) ,2) or 3) ????

So your problem is that you want that script admin.sqf only to be executed if the player activating the trigger is an admin.

The most simple way would be to check for (local player) && {((getPlayerUID player) in Adminlist)} at the beginning of admin.sqf. This way you could execute the script for anyone but stop it if the player is not an admin.

Therefor ...

[player] execVM "admin.sqf";

... would be your choice.

I think your "real" problem here is the condition set to the trigger.

Since the player-object is always local ... (local player) will never fail.

As far as I know the code inside the trigger is only executed on the maschine that created the trigger. In multiplayer that always should be the server.

To really make use of the trigger-conzept you should rely to its very own special variables "this" and "thislist".

See: https://community.bistudio.com/wiki/Mission_Editor:_Triggers

or: http://killzonekid.com/arma-scripting-tutorials-triggers/

... for tutorials about triggers.

The problem with your code might be that no matter who activates the trigger the condition will always return true if the player creating the trigger is an admin.

In this case you would need something like ...

_trigger setTriggerStatements [	"true",
			"
				{
					if (getPlayerUID _x in AdminList) then {
						PV_doAdminSQF = _x;
						(owner _x) publicVariableClient 'PV_doAdminSQF';
					};
				} count thislist;
			",
			""]

Of course you need to set a PVEH to handle the call from above.

"PV_doAdminSQF" addPublicVariableEventHandler { (_this select 1) execVM "admin.sqf"; };

I hope that matched with your problem.

Greetings

Balthorius

Share this post


Link to post
Share on other sites

Ouch .that was really complete but harder.

Thanks guys!

Share this post


Link to post
Share on other sites

There's actually a trigger is absolutely ridiculous!

init.sqf

if(!isServer || local player)then
{
       FFA_SYSADMIN=((getPlayerUID player) in ["","",""]);
	if (isServer || FFA_SYSADMIN) then
{ 
	[] execVM "Adminsys_menu.sqf";
};
};

...and that's all!

Share this post


Link to post
Share on other sites

Is the admin menu still avaible when the player dies? Or need to reload the command?. Thank you.

Share this post


Link to post
Share on other sites

it depends on what you have written in admin.sqf.

Share this post


Link to post
Share on other sites

It is a script full of commands for an admin. And only for an admin.

So a trigger it was a easier way to get this working. It has REPEATABLE option to restart the script when he's dead.

Share this post


Link to post
Share on other sites
It is a script full of commands for an admin. And only for an admin.

So a trigger it was a easier way to get this working. It has REPEATABLE option to restart the script when he's dead.

if(!isServer || local player)then
{
       FFA_SYSADMIN=((getPlayerUID player) in ["","",""]);
	if (isServer || FFA_SYSADMIN) then
{ 
               admin= compile preprocessFileLineNumbers "admin.sqf";
	[] spawn admin;// [] call admin;
               player AddEventHandler ["Respawn",{_this spawn admin;}];//for BIS_MENU_GroupCommunication it is not required
};
};

repeat again:

it depends on what you have written in admin.sqf.

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  

×