if(!strcmp("/l", cmdtext, true, 2)) {
if(!cmdtext[2]) return SendClientMessage(playerid, RED, "THIS IS HOW WE DO IT: /l [Local Chat]");
new str[256];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "%s says: %s", str, cmdtext[3]);
for (new i=0; i<=MAX_PLAYERS; i++){
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(i, x, y, z);
switch(GetPlayerDistanceFromPoint(playerid, x, y, z)){
case 0..5: SendClientMessage(i, COLOR_FADE1, str);
case 6..10: SendClientMessage(i, COLOR_FADE2, str);
case 11..15: SendClientMessage(i, COLOR_FADE3, str);
case 16..20: SendClientMessage(i, COLOR_FADE4, str);
case 21..25: SendClientMessage(i, COLOR_FADE5, str);
}
}
return 1;
}
#define COLOR_FADE1 0xFFFFFFFF
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
if(!strcmp("/l", cmdtext, true, 2)) {
if(!cmdtext[2]) return SendClientMessage(playerid, RED, "THIS IS HOW WE DO IT: /l [Local Chat]");
new str[256];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "%s says: %s", str, cmdtext[3]);
for (new i=0; i<=MAX_PLAYERS; i++){
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
switch(GetPlayerDistanceFromPoint(i, x, y, z)){
case 0..5: SendClientMessage(i, COLOR_FADE1, str);
case 6..10: SendClientMessage(i, COLOR_FADE2, str);
case 11..15: SendClientMessage(i, COLOR_FADE3, str);
case 16..20: SendClientMessage(i, COLOR_FADE4, str);
case 21..25: SendClientMessage(i, COLOR_FADE5, str);
}
}
return 1;
}
Don't bump until after 24 hours.
pawn Код:
|
if(!strcmp("/l", cmdtext, true, 2)) {
if(!cmdtext[2]) return SendClientMessage(playerid, RED, "THIS IS HOW WE DO IT: /l [Local Chat]");
new str[256];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "%s says: %s", str, cmdtext[3]);
for (new i=0; i<=MAX_PLAYERS; i++){
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
switch(GetPlayerDistanceFromPoint(i, x, y, z)){
case 0..5: SendClientMessageToAll(COLOR_FADE1, str);
case 6..10: SendClientMessageToAll(COLOR_FADE2, str);
case 11..15: SendClientMessageToAll(COLOR_FADE3, str);
case 16..20: SendClientMessageToAll(COLOR_FADE4, str);
case 21..25: SendClientMessageToAll(COLOR_FADE5, str);
}
}
return 1;
}
SendClientMessageToAll:
pawn Код:
|
if(!strcmp("/l", cmdtext, true, 2)) {
if(!cmdtext[2]) return SendClientMessage(playerid, RED, "THIS IS HOW WE DO IT: /l [Local Chat]");
new str[256];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "%s says: %s", str, cmdtext[3]);
new Float:x,Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for (new i=0; i<=MAX_PLAYERS; i++){
switch(GetPlayerDistanceFromPoint(i, x, y, z)){
case 0..5: SendClientMessage(i, COLOR_FADE1, str);
case 6..10: SendClientMessage(i, COLOR_FADE2, str);
case 11..15: SendClientMessage(i, COLOR_FADE3, str);
case 16..20: SendClientMessage(i, COLOR_FADE4, str);
case 21..25: SendClientMessage(i, COLOR_FADE5, str);
}
}
return 1;
}
if(strcmp(cmd, "/local", true) == 0 || strcmp(cmd, "/l", true) == 0) == 0)
{
if(IsPlayerConnected(playerid))
{
new str[160];
GetPlayerName(playerid, str, MAX_PLAYER_NAME);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[200];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/l)ocal [local chat]");
return 1;
}
format(string, sizeof(string), "%s Says: %s", str, result);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
printf("%s", string);
}
return 1;
}
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);
new playerworld, player2world;
playerworld = GetPlayerVirtualWorld(playerid);
player2world = GetPlayerVirtualWorld(i);
if(playerworld == player2world)
{
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);
}
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
return 1;
}
GetPlayerPos(playerid, x, y, z);
for (new i=0; i<=MAX_PLAYERS; i++){
if (IsPlayerInRangeOfPoint(i, 5, x, y, z)){
SendClientMessage(i, COLOR_FADE1, str);
} else if (IsPlayerInRangeOfPoint(i, 10, x, y, z)){
SendClientMessage(i, COLOR_FADE2, str);
} else if (IsPlayerInRangeOfPoint(i, 15, x, y, z)){
SendClientMessage(i, COLOR_FADE3, str);
} else if (IsPlayerInRangeOfPoint(i, 20, x, y, z)){
SendClientMessage(i, COLOR_FADE4, str);
} else if (IsPlayerInRangeOfPoint(i, 25, x, y, z)){
SendClientMessage(i, COLOR_FADE5, str);
}
}