20.05.2015, 01:32
Anywhere as long as it isn't in a callback.
A little info about the params:
playerid - used to send the message to a player. It's there because this function was originally used in a loop.
senderid - should be "playerid" in most cases. This is used to send a warning message to the sender in case their input exceeded the limit of 144.
color - self explanatory
text - string you want to submit
type - 1 = sendclientmessage, 2 = sendclientmessagetoall.
Essentially, you should just do this:
EDIT: If you want to have a local chat, add this function as well (again, anywhere outside any brackets) and use it instead of ReturnSplittedMessage.
Using this, you only need to do this instead of SendClientMessage:
It will only send messages to people that are in range of the provided range
A little info about the params:
playerid - used to send the message to a player. It's there because this function was originally used in a loop.
senderid - should be "playerid" in most cases. This is used to send a warning message to the sender in case their input exceeded the limit of 144.
color - self explanatory
text - string you want to submit
type - 1 = sendclientmessage, 2 = sendclientmessagetoall.
Essentially, you should just do this:
pawn Код:
public OnPlayerText(playerid, text[]) {
ReturnSplittedMessage(playerid, playerid, 0xffffffff, "Text", 2);
return 0;
}
pawn Код:
SendLocalMessage(playerid, color, text[], Float: range)
{
new Float: psX, Float: psY, Float: psZ;
GetPlayerPos(playerid, psX, psY, psZ);
foreach(new i: Player)
{
if(IsPlayerInRangeOfPoint(i, range, psX, psY, psZ))
{
ReturnSplittedMessage(i, playerid, color, text, 1);
}
}
return true;
}
pawn Код:
// senderid, colorid, text, range
SendLocalMessage(playerid, 0xffffffff, text[], Float: range)