Need help with OnPlayerText - 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: Need help with OnPlayerText (
/showthread.php?tid=556749)
Need help with OnPlayerText -
danielpalade - 11.01.2015
Well for some reason whenever a player says something in chat, it send their message to the whole server.
This is my OnPlayerText.
As you can see there is nothing wrong with it.
How can i fix this?
Код:
public OnPlayerText(playerid, text[])
{
return 1;
}
Re: Need help with OnPlayerText -
danish007 - 11.01.2015
what you want to fix?
Re: Need help with OnPlayerText -
MD5 - 11.01.2015
Quote:
Originally Posted by danielpalade
Well for some reason whenever a player says something in chat, it send their message to the whole server.
This is my OnPlayerText.
As you can see there is nothing wrong with it.
How can i fix this?
Код:
public OnPlayerText(playerid, text[])
{
return 1;
}
|
I'm confused what you're trying to do here, please be more specific?
Re: Need help with OnPlayerText -
danielpalade - 11.01.2015
Quote:
Originally Posted by danish007
what you want to fix?
|
Well as i said, whenever a player says something in chat, their message is sent to the WHOLE server.
I want to make it so when a player types something only players around him will see it.
Re: Need help with OnPlayerText -
Ironboy - 11.01.2015
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
for(new i=0;i<MAX_PLAYERS;i++) {
if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10 ) { //those who stands within 10 metres can only see.
format(string, sizeof(string), "[WHISPER] %s[%d]: %s",pname,playerid,params);
SendClientMessage(i,COLOR_YELLOW,string);}}
return 1;
}
AW: Re: Need help with OnPlayerText -
Nero_3D - 11.01.2015
Quote:
Originally Posted by danielpalade
Well as i said, whenever a player says something in chat, their message is sent to the WHOLE server.
I want to make it so when a player types something only players around him will see it.
|
Well that how a normal chat should be ...
Instead of using the code above you should use this native for it
pawn Код:
// OnGameModeInit
LimitGlobalChatRadius(50.0);
// there is also another limit function
// so you only see player markers who are near you
LimitPlayerMarkerRadius(50.0);
Re: Need help with OnPlayerText -
danielpalade - 11.01.2015
Quote:
Originally Posted by Ironboy
pawn Код:
public OnPlayerText(playerid, text[]) { new string[256], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid,pname,sizeof(pname)); for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10 ) { //those who stands within 10 metres can only see. format(string, sizeof(string), "[WHISPER] %s[%d]: %s",pname,playerid,params); SendClientMessage(i,COLOR_YELLOW,string);}} return 1; }
|
For some reason whenever someone types the text it sends their message twice.
Re: AW: Re: Need help with OnPlayerText -
Ironboy - 11.01.2015
Quote:
Originally Posted by Nero_3D
Well that how a normal chat should be ...
Instead of using the code above you should use this native for it
pawn Код:
// OnGameModeInit LimitGlobalChatRadius(50.0); // there is also another limit function // so you only see player markers who are near you LimitPlayerMarkerRadius(50.0);
|
This instead.