Thanks for the replies. I am using this API function: "IsPlayerInAvAWorld()". I don't know if this returns true for anywhere else than Cyrodiil, I don't think so.
Right now I decided to use "EVENT_PLAYER_ACTIVATED" to register some other events; it will check the function above (IsPlayerInAvAWorld) and the user's choice (whether or not to have some features on or off in Cyrodiil), then register the events if they haven't been registered, or unregister them if they have been registered. Otherwise, I'll have to do the same check in the handler functions, which I'm trying to avoid (why do it over and over instead of doing it once)
Something like this (do not mind the order):
Lua Code:
EVENT_MANAGER:RegisterForEvent( "QB" , EVENT_ADD_ON_LOADED , QB_Initialize )
local function QB_Initialize()
...
EVENT_MANAGER:RegisterForEvent( "QB" , EVENT_PLAYER_ACTIVATED , QB_Cyrodiil )
end
local function QB_Cyrodiil()
if IsPlayerInAvAWorld()
and QB_DisableFeaturesInCyrodiil
and QB_EventsRegisteredBefore
then UnregisterEvents()
elseif not QB_EventsRegisteredBefore
then RegisterEvents()
else d("DERP, call 911") end
end
I'm thinking this would suffice. Instead of doing the if-checks in the handler functions everytime their events fire, I'll be doing this check whenever "EVENT_PLAYER_ACTIVATED" fires. Wish there were two events called as "EVENT_CAMPAIGN_JOINED" and "EVENT_CAMPAIGN_LEFT" or something similar, that way I could save even more if-checks. Actually, going to add it to the wish list, who knows.
Meanwhile, can I create such a custom event? (Garkin and Seerah, you may now remember my name as I've asked you two how to create custom events, thanks to your helps but I still have no clue for some reason
)