DCS-SimpleSlotBlock - Multiplayer Slot Blocking Script - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 04-01-2017, 12:20 PM   #1
Ciribob
ED Testers Team
 
Join Date: Mar 2015
Location: Brighton, UK
Posts: 1,706
Default DCS-SimpleSlotBlock - Multiplayer Slot Blocking Script

Something thats been asked a few times is an easy way to enable or disable slots on a multiplayer mission, so I've put this together. Its basically a modified version of the script I use for the CSAR slot blocking.

The script only needs to be installed by the server host.

The script can be used to:
  • Block / unblock a slot by setting a flag
  • Reserve an aircraft slot for clan members only
  • Disable the GCI / AWACS / Ground commander slot for everyone except specific players

Installation

To Install got to GitHub https://github.com/ciribob/DCS-SimpleSlotBlock and click "clone or download" and download the repository

or click this: https://github.com/ciribob/DCS-Simpl...ive/master.zip

Copy the SimpleSlotBlockGameGUI.lua to your C:\Users\\Saved Games\DCS\Scripts\hooks and into any other DCS folders e.g. DCS.openalpha\Scripts\hooks

Configuration

SSB (SimpleSlotBlock) only has a few global configuration options. These are listed in the file and shown below:

NOTE: Changes to GameGUI files only take effect after a full DCS Restart

Code:
ssb.showEnabledMessage = true -- if set to true, the player will be told that the slot is enabled when switching to it
ssb.controlNonAircraftSlots = false -- if true, only unique DCS Player ids will be allowed for the Commander / GCI / Observer Slots


-- If you set this to 0, all slots are ENABLED
-- by default as every flag starts at 0.
-- If you set this to anything other than 0 all slots
-- will be DISABLED BY DEFAULT!!!

-- Each slot will then have to be manually enabled via
-- trigger.action.setUserFlag("GROUP_NAME",100)
-- where GROUP_NAME is the group name (not pilot name) and 100 is the value you're setting the flag too which must
-- match the enabledFlagValue

ssb.enabledFlagValue = 0  -- what value to look for to enable a slot.


-- any aircraft slot controlled by the GROUP Name (not pilotname!)
-- that contains a prefix below will only allow players with that prefix
-- to join the slot
--
-- NOTE: the player prefix must match exactly including case
-- The examples below can be turned on by removing the -- in front
--
ssb.prefixes = {
     -- "-=104th=-",
    -- "-=VSAAF=-",
    -- "ciribob", -- you could also add in an actual player name instead
    "some_clan_tag",
    "-=AnotherClan=-",
}


-- any NON aircraft slot eg JTAC / GCI / GAME COMMANDER
-- will only allow certain PLAYER IDS
-- PLAYER IDS are unique DCS ids that can't be changed or spoofed
-- This script will output to the them to the dcs.log file when a player changes slots so you can copy them out easily :)
-- This will only take effect if: ssb.controlNonAircraftSlots = true
ssb.commanderPlayerUCID = {
    "292d911c1b6f631476795cb80fd93b1f",
    "some_uniqe_player_ucid",
}
Usage In Missions

To enable the SSB script in a mission first create a TRIGGER with a TIME MORE of 1 and an ACTION of DO SCRIPT with the Script below:

Code:
   trigger.action.setUserFlag("SSB",100)
This first trigger turns on SSB for the currently running mission. If this flag isn't set in the mission then Slot Blocking will not work

Next create as many triggers as you like to enable or disable a slot. For example, to disable a slot at mission start:

Create a TRIGGER with a TIME MORE of 1 and an ACTION of DO SCRIPT with the Script below:

Code:
   trigger.action.setUserFlag("HELI1",100)
This will disable the playable helicopter with the GROUP NAME of HELI1

To enable, simply set the flag back to 0

Code:
   trigger.action.setUserFlag("HELI1",0)
Note: If you change the ssb.enabledFlagValue, remember to update all your triggers and flag values!


Reserve Aircraft Slot

To reserver a slot for a specific clan tag (or individual player) add a new entry to the ssb.prefixes list in the GameGUI:

Code:
ssb.prefixes = {
    "-=433=-",
    "ciribob",
}
You can add as many entries as you like, not every mission has to use them all but this sets the list of tags / prefixes we'll be looking for.

Next in a mission add the prefix you want to use for a unit to the GROUP NAME

i.e to reserve a UH1 for the 104th Squadron:

Code:
ssb.prefixes = {
    "104th",
}
then set the UH-1 GROUP NAME to: "Huey 1 104th"

The reservation system will still take into account if the slot is enabled or not so a slot could be reserved but disabled if you like.


Reserve Non Aircraft Slot

Non aircraft slots, GCI / Game Commander etc can be globally reserved. Turning this on will effect all missions on the server.

First edit SimpleSlotBlockGameGUI.lua and set:

Code:
ssb.controlNonAircraftSlots = true
Make sure that DCS isnt running when you edit or restart DCS for the settings to take effect.

Next you need to add players unique DCS player ids (UCID) to the list of ucids in ssb.commanderPlayerUCID

To obtain a players UCID, have the player try to join a slot running SSB and then check the dcs.log in C:\Users\\Saved Games\DCS\Logs

There should be a line that looks something like:

Code:
00115.172 INFO    LuaNET: SSB - Player Selected slot - player: Ciribob side:2 slot: 2 ucid: 283d911c1b6f631476795cb80fd93b7a
Just copy the UCID e.g. 283d911c1b6f631476795cb80fd93b7a and add to the commanderPlayerUCID list in the GameGUI. Again make sure to restart DCS after changes to the GameGUI :

