Back to TPG

TPG.Voting.CastMapVote

S🏷️ Voting

Part of TPG namespace

TPG.Voting.CastMapVote(ply, mapIndex)
View on GitHub|gamemode/voting/sv_voting.lua:248-262
📋 Has LDoc👁️ 0 viewsUpdated 1 month ago

Description

Record (or change) ply's vote for a map-vote candidate and broadcast the new tally. mapIndex is whatever the client's tpg_votemap concommand sent -- an unchecked number from the player. It is safe here only because the lookup is bounds-checked: TPG.State.voting.maps[mapIndex] returns nil for anything out of range and the function returns immediately, so a forged index can neither crash the server nor vote for a map that isn't a candidate. No-ops entirely while no vote is active.

Parameters

NameTypeDescription
plyPlayerThe voter.
mapIndexnumberIndex into `TPG.State.voting.maps`, 1-based.

Returns

No return values documented.

Examples

No examples available.

Used In

No usages found in the codebase.