Jump to content
MC.Quit

showing player list and giving an "addAction" to a selected player

Recommended Posts

Hello i'm pretty new to scripting and i want to make a mission with a one admin slot.

So I want the Admin slot to have a "addAction" that show the admin all the players in the session.

An when he selects 1 player that player gets some "AddAction" commands that allow him to do stuff.

As a new guy to all this scripting stuff i do not know how to make it happen. PLEASE PLEASE PLEASE help me.

:) thanks have a good day (:

i though about some thing like that...

 

down here would be the idea

---------

on the admin slot would be an "addAction" with the action

(Give Power)

when the "Give Power" action is pressed

the players list would be shown

and the player that the admin selects gets some power

example :

----------

Give Power

--------------

Player list <-- would be in green text

Shawn

Jhon

Alex

Dan

----------

if Dan is selected then a hint/titletext would appear and say

"Dan has been giving admin power"

and then Dan has some addactions that i would make.

Share this post


Link to post
Share on other sites

I think you are diving in way too deep. I recommend you Google and learn the basics to start with. Another way would be to use getPlayerUID command with an array of UIDs.

adminsArr =
[
	"12345",
	"54321"
];

player addAction ["Show online admins",
{
	private _onlineAdmins = [];
	{
		if (!isNull _x && getPlayerUID _x in adminsArr) then
		{
			_onlineAdmins pushBack (name _x);
		};
	} forEach playableUnits;
	hintSilent format ["Online admins: %1", _onlineAdmins];
}];

Could probably ditch the forEach with simple method using nested adminsArr which contains UID + name then use joinString/splitString perhaps.

player addAction ["God Mode", {if (isDamageAllowed (_this select 0)) then {(_this select 0) allowDamage false;} else {(_this select 0) allowDamage true;};}, nil, 0, false, false, "", "(getPlayerUID _this in adminsArr"];

Not tested.

Share this post


Link to post
Share on other sites
23 hours ago, HazJ said:

I think you are diving in way too deep. I recommend you Google and learn the basics to start with. Another way would be to use getPlayerUID command with an array of UIDs.


adminsArr =
[
	"12345",
	"54321"
];

player addAction ["Show online admins",
{
	private _onlineAdmins = [];
	{
		if (!isNull _x && getPlayerUID _x in adminsArr) then
		{
			_onlineAdmins pushBack (name _x);
		};
	} forEach playableUnits;
	hintSilent format ["Online admins: %1", _onlineAdmins];
}];

Could probably ditch the forEach with simple method using nested adminsArr which contains UID + name then use joinString/splitString perhaps.


player addAction ["God Mode", {if (isDamageAllowed (_this select 0)) then {(_this select 0) allowDamage false;} else {(_this select 0) allowDamage true;};}, nil, 0, false, false, "", "(getPlayerUID _this in adminsArr"];

Not tested.

Awesome! works perfect! thanks

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

×