03.07.2013, 15:42
I'm trying to make an /l command for my server, but it's not working. I'm not sure why, it just doesn't send the message to anyone but yourself. Here's the code:
COLOR_FADE1 and all the other fades are defined in the top of my script as following:
Thanks in advance!
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(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;
}
pawn Код:
#define COLOR_FADE1 0xFFFFFFFF
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E