> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 发送事件

> 示例 XblEventsWriteInGameEvent 代码，使用合作伙伴中心配置的规则编写 XBOX Live 游戏内事件以更新基于事件的用户统计信息。

本主题提供演示如何编写事件的示例代码。
此代码基于您在合作伙伴中心定义的统计信息规则更新基于事件的统计信息。

#### 扁平 C API

```cpp theme={null}
HRESULT hr = XblEventsWriteInGameEvent(
    xboxLiveContext,
    "PuzzleSolved",
    R"({"DifficultyLevelId":100, "GameplayModeId":"Adventure"})",
    R"({"LocationX":1,"LocationY":1})"
);
```

有关详细信息，请参阅 [XblEventsWriteInGameEvent](/reference/live/xsapi-c/events_c/functions/xbleventswriteingameevent)。


## Related topics

- [PlayFab Services SDK - 事件管道](/zh-CN/services/playfab/sdks/c/event-pipeline/eventpipeline.md)
- [事件管道教程](/zh-CN/services/playfab/sdks/c/event-pipeline/eventpipeline-tutorial.md)
- [事件示例代码](/zh-CN/services/xbox-services/player-data/stats-leaderboards/event-based/events/how-to/live-events-howto-nav.md)
- [获取基于事件的统计信息](/zh-CN/services/xbox-services/player-data/stats-leaderboards/event-based/how-to/live-getting-eb-stat.md)
- [事件概述](/zh-CN/services/xbox-services/player-data/stats-leaderboards/event-based/events/live-game-events.md)
