예제 #1
0
/*
 * @brief
 */
void Sv_KickClient(sv_client_t *cl, const char *msg) {
	char buf[MAX_STRING_CHARS], name[32];

	if (!cl)
		return;

	if (cl->state < SV_CLIENT_CONNECTED)
		return;

	if (*cl->name == '\0') // force a name to kick
		strcpy(name, "player");
	else
		g_strlcpy(name, cl->name, sizeof(name));

	memset(buf, 0, sizeof(buf));

	if (msg && *msg != '\0')
		g_snprintf(buf, sizeof(buf), ": %s", msg);

	Sv_ClientPrint(cl->edict, PRINT_HIGH, "You were kicked%s\n", buf);

	Sv_DropClient(cl);

	Sv_BroadcastPrint(PRINT_HIGH, "%s was kicked%s\n", name, buf);
}
예제 #2
0
파일: sv_main.c 프로젝트: chrisnew/quetoo
/*
 * @brief
 */
static void Sv_CheckTimeouts(void) {

	const uint32_t timeout = 1000 * sv_timeout->value;

	if (timeout > quetoo.time)
		return;

	const uint32_t whence = quetoo.time - timeout;

	sv_client_t *cl = svs.clients;
	for (int32_t i = 0; i < sv_max_clients->integer; i++, cl++) {

		if (cl->state == SV_CLIENT_FREE)
			continue;

		if (cl->last_message < whence) {
			Sv_BroadcastPrint(PRINT_MEDIUM, "%s timed out\n", cl->name);
			Sv_DropClient(cl);
		}
	}
}
예제 #3
0
/*
 * @brief
 */
static void Sv_CheckTimeouts(void) {
	sv_client_t * cl;
	int32_t i;

	const uint32_t timeout = svs.real_time - 1000 * sv_timeout->value;

	if (timeout > svs.real_time) {
		// the server is just starting, don't bother
		return;
	}

	for (i = 0, cl = svs.clients; i < sv_max_clients->integer; i++, cl++) {

		if (cl->state == SV_CLIENT_FREE)
			continue;

		// enforce timeouts by dropping the client
		if (cl->last_message < timeout) {
			Sv_BroadcastPrint(PRINT_HIGH, "%s timed out\n", cl->name);
			Sv_DropClient(cl);
		}
	}
}