Skip to content
← All documentation

/// PIMPMYRUST PLUGIN

Player Event States

Guide for this version of Player Event States. Check its product page for availability.

Plugin instructions

Player Event States — 1.0.0

Store boolean event states per player or globally, then read them from a gameplay plugin. Player Event States is required by Dialogs but does not create conversations, quests, rewards or world events itself.

No user configuration

There is no settings file or configurator for this plugin. Dialogs manages states through its API; another plugin can do the same. State files under oxide/data/PlayerEventStates/ contain live progress, not reusable settings. Do not replace them with example files.

API

bool GetEventStatePlayer_API(ulong playerId, string eventName);
bool GetEventStateGlobal_API(string eventName);
void SetEventStatePlayer_API(ulong playerId, string eventName, bool value);
void SetEventStateGlobal_API(string eventName, bool value);
bool PlayerHasRecquiredStates_API(ulong playerId, Dictionary<string, bool> states);

Keep the published spelling PlayerHasRecquiredStates_API. Use a stable namespaced key such as quests.intro.complete and use the same scope in producer and consumer. A player read returns false for an absent key; player Set creates it when needed. Global Get creates an absent global key at false; Global Set refuses an absent key, so initialize it through Get first.

Write state only after a gameplay action is accepted. Read required states before admitting a conditional action. Do not assume expiry, reset-on-wipe or automatic migration: no such policy is present in this release. No public user command or permission is documented.

Consumer example

This is C# for an existing Rust plugin, not a server-console command. Add using Oxide.Core.Plugins; at the top of its file and these members inside your RustPlugin class. Install PlayerEventStates.cs in oxide/plugins first.

[PluginReference] private Plugin PlayerEventStates;

private bool HasCompletedIntro(BasePlayer player)
{
    if (PlayerEventStates == null)
        throw new System.InvalidOperationException("PlayerEventStates is not loaded.");

    return PlayerEventStates.Call<bool>(
        "GetEventStatePlayer_API", player.userID, "quests.intro.complete");
}

private void StartFestival()
{
    if (PlayerEventStates == null)
        throw new System.InvalidOperationException("PlayerEventStates is not loaded.");

    PlayerEventStates.Call("GetEventStateGlobal_API", "events.festival.active");
    PlayerEventStates.Call("SetEventStateGlobal_API", "events.festival.active", true);
}

Call HasCompletedIntro before allowing a conditional action. Once the action that completes the intro has succeeded, record it with PlayerEventStates.Call("SetEventStatePlayer_API", player.userID, "quests.intro.complete", true). Call StartFestival only when your gameplay logic starts that event; its getter initializes the global key before the setter writes it. The example explicitly rejects a missing dependency rather than treating it as a normal false state.

Persistence and verification

Global state is held in global_events.json; player state is held in user_<steamid>.json under the plugin data directory. Changes are marked for saving during server save and unload; do not equate an API write with an immediate disk flush. Back up the directory as one unit and avoid overwriting live server state with example files.

Before live use, test false/true values, isolation between two players, global initialization and your consumer’s behaviour on a private server. Check persistence after a clean reload or restart.