SA-MP Forums Archive
Help with 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: Help with RP chat (/showthread.php?tid=443535)



Help with RP chat - Ziyan - 12.06.2013

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.


Re: Help with RP chat - feartonyb - 12.06.2013

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_FADE3,COLOR_FADE4,COLOR_FADE5);
	}
        return 1;
}



Re: Help with RP chat - Ziyan - 12.06.2013

Still same problem.
http://www.zaslike.com/files/p2fybv1tq9n6aox98x77.png


Re: Help with RP chat - feartonyb - 12.06.2013

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


Re: Help with RP chat - Ziyan - 12.06.2013

That helped, but now i got %s says: %s, and %s: %s.
And that %s: %s can see everyone from anywhere.


Re: Help with RP chat - feartonyb - 13.06.2013

Search in your Filterscripts if there is an OnPlayerText


Re: Help with RP chat - Ziyan - 13.06.2013

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


Re: Help with RP chat - IceBilizard - 14.06.2013

pawn Код:
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_FADE3,COLOR_FADE4,COLOR_FADE5);
        return 0;
    }
    return 1;
}



Re: Help with RP chat - Ziyan - 18.06.2013

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_FADE3,COLOR_FADE4,COLOR_FADE5);
	}
    return 1;
}
There's no SendMessageToAll, but when i type something, same message sends to all players.


Re: Help with RP chat - Ziyan - 18.06.2013

I solved the problem, thanks anyway.