PDA

View Full Version : Help with RP chat


Ziyan
12/06/2013, 02:35 PM
First sorry for my bad english. I have problem with OnPlayerText...
This is how it's look:
public OnPlayerText(playerid, text[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You cannot speak, while you are silenced.");
return 1;
}
if(realchat == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s says: %s", sendername, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
return 1;
}
return 0;
}

The problem is that when i type something it's look like %s: %s (name, text), not %s says: %s (name, text). And only ID 0 in game see it. And when i mute someone, he is still allowed to talk.

feartonyb
12/06/2013, 02:41 PM
When you want someone to be muted you need to return 0 so the message can't be sent.

I edited whole code for you.


public OnPlayerText(playerid, text[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You cannot speak, while you are silenced.");
return 0;
}
if (realchat)
{
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s says: %s", sendername, text);
ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE 3,COLOR_FADE4,COLOR_FADE5);
}
return 1;
}

Ziyan
12/06/2013, 03:17 PM
Still same problem.
http://www.zaslike.com/files/p2fybv1tq9n6aox98x77.png

feartonyb
12/06/2013, 05:57 PM
The thing is that OnPlayerText doesn't take any effect in your gamemode. The problem can be next:
In one of your FS there is another OnPlayerText public where its %s: %s

Ziyan
12/06/2013, 08:17 PM
That helped, but now i got %s says: %s, and %s: %s.
And that %s: %s can see everyone from anywhere.

feartonyb
13/06/2013, 01:07 PM
Search in your Filterscripts if there is an OnPlayerText

Ziyan
14/06/2013, 12:33 AM
I did it already, i deleted all OnPlayerText publics, but i still get both... %s: %s(Which can be seen by everyone, regardless of distance) and %s says: %s(That works well) :3

IceBilizard
14/06/2013, 07:25 AM
public OnPlayerText(playerid, text[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You cannot speak, while you are silenced.");
return 0;
}
if (realchat)
{
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s says: %s", sendername, text);
SendClientMessageToAll(COLOR_WHITE, string);
ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE 3,COLOR_FADE4,COLOR_FADE5);
return 0;
}
return 1;
}

Ziyan
18/06/2013, 06:00 AM
I've removed all fs, and there's still message which everyone can see (regardless of distance). I don't want that SendMessageToAll, here is my code:
public OnPlayerText(playerid, text[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You cannot speak, while you are silenced.");
return 0;
}
if (realchat)
{
if(gPlayerLogged[playerid] == 0)
{
return 0;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s says:%s", sendername, text);
ProxDetector(20.0, playerid,string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE 3,COLOR_FADE4,COLOR_FADE5);
}
return 1;
}
There's no SendMessageToAll, but when i type something, same message sends to all players.

Ziyan
18/06/2013, 12:22 PM
I solved the problem, thanks anyway. :)