Proper RP Chat. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Proper RP Chat. (
/showthread.php?tid=398935)
Proper RP Chat. -
Lynet - 12.12.2012
Hello, i keep make mine RP chat but when i chat none can see it.
Some help? Anyone got a proper rp chat?
Re: Proper RP Chat. -
CoNnoRR - 12.12.2012
use the OnPlayerText or or your cmd where you make it and put on on player text and give if player in range of point
then the player can see the chat thats how we do it and true and false option should also be there
Re: Proper RP Chat. -
Scenario - 12.12.2012
This is something I whipped up for you. It's very simple, but it works.
pawn Код:
public OnPlayerText(playerid, text[])
{
new szString[128];
format(szString, sizeof(szString), "%s says: %s", getName(playerid), text);
sendNearbyMessage(playerid, szString, COLOR_GREY);
// you don't need to specify "range" unless you want to
// COLOR_GREY will need to be your color of choice
return 1;
}
stock getName(playerid) // gets and returns a particular playerid's name
{
new szName[25];
GetPlayerName(playerid, szName, sizeof(szName));
return szName;
}
/* sendNearbyMessage was created by RealCop228 - fuck rights, he doesn't care
the params are:
playerid is the person sending the message
text[] is the string message itself (formatted already)
color is the color you want the message to be
range is the range to send the message, it defaults to 30 meters from playerid's position
*/
stock sendNearbyMessage(playerid, text[], COLOR, Float:range = 30.0)
{
new Float:fPosition[3];
GetPlayerPos(playerid, fPosition[0], fPosition[1], fPosition[2]);
foreach(new i : Player)
{
if(IsPlayerInRangeOfPoint(i, range, fPosition[0], fPosition[1], fPosition[2])
{
SendClientMessage(i, COLOR, text);
}
}
return 1;
}
* Not tested, should work though.
You'll need the LATEST foreach include, by ******.