Example #1
0
void Cmd_Votemap_f (edict_t * ent, char *t)
{
	char *oldvote;

	if (!*t)
	{
		gi.cprintf (ent, PRINT_HIGH,
		"You need an argument to the vote command (name of map).\n");
			return;
	}

	if (level.intermissiontime)
	{
		gi.cprintf (ent, PRINT_HIGH, "Mapvote disabled during intermission\n");
		return;
	}

	// BEGIN Igor[Rock]
	if (level.time < mapvote_waittime->value)
	{
		gi.cprintf (ent, PRINT_HIGH,
		"Mapvote currently blocked - Please vote again in %d seconds\n",
		(int) ((float) mapvote_waittime->value + 1.0 - level.time));
	}
	else
	{
	// END Igor[Rock]
	oldvote = ent->client->resp.mapvote;

		switch (AddVoteToMap (t, ent))
		{
		case 0:
			gi.cprintf (ent, PRINT_HIGH, "You have voted on map \"%s\"\n", t);
			if (mv_public->value)
				gi.bprintf (PRINT_HIGH, "%s voted for \"%s\"\n", ent->client->pers.netname, t);
			break;
		case 1:
			gi.cprintf (ent, PRINT_HIGH, "You have changed your vote to map \"%s\"\n", t);
			if (mv_public->value) {
				if (FloodCheck(ent))
					break;
				if(Q_stricmp (t, oldvote))
					gi.bprintf (PRINT_HIGH,"%s changed his mind and voted for \"%s\"\n", ent->client->pers.netname, t);
			else
				gi.cprintf (ent, PRINT_HIGH, "We heard you the first time!\n");
			}
			break;
		default:
			//error
			gi.cprintf (ent, PRINT_HIGH, "Map \"%s\" is not in the votelist!\n", t);
			break;
		}
	}
	return;
}
Example #2
0
static void Votemap(edict_t *ent, const char *mapname)
{
	char *oldvote;
	int voteWaitTime;

	if (!use_mapvote->value) {
		gi.cprintf(ent, PRINT_HIGH, "Map voting is disabled.\n");
		return;
	}

	if (!*mapname) {
		MapVoteMenu( ent, NULL );
		return;
	}

	if (level.intermission_framenum) {
		gi.cprintf(ent, PRINT_HIGH, "Mapvote disabled during intermission\n");
		return;
	}

	voteWaitTime = (int)(mapvote_waittime->value * HZ);
	if (level.realFramenum < voteWaitTime)
	{
		gi.cprintf(ent, PRINT_HIGH, "Mapvote currently blocked - Please vote again in %d seconds\n",
			(voteWaitTime + HZ - level.realFramenum) / HZ );
		return;
	}

	oldvote = ent->client->resp.mapvote;

	switch (AddVoteToMap(mapname, ent))
	{
	case 0:
		gi.cprintf(ent, PRINT_HIGH, "You have voted on map \"%s\"\n", mapname);
		if (mv_public->value)
			gi.bprintf(PRINT_HIGH, "%s voted for \"%s\"\n", ent->client->pers.netname, mapname);
	break;
	case 1:
		gi.cprintf(ent, PRINT_HIGH, "You have changed your vote to map \"%s\"\n", mapname);
		if (mv_public->value && !FloodCheck(ent)) {
			if (Q_stricmp(mapname, oldvote))
				gi.bprintf(PRINT_HIGH, "%s changed his mind and voted for \"%s\"\n", ent->client->pers.netname, mapname);
			else
				gi.cprintf(ent, PRINT_HIGH, "We heard you the first time!\n");
		}
		break;
	default:
		//error
		gi.cprintf(ent, PRINT_HIGH, "Map \"%s\" is not in the votelist!\n", mapname);
		break;
	}
}