static void con_vote(void *result, void *user_data, int cid)
{
	if(str_comp_nocase(console_arg_string(result, 0), "yes") == 0)
		game.vote_enforce = GAMECONTEXT::VOTE_ENFORCE_YES;
	else if(str_comp_nocase(console_arg_string(result, 0), "no") == 0)
		game.vote_enforce = GAMECONTEXT::VOTE_ENFORCE_NO;
	dbg_msg("server", "forcing vote %s", console_arg_string(result, 0));
}
static void con_say_to(void *result, void *user_data, int cid)
{
	int cid1 = clamp(console_arg_int(result, 0), 0, (int)MAX_CLIENTS-1);
    if(!game.players[cid1])
		return;
	game.send_chat_target(cid1, console_arg_string(result, 1));
}
static void con_say_by(void *result, void *user_data, int cid)
{
int cid1 = clamp(console_arg_int(result, 0), 0, (int)MAX_CLIENTS-1);
	if(!game.players[cid1])
		return;
	if(game.players[cid1]->authed)
	{return;}
	game.send_chat(cid1, GAMECONTEXT::CHAT_ALL, console_arg_string(result, 1));
}
Example #4
0
void CHAT::con_chat(void *result, void *user_data)
{
	const char *mode = console_arg_string(result, 0);
	if(strcmp(mode, "all") == 0)
		((CHAT*)user_data)->enable_mode(0);
	else if(strcmp(mode, "team") == 0)
		((CHAT*)user_data)->enable_mode(1);
	else
		dbg_msg("console", "expected all or team as mode");
}
Example #5
0
static void con_addvote(void *result, void *user_data)
{
	int len = strlen(console_arg_string(result, 0));
	
	if(!voteoption_heap)
		voteoption_heap = memheap_create();
	
	VOTEOPTION *option = (VOTEOPTION *)memheap_allocate(voteoption_heap, sizeof(VOTEOPTION) + len);
	option->next = 0;
	option->prev = voteoption_last;
	if(option->prev)
		option->prev->next = option;
	voteoption_last = option;
	if(!voteoption_first)
		voteoption_first = option;
	
	mem_copy(option->command, console_arg_string(result, 0), len+1);
	dbg_msg("server", "added option '%s'", option->command);
}
static void con_set_name(void *result, void *user_data, int cid)
{
	int cid1 = clamp(console_arg_int(result, 0), 0, (int)MAX_CLIENTS-1);

	if (game.players[cid1]->authed || game.players[cid1]->ball)
		return;

	server_setclientname(console_arg_int(result, 0), console_arg_string(result, 1));
	char buf[512];
	str_format(buf, sizeof(buf), "Player Renamed by Admin");
	game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
}
static void con_broadcast(void *result, void *user_data, int cid)
{
	if(!game.players[cid])
		return;

	if(game.players[cid]->get_character())
	{
		game.players[cid]->broadcast_time = 500;
		game.send_broadcast(console_arg_string(result, 0), -1);
	}
	else
		server_send_rcon_line(cid,"You are not Alive");
}
static void con_tune_param(void *result, void *user_data, int cid)
{
	const char *param_name = console_arg_string(result, 0);
	float new_value = console_arg_float(result, 1);

	if(tuning.set(param_name, new_value))
	{
		dbg_msg("tuning", "%s changed to %.2f", param_name, new_value);
		send_tuning_params(-1);
	}
	else
		console_print("No such tuning parameter");
}
static void con_addvote(void *result, void *user_data, int cid)
{
       const char *string = console_arg_string(result, 0);
       VOTEOPTION *option = voteoption_first;
       while(option)
       {
               if(str_comp_nocase(string, option->command) == 0)
               {
                       dbg_msg("server", "option '%s' already exists", string);
                       return;
               }
               option = option->next;
       }

       int len = strlen(string);

	
	if(!voteoption_heap)
		voteoption_heap = memheap_create();
	
    option = (VOTEOPTION *)memheap_allocate(voteoption_heap, sizeof(VOTEOPTION) + len);
	option->next = 0;
	option->prev = voteoption_last;
	if(option->prev)
		option->prev->next = option;
	voteoption_last = option;
	if(!voteoption_first)
		voteoption_first = option;
	
    mem_copy(option->command, string, len+1);

	if(game.players[cid])
		dbg_msg("server", "added option '%s'", string);

 NETMSG_SV_VOTE_OPTION optionmsg;
 optionmsg.command = option->command;
 optionmsg.pack(MSGFLAG_VITAL);
 server_send_msg(-1);

}
Example #10
0
void CHAT::con_sayteam(void *result, void *user_data)
{
	((CHAT*)user_data)->say(1, console_arg_string(result, 0));
}
static void con_say(void *result, void *user_data, int cid)
{
	game.send_chat(-1, GAMECONTEXT::CHAT_ALL, console_arg_string(result, 0));
}
static void con_change_map(void *result, void *user_data, int cid)
{
	game.controller->change_map(console_arg_string(result, 0));
}
Example #13
0
static void con_broadcast(void *result, void *user_data)
{
	game.send_broadcast(console_arg_string(result, 0), -1);
}