Home   Help Search Login Register  

Author Topic: Count player  (Read 1515 times)

0 Members and 1 Guest are viewing this topic.

Offline ACE5th

  • Members
  • *
Count player
« on: 09 Nov 2008, 19:43:23 »
Hi @ All

I wuold like to screen All Players inside a trigger (Name Trigger1)

I Know about this command
Code: [Select]
hint format["%1", name (thislist select 0)]
but this command is only for one i would like to have All in a list.

Can anybody tell me what i have to do?

greez
ACE5th

Offline ModestNovice

  • Members
  • *
Re: Count player
« Reply #1 on: 10 Nov 2008, 04:04:35 »
Code: [Select]
hint format ["%1", thisList]
dont know if that is right or maybe this one:

Code: [Select]
{List_array = []; List_Array = List_Array + [_x]} foreach thisList; hint format ["%1", List_Array]
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Count player
« Reply #2 on: 10 Nov 2008, 12:24:04 »
@DaChevs:
The former is correct , but the poster asked for a list of player names, not varnames (or object-ids, should the players be un-var-named). The latter continually clears the array on each loop, so in the end you'll just give out the last element of thisList (even if it initialised it correctly, by placing List_array = [] before the loop, it would just be copying thisList).

Being lazy, this leaves a ", " after the last name in the list:
Code: [Select]
str = ""; { str = str + (name _x) + ", "} forEach thisList; hint str;
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)