About Event Helper
This plugin can be used by developers to manage their arena games etc.
Developers can use this to handle the entry/exit of players into their games.
The plugin will be primarily used by my HungerGames, ScubaArena and Skirmish game (soon to be released).
- Registration calls to create and register the event with the plugin.
- Automatic running of the events in order, so you can have multiple event plugins running 1 after the other (configurable).
- Strip and save the players current inventory, and restore it after they leave the game.
- Store and restore the players metabolism stats when they join/leave the game.
- Register a destination for players to teleport to when joining the game.
- Command black listing.
- Build in hook management for popular plugins such as Backpacks and kits.
void EMCreateEvent(string eventName, bool automatic_start, bool stripItems, bool leaves_event_on_death, bool full_health_on_join, bool give_items_back_on_respawn, bool full_metabolism_on_join, Vector3 teleport_destination)
Creates the event and allows the developer to specify the settings:
- eventName: the name of the event. this.Name is recommended.
- automatic_start: enrolls the event to be scheduled and ran by EventHelper.
- stripItems: strips the players items and stores them in the data file. Items will be returned upon leaving the event, or when they respawn after they have left the event unless give_items_back_on_respawn is set to false.
- leaves_event_on_death: Kicks the player from the event when they die.
- full_health_on_join: Stores the players health into the data file and sets their health to max.
- give_items_back_on_join: Gives the players items back when they leave the event, or when they respawn after leaving the event. If set to false, they will need to use the /recoveritems command to get their items back.This is useful if a server is running plugins such as kits, which wipes the players inventory to give the player a kit.
- full_metabolism_on_join: Saves and restores the players metabolism before and after a game.
- teleport_destination: The location that a player will teleport to when joining the game. Set to Vector3.new if you do not want them to teleport.
void EMExternalPluginSettings(string eventName, bool canDropBackpack = false, bool canEraseBackpack = false, bool canOpenBackpack = false, bool canBackpackAcceptItem = false, bool canRedeemKit = false, bool CanLoseXP= false)
Sets up the external plugin settings for the event.
- eventName: The registered name of the event.
- canDropBackpack: Backpack plugin.
- canEraseBackpack: Backpack plugin.
- canOpenBackpack: Backpack plugin.
- canBackpackAcceptItem: Backpack plugin.
- canRedeemKit: Can the player redeem kits.
- CanLoseXP: Can the player lose xp when dying in the game.
void EMBlackListCommands(string eventName, string commands)
Use to submit a list of commands that cannot be run while at the event.
void EMRemoveEvent(string eventName)
Removes the event from EventHelper. This will automatically trigger the EMPlayerLeaveEvent hook for each player if the event is active.
void EMManuallyStarted(string eventName)
Flags the event as manually started, preventing it from being run automatically if opting in for automatic_start.
void EMUpdateLobby(string eventName, Vector3 pos)
Allows you to update the lobby destination after an event has been created.
void EMStartEvent(string eventName)
Triggers an event to start. Marks the event as running so it can be used with the EMEndEvent hook. Call this when you want the game to start.
void EMEndEvent(string eventName)
Triggers the event to end. Goes through each participant and calls EMPlayerLeaveEvent on them before clearing the participants. Also resets manually_started to false and triggers the EMEndGame hook.
bool EMEnrollPlayer(BasePlayer player, string eventName)
Enrolls a player into the event. Follows the instructions of the EMCreateEvent settings by stripping items, setting health and metabolisms, as well as teleporting the player to the arena. Also checks for crafting queues, black listed items and escape blocks. Returns true if the player was enrolled successfully.
void EMPlayerLeaveEvent(BasePlayer player, string eventName = null)
Removes the player from the event. Strips the items that they have received from the event, then optionally restores their previous items, teleports them to the location that they were at prior to joining, sets their health and their metabolism etc, or will tell them that they need to use the command in order to get their inventory back.
bool EMIsParticipating(BasePlayer player, string eventName)
Returns true if a player is participating in an event (using the participants list associated with the event itself).
bool EMAtEvent(ulong id)
Returns true if a player is at an event (using the playerdata records).
bool AddBan(BasePlayer player, string event_name)
Bans the player from the specified event.
bool RemoveBan(BasePlayer player, string event_name)
Unbans the player from the specified event.
void EMEndGame(string eventName)
Is called when the game ends.
ehban <target name/id> - bans the player from all events globally. ehunban <target name/id> - unbans the player from all events globally.