Closed crwn1337 closed 3 years ago
Not really sure about C++ but in .NET you would -=
to remove an event. You could try putting the lamda in a variable then use +=
and -=
. Purely a theoretical suggestion, haven't tried in practice.
It does work!
For future reference:
void process() {
if (plugin::Command<plugin::Commands::IS_PLAYER_PLAYING>(0)) {
plugin::Command<plugin::Commands::PRINT_NOW>("IN_VEH", 150, 0);
}
}
plugin::Events::processScriptsEvent += process; // add it
plugin::Events::processScriptsEvent -= process; // remove it
Ah yes, I was overthinking it needing to put a lambda in a variable. Making a function as a much simpler solution 😅
For example:
and then somewhere later remove the event?