Difference between revisions of "DCS func addCommandForGroup"
From DCS World Wiki - Hoggitworld.com
m (1 revision imported) |
|||
Line 47: | Line 47: | ||
|optType2= | |optType2= | ||
− | |examples= | + | |examples= The following iterates the table, finds their groupIds, and passes the groupName to the imLost function whenever someone from the group selects the F10 choice. |
+ | local function imLost(gName) | ||
+ | -- whatever | ||
+ | end | ||
+ | local tbl = {'group1', 'group2', 'group3', 'group4' ,'group5'} | ||
+ | for i = 1, #tbl do | ||
+ | if Group.getByName(tbl[i]) then | ||
+ | local groupId = Group.getByName(tbl[i]):getID | ||
+ | missionCommands.addCommandForGroup(groupId, 'Halp', nil , imLost, tbl[i]) | ||
+ | end | ||
+ | end | ||
|related= | |related= | ||
[[DCS_singleton_missionCommands|'''missionCommands Functions:''']] {{listOfMissionCommandFuncs}} | [[DCS_singleton_missionCommands|'''missionCommands Functions:''']] {{listOfMissionCommandFuncs}} |