SA-MP Forums Archive
[HELP] Duble Message - 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] Duble Message (/showthread.php?tid=513241)



[HELP] Duble Message - monster010 - 15.05.2014

I apear 2x message?

ScreenShot


Re: [HELP] Duble Message - Parallex - 15.05.2014

"Are we meant to guess your code?" -******.


Re: [HELP] Duble Message - monster010 - 15.05.2014

pawn Код:
if(strcmp(cmd, "/hc", true) == 0 || strcmp(cmd, "/hchat", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_YELLOW2, "USAGE: (/hchat) [chat]");
                return 1;
            }
            if (PlayerInfo[playerid][pHelper] >= 1)
            format(string, sizeof(string), "{1DFB04}Chat - [Helper] %s : %s **", sendername, result);
            else if (PlayerInfo[playerid][pAdmin] >= 1)
            format(string, sizeof(string), "{1DFB04}Chat - [Admin] %s : %s **", sendername, result);
            {
                SendHelperMessage(COLOR_YELLOW2, string);
            }   SendAdminMessage(COLOR_YELLOW2, string);
        }
        return 1;
    }



Re: [HELP] Duble Message - Parallex - 15.05.2014

Why don't you use sscanf, it's the simple and best way for the params..


Re: [HELP] Duble Message - monster010 - 15.05.2014

Can you give me a link or tutorial?


Re: [HELP] Duble Message - Parallex - 15.05.2014

https://sampforum.blast.hk/showthread.php?tid=120356


Re: [HELP] Duble Message - monster010 - 15.05.2014

And what this plugin helps me?


Re: [HELP] Duble Message - EzioRock - 15.05.2014

https://sampforum.blast.hk/showthread.php?tid=120356

Sscanf


Re: [HELP] Duble Message - Parallex - 15.05.2014

Quote:
Originally Posted by monster010
Посмотреть сообщение
And what this plugin helps me?
Read it, it has more information.


Re: [HELP] Duble Message - Beckett - 15.05.2014

Quote:
Originally Posted by monster010
Посмотреть сообщение
Код:
	if(strcmp(cmd, "/hc", true) == 0 || strcmp(cmd, "/hchat", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_YELLOW2, "USAGE: (/hchat) [chat]");
				return 1;
			}
			if (PlayerInfo[playerid][pHelper] >= 1)
			format(string, sizeof(string), "{1DFB04}Chat - [Helper] %s : %s **", sendername, result);
			else if (PlayerInfo[playerid][pAdmin] >= 1)
			format(string, sizeof(string), "{1DFB04}Chat - [Admin] %s : %s **", sendername, result);
			{
                SendHelperMessage(COLOR_YELLOW2, string);
			}   SendAdminMessage(COLOR_YELLOW2, string);
		}
		return 1;
	}
Are you an admin? because from what you are coding it sends 2 messages one to Admins and one to Helpers, therefore if you're a helper and an admin then you'll get message twice.