Skip to content

Instantly share code, notes, and snippets.

@ykundesu
Last active March 26, 2024 10:35
Show Gist options
  • Save ykundesu/fc07606bcfadb296e66aebe2a0cf638d to your computer and use it in GitHub Desktop.
Save ykundesu/fc07606bcfadb296e66aebe2a0cf638d to your computer and use it in GitHub Desktop.
役職を変更できるかもしれないやつ
PlayerControl player = GameData.Instance.GetPlayerById(1).Object;
player.PlayerId = 19;
MessageWriter writer = Hazel.MessageWriter.Get(Hazel.SendOption.Reliable);
writer.StartMessage(5);
writer.Write(AmongUsClient.Instance.GameId);
writer.StartMessage(1); //0x01 Data
{
writer.WritePacked(player.NetId);
player.Serialize(writer, false);
}
writer.EndMessage();
writer.EndMessage();
AmongUsClient.Instance.SendOrDisconnect(writer);
writer.Recycle();
new LateTask(() =>
{
GameData.PlayerInfo info = new GameData.PlayerInfo(19);
info.RoleType = AmongUs.GameOptions.RoleTypes.Impostor;
info.Outfits = new();
info.Role = new();
info.Role.Role = RoleTypes.Impostor;
GameData.Instance.AllPlayers.Add(info);
MessageWriter writer = MessageWriter.Get(SendOption.Reliable);
writer.StartMessage(5);
writer.Write(AmongUsClient.Instance.GameId);
writer.StartMessage(1); //0x01 Data
{
writer.WritePacked(GameData.Instance.NetId);
GameData.Instance.Serialize(writer, true);
}
writer.EndMessage();
writer.EndMessage();
AmongUsClient.Instance.SendOrDisconnect(writer);
writer.Recycle();
info.Role = null;
player.PlayerId = 1;
writer = Hazel.MessageWriter.Get(Hazel.SendOption.Reliable);
writer.StartMessage(5);
writer.Write(AmongUsClient.Instance.GameId);
writer.StartMessage(1); //0x01 Data
{
writer.WritePacked(player.NetId);
player.Serialize(writer, false);
}
writer.EndMessage();
writer.EndMessage();
AmongUsClient.Instance.SendOrDisconnect(writer);
writer.Recycle();
}, 1f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment