MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / StartVote

Method StartVote

core/MenuVoting.cpp:190–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190bool VoteMenuHandler::StartVote(IBaseMenu *menu,
191 unsigned int num_clients,
192 int clients[],
193 unsigned int max_time,
194 unsigned int flags/* =0 */)
195{
196 if (!InitializeVoting(menu, menu->GetHandler(), max_time, flags))
197 {
198 return false;
199 }
200
201 /* Note: we can use game time and not universal time because
202 * if we're voting then players are in-game.
203 */
204
205 float fVoteDelay = sm_vote_delay.GetFloat();
206 if (fVoteDelay < 1.0)
207 {
208 g_next_vote = 0.0;
209 }
210 else
211 {
212 /* This little trick breaks for infinite votes!
213 * However, we just ignore that since those 1) shouldn't exist and
214 * 2) people must be checking IsVoteInProgress() beforehand anyway.
215 */
216 g_next_vote = gpGlobals->curtime + fVoteDelay + (float)max_time;
217 }
218
219 m_fStartTime = gpGlobals->curtime;
220 m_nMenuTime = max_time;
221
222 for (unsigned int i=0; i<num_clients; i++)
223 {
224 if (clients[i] < 1 || clients[i] > 256)
225 {
226 continue;
227 }
228 menu->Display(clients[i], max_time, this);
229 }
230
231 StartVoting();
232
233 return true;
234}
235
236bool VoteMenuHandler::IsClientInVotePool(int client)
237{

Callers 1

VoteMenuFunction · 0.45

Calls 3

GetHandlerMethod · 0.80
GetFloatMethod · 0.45
DisplayMethod · 0.45

Tested by

no test coverage detected