SendLocalClientMessage(playerid, Float:dist, color, str[])
{
if(IsPlayerConnected(playerid))
{
new Float:ppos[3];
GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
SendClientMessage(playerid, color, str);
foreach(Player, i)
{
if(IsPlayerConnected(i) && i != playerid)
{
if(IsPlayerInRangeOfPoint(i, dist, ppos[0], ppos[1], ppos[2]))
{
SendClientMessage(i, color, str);
}
}
}
}
return 1;
}
CMD:test(playerid, params[])
{
SendLocalClientMessage(playerid, 30.0, COLOR_GREY, "If you see this message, \"SendClientLocalMessage\" works");
return 1;
}
SendLocalClientMessage(playerid, Float:dist, color, str[])
{
if(IsPlayerConnected(playerid))
{
new Float:ppos[3];
GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
SendClientMessage(playerid, color, str);
foreach(Player, i)
{
if(i != playerid)
{
if(IsPlayerInRangeOfPoint(i, dist, ppos[0], ppos[1], ppos[2]))
{
return SendClientMessage(i, color, str);
}
}
}
}
}
stock SendLocalClientMessage(playerid, Float:dist, color, str[]) { if(IsPlayerConnected(playerid)) { new Float:ppos[3]; GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]); SendClientMessage(playerid, color, str); foreach(Player, i) if(IsPlayerInRangeOfPoint(i, dist, ppos[0], ppos[1], ppos[2])) { return SendClientMessage(i, color, str); } } return 1; }
CMD:test(playerid, params[]) { SendLocalClientMessage(playerid, COLOR_WHITE, "TEST 123"); return 1; }
stock SendLocalClientMessage(playerid, Float:dist, color, str[])
{
new Float:ppos[3];
GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
foreach(Player, i)//I'm not sure what foreach are you using because the foreach of ****** that I use is a little different, and it doesn't need use the 'if(IsPlayerConnected(i))'
{
if(IsPlayerInRangeOfPoint(i, dist, ppos[0], ppos[1], ppos[2]))
SendClientMessage(i, color, str);
}
}
CreatePlayerMeString(playerid, astr[])
{
new name[MAX_PLAYER_NAME], string[1024];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "* %s %s", name, astr);
return string;
}
new mestring = CreatePlayerMeString(playerid, "wishes that his custom function could work");
CMD:me(playerid, params[]) { new string[128]; format(string, sizeof(string), "%s", CreatePlayerMeString(playerid, params); SendClientMessage(playerid, -1, string); return 1: }
First of all, string[1024] is a really big mistake that you are making. SendClientMessage can only send 144 characters, so you are creating way too big string.
CreatePlayerMeString would work like this. Код:
CMD:me(playerid, params[]) { new string[128]; format(string, sizeof(string), "%s", CreatePlayerMeString(playerid, params); SendClientMessage(playerid, -1, string); return 1: } |
First of all, string[1024] is a really big mistake that you are making. SendClientMessage can only send 144 characters, so you are creating way too big string.
CreatePlayerMeString would work like this. Код:
CMD:me(playerid, params[]) { new string[128]; format(string, sizeof(string), "%s", CreatePlayerMeString(playerid, params); SendClientMessage(playerid, -1, string); return 1: } |
SendLocalClientMessage(playerid, Float:dist, color, str[])
{
new Float:ppos[3];
GetPlayerPos(playerid, ppos[0], ppos[1], ppos[2]);
SendClientMessage(playerid, color, str);
for(new i = 0; i < MAX_PLAYERS; i ++ )
{
if(IsPlayerConnected(i) && i != playerid)
{
if(IsPlayerInRangeOfPoint(i, dist, ppos[0], ppos[1], ppos[2]))
{
SendClientMessage(i, color, str);
}
}
}
return 1;
}