Esempio n. 1
0
// Send message to specified player, raising an error if player not found.
void l_privatesay(CallHandler& handler, Object::unique_deque& args, Object::unique_list&)
{
	bool prepend = true;
	if (args.size() == 3) prepend = ReadBoolean(*args[2]);
	halo::s_player* player = ReadPlayer(handler, *args[0], true); 
	halo::PlayerChatStreamRaw raw(*player);
	WriteMessageToStream(prepend ? *player->chat_stream : raw, *args[1]);
}
Esempio n. 2
0
void l_changeteam(CallHandler& handler, Object::unique_deque& args, Object::unique_list& results)
{
	s_player* player = ReadPlayer(handler, *args[0], true);
	bool forcekill = ReadBoolean(*args[1]);
	BYTE team = !player->mem->team;
	if (args.size() == 3) team = ReadNumber<BYTE>(*args[2]);
	player->ChangeTeam(team, forcekill);
}
Esempio n. 3
0
// Print to console
void l_hprintf(CallHandler& handler, Object::unique_deque& args, Object::unique_list&)
{
	// backwards compatibility with old Phasor.
	if (args.size() == 2) 
		return sendconsoletext(handler, *args[0], *args[1], false);

	_TRACE_CONSOLE("%S\r\n", *args[0]);

}
Esempio n. 4
0
void l_svcmdplayer(CallHandler& handler, Object::unique_deque& args, Object::unique_list& results)
{
	bool want_result = false;
	std::string cmd = ReadRawString(*args[0]);
	halo::s_player* player = ReadPlayer(handler, *args[1], true);
	if (args.size() == 3) want_result = ReadBoolean(*args[2]);
	check_script_reload(handler, cmd);
	return svcmd_redirect(results, cmd, want_result, player, *player->console_stream);
}
Esempio n. 5
0
void l_svcmd(CallHandler& handler, Object::unique_deque& args, Object::unique_list& results)
{ 
	std::string cmd = ReadRawString(*args[0]);
	bool want_result = false;
	if (args.size() == 2) want_result = ReadBoolean(*args[1]);

	check_script_reload(handler, cmd);
	return svcmd_redirect(results, cmd, want_result, NULL, *g_PrintStream);
}
Esempio n. 6
0
void l_registertimer(CallHandler& handler, Object::unique_deque& args, Object::unique_list& results)
{
	DWORD delay = ReadNumber<DWORD>(*args[0]);
	std::string callback = ReadRawString(*args[1]);
	std::unique_ptr<Common::Object> userdata;
	if (args.size() == 3) userdata = std::move(args[2]);

	timer_ptr timer(new ScriptTimer(delay, callback, std::move(userdata), &handler.state));
	DWORD id = g_Timers.AddTimer(std::move(timer));
	AddResultNumber(id, results);
}
Esempio n. 7
0
// Send message to entire server
void l_say(CallHandler& handler, Object::unique_deque& args, Object::unique_list&)
{
	bool prepend = true;
	if (args.size() == 2) prepend = ReadBoolean(*args[1]);
	WriteMessageToStream(prepend ? halo::server::say_stream : halo::server::say_stream_raw,*args[0]);
}