Jump to content
dennis159

Count online players in a special faction with special condition

Recommended Posts

Hey,

I've got a fire system script for my (modded) Altis Life roleplay server.

In the standard script there is a restriction that building fires only can be triggerd if there is a minimum ammount of medics (independet units) on the server.

The code for this is:

_PlayerCount = independent countSide allPlayers;
if (_PlayerCount >= (getNumber(MissionconfigFile >> "Fire_Config" >> "CountOfPlayer"))) then {

 

On my Server there are the EMS and FireDepartment both on the Independet units.

So, with this code the fire also can be triggered if there are no Fire Department units on duty, what souldn't be, because the EMS is not able to extinguis the fire.

 

To solve this problem I want to change this _PlayerCount in a way, that only firefighters are counted.
Firefighters got ingame a speacial license named "license_med_fw", so we have to count all online independet units weher own the firedepartmets license.

 

Sadly i have no Idea how to do this in the script. The Scriptfile we have to edit, is in a PBO file in our Modpack (Clientside Modpack)

 

Has anyone any idea how to fix this?
Thanks in advance!

 

your sincerly,

Dennis 

Share this post


Link to post
Share on other sites

@dennis159, depending on where the license is stored, the solution might look like this:

_PlayerCount = { ((side (group _x)) == independent) and { _x getVariable ["license_med_fw", false] } } count allPlayers;

 

  • Like 1

Share this post


Link to post
Share on other sites

Schatten is quite right in their answer, but if you don't provide more information, mainly on where the "licence" is stored (inventory, as a variable, etc.) you won't be able to get a "spot-on" answer easily.

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

×