Created
January 4, 2022 18:06
-
-
Save nielsvaes/a4537ee1dccb7377037c59e51fa49965 to your computer and use it in GitHub Desktop.
DCS MOOSE - Spawn from Mark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| --- Generated by EmmyLua(https://github.com/EmmyLua) | |
| --- Created by niels. | |
| --- DateTime: 1/4/2022 3:35 PM | |
| --- | |
| local function split_string(str, delimiter) | |
| local result = {}; | |
| for match in (str ..delimiter):gmatch("(.-)"..delimiter) do | |
| table.insert(result, match); | |
| end | |
| return result; | |
| end | |
| MarkEventHandler = EVENTHANDLER:New() | |
| MarkEventHandler:HandleEvent(EVENTS.MarkChange) | |
| function MarkEventHandler:OnEventMarkChange(event_data) | |
| MESSAGE:New(event_data.MarkText):ToAll() | |
| local parts = split_string(event_data.MarkText, "-") | |
| local command = parts[1] | |
| local group = parts[2] | |
| SPAWN:NewWithAlias(group, group.. tostring(math.random(1000))) | |
| :SpawnFromVec2(event_data.MarkCoordinate:GetVec2()) | |
| end | |
| MESSAGE:New("Spawn from Mark loaded!"):ToAll() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment