OKStyle
| Дата: Четверг, 11/06/2015, 23:54 | Сообщение # 1 |
Analgésico
Регистрация: 17/01/2009 |
Клан: | [ACF] |
Статус: | |
| На скорость не тестировал, но по коду видно, что быстрее стандарта.
Код 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; }
Код 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: Код ProxDetector_OK(_, playerid, text); // если значения по-умолчанию устраивают
|
|
| |