Difference between revisions of "DCS hook onPlayerChangeSlot"
From DCS World Wiki - Hoggitworld.com
(Created page with "{{Template:DCS_hooks_callbacks |fName= onPlayerChangeSlot |vNum= 2.5.0 |par1= hook |par2= |par3= |par4= |desc= Occurs when a player successfully...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 21: | Line 21: | ||
|reqType1= number | |reqType1= number | ||
− | |reqName1= | + | |reqName1= playerId |
|reqType2= | |reqType2= | ||
Line 37: | Line 37: | ||
List of Callbacks: {{listOfDCSHooks}} | List of Callbacks: {{listOfDCSHooks}} | ||
− | |examples= | + | |examples= The following populates a table indexed by player names with the last slot they were in. |
+ | |||
+ | local hook = {} | ||
+ | local playerUnitList = {} | ||
+ | function hook.onPlayerChangeSlot(playerID) | ||
+ | local playerName = net.get_player_info(playerID, 'name') | ||
+ | local slot = net.get_player_info(playerID, 'slot') | ||
+ | playerUnitList[playerName] = slot | ||
+ | end | ||
+ | |||
|notes= | |notes= | ||
}} | }} | ||
[[Category:DCS Hooks|onPlayerChangeSlot]] | [[Category:DCS Hooks|onPlayerChangeSlot]] |
Latest revision as of 23:09, 18 August 2023