Double chat
#1

Hey guys,
I use Shrewd chat system but when i talk, my text appears in double !

How to fix it?

Код:
public OnPlayerText(playerid, text[])
{
    switch(ChatState{playerid})
	{
		case 0:
		{
			CostumFormat(SCSString,"%s: %s",GetPlayerNameEx(playerid),text);
			SCGeneral(playerid,SCSString,5,7,10,13,15,SWhite,SChat1,SChat2,SChat3,SChat4);
		}
		case 1:
		{
			CostumFormat(SCSString,"[Chuchotement]%s: %s",GetPlayerNameEx(playerid),text);
			SCGeneral(playerid,text,2,4,6,8,10,COLOR_GREY,SChat1,SChat2,SChat3,SChat4);
		}
		case 2:
		{
			CostumFormat(SCSString,"[Crie]%s: %s",GetPlayerNameEx(playerid),text);
			SCGeneral(playerid,text,15,20,25,30,35,SWhite,SChat1,SChat2,SChat3,SChat4);
		}
	}
	SCAnim(playerid,text,at);
	return 1;
}
Thanks
Reply
#2

Add return 0; at the end of each 'case x:'.
Reply
#3

Thanks!
Reply
#4

Doesn't work!

"[Chuchotement]%s: %s" deasapears

If i type : "test"

I have "test"

Instead of " [Chuchotement] name : test"
Reply
#5

Change return 1 to return 0 at the bottom, don't put it in each case.
Reply
#6

It does the same thing, i posted because this didn't worked
Reply
#7

What MP2 said is entirely correct. Returning 1 sends the traditional samp chat. Wait, why would you make your own format function? You are not defining the string. This is how my OnPlayerText code looks. Try to change your stragedy in light of seeing mine.

pawn Код:
public OnPlayerText(playerid, text[])
{
    new pname[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    strreplace(pname,'_',' ');
    switch(pInfo[playerid][pAccent])
    {
        case 0:format(str, sizeof(str), "%s says: %s", pname, text);
        case 1:format(str, sizeof(str), "[American Accent] %s says: %s", pname, text);
        case 2:format(str, sizeof(str), "[Mexican Accent] %s says: %s", pname, text);
        case 3:format(str, sizeof(str), "[Russian Accent] %s says: %s", pname, text);
    }
    ProxDetector(30.0, playerid, str, COLOR_WHITE);
    new lstring[254];
    new File:chatlog=fopen(LOG,io_append);
    format(lstring,254,"[chat][local][%s]: %s\r\n",pname,text);
    fwrite(chatlog,lstring);
    fclose(chatlog);
    return 0;
}
Reply
#8

"strreplace(pname,'_',' ');"

Where does it comes from?

Because i got "error 017: undefined symbol "strreplace""

Thanks
Reply
#9

Quote:
Originally Posted by falor
Посмотреть сообщение
"strreplace(pname,'_',' ');"

Where does it comes from?

Because i got "error 017: undefined symbol "strreplace""

Thanks
Not so sure but try adding this:

pawn Код:
stock strreplace(src[], chartoreplace[], with[])
{
    for(new i = 0; i < strlen(src); i++)
    {
        if(!strcmp(src[i], chartoreplace))
        {
            format(src[i], 1, "%s", with);
        }
    }
    return src;
}
Usage will be:
pawn Код:
strreplace(string, "a", "b");
Will replace each 'a' with a 'b'.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)