hardnick Posted November 2, 2022 Posted November 2, 2022 How do I catch Username when the Players trigger event using the MIST radio menu ? (multiplayer server) Thanks! local function setFlagsRED(v) trigger.action.setUserFlag(v.flag, v.val) missionCommands.removeItemForCoalition(coalition.side.RED, {[1] = v.path[1], [2] = v.path[2]}) end local Menu_Item = {"Menu1","Menu2"} local SubMenu_Item_1 = {"Function1", "Function2", "Function3"} local SubMenu_Item_2 = {"Function1", "Function2"} local Function_Menu1 = missionCommands.addSubMenuForCoalition(coalition.side.RED, Menu_Item[1], nil) local Function_Menu2 = missionCommands.addSubMenuForCoalition(coalition.side.RED, Menu_Item[2], nil) missionCommands.addCommandForCoalition(coalition.side.RED, SubMenu_Item_1[1], Function_Menu1, setFlagsRED, {flag=1, val=true, path={Menu_Item[1], SubMenu_Item_1[1]}}) missionCommands.addCommandForCoalition(coalition.side.RED, SubMenu_Item_1[2], Function_Menu1, setFlagsRED, {flag=2, val=true, path={Menu_Item[1], SubMenu_Item_1[2]}}) missionCommands.addCommandForCoalition(coalition.side.RED, SubMenu_Item_1[3], Function_Menu1, setFlagsRED, {flag=3, val=true, path={Menu_Item[1], SubMenu_Item_1[3]}}) missionCommands.addCommandForCoalition(coalition.side.RED, SubMenu_Item_2[1], Function_Menu2, setFlagsRED, {flag=4, val=true, path={Menu_Item[2], SubMenu_Item_2[1]}}) missionCommands.addCommandForCoalition(coalition.side.RED, SubMenu_Item_2[2], Function_Menu2, setFlagsRED, {flag=5, val=true, path={Menu_Item[2], SubMenu_Item_2[2]}})
Kanelbolle Posted November 2, 2022 Posted November 2, 2022 (edited) As far as i know you can't. The info group, unit or player is added to the menu item when you add the menu item to the player/group. Example: missionCommands.addCommandForGroup(BIRTHgroupId, 'Send JTAC Drone to my location!', rootMenu , addjtacdrone, BIRTHgroupname) BIRTHgroupname is the Group name of the group that receives this menu item, and is passed as a argument to the function "addjtacdrone" Edited November 2, 2022 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
hardnick Posted November 3, 2022 Author Posted November 3, 2022 Thank you! That's a shame...because so often people come and trick and we want to know who did it.
Kanelbolle Posted November 3, 2022 Posted November 3, 2022 12 hours ago, hardnick said: Thank you! That's a shame...because so often people come and trick and we want to know who did it. I think I was unclear and you misunderstood. The way you are doing it, you can not. If all your player slots are different groups, you can pass the group or player to the argument to a function like in my example. WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
cfrag Posted November 3, 2022 Posted November 3, 2022 (edited) Indeed. If you have single-player groups, you can also pass theGroup:getUnit(1):getPlayerName() as argument, and have that name displayed or written to the log. Edited November 3, 2022 by cfrag
Solution Grimes Posted November 4, 2022 Solution Posted November 4, 2022 You can also use https://wiki.hoggitworld.com/view/DCS_func_get_player_list which should have the player name info available. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
hardnick Posted November 5, 2022 Author Posted November 5, 2022 Thank you very much for your help I don't understand about missionCommands.addCommandForGroup don't see in this page https://wiki.hoggitworld.com/view/Category:MIST At first I thought I would use the code below to catch the player who triggers the radio menu, but every time I get it it's my own name lol serverID = net.get_server_id( ) serverName = net.get_player_info(serverID , 'name') Anyway, this is really difficult for me, and I really appreciate everyone's help.
Kanelbolle Posted November 5, 2022 Posted November 5, 2022 (edited) 6 hours ago, hardnick said: Thank you very much for your help I don't understand about missionCommands.addCommandForGroup don't see in this page https://wiki.hoggitworld.com/view/Category:MIST At first I thought I would use the code below to catch the player who triggers the radio menu, but every time I get it it's my own name lol serverID = net.get_server_id( ) serverName = net.get_player_info(serverID , 'name') Anyway, this is really difficult for me, and I really appreciate everyone's help. You can use the search up on the right on the page, here is the direct link: https://wiki.hoggitworld.com/view/DCS_func_addCommandForGroup You can example use "world.event.S_EVENT_BIRTH" to add the menu to every unit that spawns. (There are other ways, but i like to use this) https://wiki.hoggitworld.com/view/DCS_event_birth This uses event handler: https://wiki.hoggitworld.com/view/DCS_func_addEventHandler Edited November 5, 2022 by Kanelbolle WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
hardnick Posted November 6, 2022 Author Posted November 6, 2022 Thanks for the valuable information, I will try to learn
Recommended Posts