Need help with OnPlayerText
#1

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;
}
Reply
#2

what you want to fix?
Reply
#3

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?
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

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);
Reply
#7

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.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)