Code:
ssb.commanderPlayerUCID = {
    "292d911c1b6f631476795cb80fd93b1f",
    "283d911c1b6f631476795cb80fd93b7a",
    "223d911c1b6f631476795cb80fd93b8a",
}
The UCID is unique to the DCS player account so name changes won't affect it so its a pretty sure way to lock down a slot to specific members.

Tutorial Video

I've put together a quick example mission from scratch that shows how you can disable a slot at mission start and then use a players action to unlock it again.

I hope this helps explain it better!

Note - since the video gameGUI files must go in scripts / hooks folder now



I've also attached a pre-configured test mission from the tutorial video that shows activating a second helicopter slot by flying into a zone. You can test by installing the SimpleSlotBlockGameGUI.lua and then starting a multiplayer server.

Remember to unpause and wait a second if you're testing so that the script initialises

Please let me know how you get on or if you have any issues! Enjoy
Attached Files
File Type: miz slot_block_test_helis.miz (7.0 KB, 33 views)
__________________
Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD
CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup
Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required!
DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Last edited by Ciribob; 12-27-2017 at 12:21 PM.
Ciribob is offline   Reply With Quote
Old 04-01-2017, 02:43 PM   #2
gospadin
ED Testers Team
 
Join Date: Feb 2015
Location: 'Murica
Posts: 1,958
Default

awesome, thanks!
gospadin is offline   Reply With Quote
Old 04-02-2017, 12:04 AM   #3
Pikey
Senior Member
 
Pikey's Avatar
 
Join Date: Sep 2009
Location: Reading, UK (GMT)
Posts: 2,998
Default

Superb, thank you so much!
__________________
“Six better fuses and we would have lost.”
Pikey is offline   Reply With Quote
Old 04-03-2017, 07:39 PM   #4
[Maverick]
ED Testers Team
 
[Maverick]'s Avatar
 
Join Date: Dec 2010
Location: Scotland
Posts: 2,523
Default

Awesome sir, thank you!
__________________

104th Phoenix Squadron Leader / Total Poser

"Dammit Jim, I'm a Squadron Leader, not a software developer!"



www.104thPhoenix.com
www.facebook.com/104thPhoenix
104th F-15C Skin
My YouTube Channel
[Maverick] is offline   Reply With Quote
Old 04-24-2017, 09:01 AM   #5
HellsBells
Member
 
HellsBells's Avatar
 
Join Date: Jun 2013
Location: Australia
Posts: 166
Default

Another Superb Mod from Ciribob. Thank you
__________________
Spoiler:
Win 10 64-bit | i7 4770K 1TB SSD + 8TB Storage 16GB Platinum Corsair DDR3 @2400MHz | 2 x Radeon RX480 in Crossfire. 3 x 27" Eyefinity- 4808x1200 | TrackIR5 Thrustmaster HOTAS Warthog custom build extension MFG Crosswind Pedals | Thrustmaster Cougar MFDs |


"Through The Inferno"

Official Australian Server
"Through the Inferno" by Deadlyfishes

TS & SRS Servers "anztac-servers.com

Australian Website
AU Discord Server
HellsBells is offline   Reply With Quote
Old 06-18-2017, 09:56 AM   #6
Alpenwolf
Member
 
Alpenwolf's Avatar
 
Join Date: Feb 2015
Posts: 786
Default

Bless you buddy!

I didn't work for me though. Did all you've said and double checked that. I have other lau scripts running in my mission. Could that be the problem?

EDIT: Works now!

Last edited by Alpenwolf; 06-18-2017 at 10:56 AM.
Alpenwolf is offline   Reply With Quote
Old 06-18-2017, 10:42 AM   #7
Pikey
Senior Member
 
Pikey's Avatar
 
Join Date: Sep 2009
Location: Reading, UK (GMT)
Posts: 2,998
Default

Quote:
Originally Posted by Alpenwolf View Post
Bless you buddy!

I didn't work for me though. Did all you've said and double checked that. I have other lau scripts running in my mission. Could that be the problem?
Since it works, and only based on the global flags, unless your other LUA changes global flags then no, its more likely to be a setup error.
__________________
“Six better fuses and we would have lost.”
Pikey is offline   Reply With Quote
Old 06-18-2017, 10:56 AM   #8
Alpenwolf
Member
 
Alpenwolf's Avatar
 
Join Date: Feb 2015
Posts: 786
Default

Quote:
Originally Posted by Pikey View Post
Since it works, and only based on the global flags, unless your other LUA changes global flags then no, its more likely to be a setup error.
Sure it works! My bad, sorry... Sometimes double checking aint enough. A comma was all that was missing.
Alpenwolf is offline   Reply With Quote
Old 06-19-2017, 09:06 PM   #9
Alpenwolf
Member
 
Alpenwolf's Avatar
 
Join Date: Feb 2015
Posts: 786
Default

Ok... The whole thing works for me but only if I start a new server (for testing as you've mentioned). The mission runs now on the ACG Cold War server on DCS 1.5.6 and the slot blocking doesnt work there! What's the difference between running the mission on an empty server for testing only and having it on a public server like ACG?

Last edited by Alpenwolf; 06-19-2017 at 09:50 PM.
Alpenwolf is offline   Reply With Quote
Old 06-20-2017, 07:16 AM   #10
Ciribob
ED Testers Team
 
Join Date: Mar 2015
Location: Brighton, UK
Posts: 1,706
Default

Quote:
Originally Posted by Alpenwolf View Post
Ok... The whole thing works for me but only if I start a new server (for testing as you've mentioned). The mission runs now on the ACG Cold War server on DCS 1.5.6 and the slot blocking doesnt work there! What's the difference between running the mission on an empty server for testing only and having it on a public server like ACG?
Have you copied the GameGUI file to the server?

Sent from my ONEPLUS A3003 using Tapatalk
__________________
Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD
CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup
Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required!
DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord
Ciribob is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:41 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.