Код:
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
}
}
}
return 1;
}
public OnPlayerText(playerid, text[])
{
new pname[24], str[128];
GetPlayerName(playerid, pname, 128);
if(gTeam[playerid] == TEAM_GROVE) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_GROVE_COLOR, TEAM_GROVE_COLOR, TEAM_GROVE_COLOR, TEAM_GROVE_COLOR, TEAM_GROVE_COLOR);
}
if(gTeam[playerid] == TEAM_SBF) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR);
}
if(gTeam[playerid] == TEAM_TDF) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR);
}
if(gTeam[playerid] == TEAM_TDB) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR);
}
if(gTeam[playerid] == TEAM_FYB) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR);
}
if(gTeam[playerid] == TEAM_RHB) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR);
}
if(gTeam[playerid] == TEAM_KTB) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_KILO_COLOR, TEAM_KILO_COLOR, TEAM_KILO_COLOR, TEAM_KILO_COLOR, TEAM_KILO_COLOR);
}
if(gTeam[playerid] == TEAM_VAGOS) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR);
}
if(gTeam[playerid] == TEAM_VLA) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR);
}
if(gTeam[playerid] == TEAM_GD) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_GD_COLOR, TEAM_GD_COLOR, TEAM_GD_COLOR, TEAM_GD_COLOR, TEAM_GD_COLOR);
}
if(gTeam[playerid] == TEAM_LSB) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, COLOR_BROWN, COLOR_BROWN, COLOR_BROWN, COLOR_BROWN, COLOR_BROWN);
}
if(gTeam[playerid] == TEAM_LF) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_LF_COLOR, TEAM_LF_COLOR, TEAM_LF_COLOR, TEAM_LF_COLOR, TEAM_LF_COLOR);
}
if(gTeam[playerid] == TEAM_LS) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_LS_COLOR, TEAM_LS_COLOR, TEAM_LS_COLOR, TEAM_LS_COLOR, TEAM_LS_COLOR);
}
if(gTeam[playerid] == TEAM_LSPD) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR);
}
if(gTeam[playerid] == TEAM_HOODRATS) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR);
}
if(gTeam[playerid] == TEAM_RCPD) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR);
}
if(gTeam[playerid] == TEAM_LBC) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_LBC_COLOR, TEAM_LBC_COLOR, TEAM_LBC_COLOR, TEAM_LBC_COLOR, TEAM_LBC_COLOR);
}
if(gTeam[playerid] == TEAM_BDK_COLOR) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_BDK_COLOR, TEAM_BDK_COLOR, TEAM_BDK_COLOR, TEAM_BDK_COLOR, TEAM_BDK_COLOR);
}
if(gTeam[playerid] == TEAM_GC) {
format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
ProxDetector(10.0, playerid, str, TEAM_GC_COLOR, TEAM_GC_COLOR, TEAM_GC_COLOR, TEAM_GC_COLOR, TEAM_GC_COLOR);
}
return 0;
}