Доступ к готовым решениям

Переход в группу "Пользователь"

300.00
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Функция Быстрый ProxDetector

OKStyle

Адвокат по делам семейным
Administrator
Wiki Team
Регистрация
4 Мар 2011
Сообщения
7,094
Лучшие ответы
226
Репутация
2,455
Награды
11
На скорость не тестировал, но по коду видно, что быстрее стандарта.

PHP:
stock ProxDetector_OK(Float:radius = 30.0, playerid, text[], col1 = 0xFFFFFFFF, col2 = 0xCCCCCCFF, col3 = 0x999999FF, col4 = 0x666666FF, col5 = 0x333333FF)
{
//  SetPlayerChatBubble(playerid, text, col1, radius, 5 * 1000);
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	for(new i = GetMaxPlayers() - 1, Float:dist, virtualworld = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid); i != -1; i--)
	{
		if(!IsPlayerConnected(i) || IsPlayerNPC(i) || virtualworld != GetPlayerVirtualWorld(i) || interior != GetPlayerInterior(i)) continue;
		dist = GetPlayerDistanceFromPoint(i, x, y, z);
		if(dist < radius / 16) SendClientMessage(i, col1, text);
		else if(dist < radius / 8) SendClientMessage(i, col2, text);
		else if(dist < radius / 4) SendClientMessage(i, col3, text);
		else if(dist < radius / 2) SendClientMessage(i, col4, text);
		else if(dist < radius) SendClientMessage(i, col5, text);
	}
	return 1;
}
PHP:
stock ProxDetector_OK(Float:radius = 30.0, playerid, text[], col1 = 0xCECECEFF, col2 = 0xB8B7B7FF, col3 = 0x999999FF, col4 = 0x6B6B6BFF, col5 = 0x434343FF)
{
//	SetPlayerChatBubble(playerid, text, col1, radius, 5 * 1000);
	new Float:x, Float:y, Float:z, virtualworld = GetPlayerVirtualWorld(playerid), interior = GetPlayerInterior(playerid);
	GetPlayerPos(playerid, x, y, z);
	for(new i = GetMaxPlayers() - 1; i != -1; i--)
	{
		if(!IsPlayerConnected(i) || IsPlayerNPC(i) || virtualworld != GetPlayerVirtualWorld(i) || interior != GetPlayerInterior(i)) continue;
		if(IsPlayerInRangeOfPoint(i, radius / 16, x, y, z)) SendClientMessage(i, col1, text);
		else if(IsPlayerInRangeOfPoint(i, radius / 8, x, y, z)) SendClientMessage(i, col2, text);
		else if(IsPlayerInRangeOfPoint(i, radius / 4, x, y, z)) SendClientMessage(i, col3, text);
		else if(IsPlayerInRangeOfPoint(i, radius / 2, x, y, z)) SendClientMessage(i, col4, text);
		else if(IsPlayerInRangeOfPoint(i, radius, x, y, z)) SendClientMessage(i, col5, text);
	}
	return 1;
}

Автор: OKStyle

HOWTO:
PHP:
ProxDetector_OK(_, playerid, text); // если значения по-умолчанию устраивают
 
Последнее редактирование модератором:
Сверху Снизу