interface
VoteResultThe outcome delivered to VoteConfig.onEnd when a vote ends.
readonly winner: number | nullreadonly counts: number[]readonly total: number@s2script/sdk/votes
chat-ballot voting with revote + an optional live center tally.
import { VoteResult } from "@s2script/sdk/votes";Author-time types ship in the npm package; the engine injects the runtime at plugin load. Add @s2script/sdk to your plugin's dependencies.
Generated from the shipped type definitions.
VoteResultThe outcome delivered to VoteConfig.onEnd when a vote ends.
readonly winner: number | nullreadonly counts: number[]readonly total: numberVoteConfigConfiguration for Vote.start.
question: stringoptions: string[]duration: numbershowLiveTally?: booleanonEnd: (result: VoteResult) => voidVoteTallyA per-tick snapshot of an in-progress vote, handed to a VoteTallyRenderer.
question: stringoptions: { label: string; count: number }[]total: numbersecondsLeft: numberVoteTallyRendererA live-tally display backend for votes — registered via Vote.registerTallyRenderer.
show(slot: number, tally: VoteTally): voidslot.clear(slot: number): voidslot (the vote ended or the player left).VoteThe voting entry point — one active chat-ballot vote at a time, tallied on close.
import { Vote } from "@s2script/sdk/votes";
Vote.start({
question: `Kick ${name}?`,
options: ["Yes", "No"],
duration: 20,
showLiveTally: true,
onEnd: (r) => {
if (r.winner === 0 && r.counts[0] > r.total / 2) kick(name);
},
});start(config: VoteConfig): booleanisActive(): booleancancel(): voidregisterTallyRenderer(renderer: VoteTallyRenderer): void