SendClientMessageToAll always sends double message
#1

So i tried to add a message when someone joins my IRC channel. It worked but the message is always double, i don't know what's wrong, here's the code
Код:
public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    new msg[128];
	format(msg, sizeof(msg), "*** %s has joined the IRC channel ***", user);
	SendClientMessageToAll(0xDDDD2357, msg);
	return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    new msg[128];
	format(msg, sizeof(msg), "*** %s has left the IRC channell", user);
	SendClientMessageToAll(0xDDDD2357, msg);
	return 1;
}
I'm using IRC plugin by Incognito https://sampforum.blast.hk/showthread.php?tid=98803|

oh and here's the "Double message" thing
Reply
#2

I got another question
So i added this under public IRC_OnConnect , to make it send login message to NickServ, but i got a weird error.
Код:
public IRC_OnConnect(botid, ip[], port)
{
	printf("*** IRC_OnConnect: Bot ID %d connected to %s:%d", botid, ip, port);
	// Join the channel
	IRC_JoinChannel(botid, IRC_CHANNEL);
	// Add the bot to the group
	IRC_AddToGroup(groupID, botid);
	
	new str[60] //This is the start of the code i added
	format(str, 60, "nickserv identify SECRETPASS"); //This is line 188 (Where the error occurs)
	IRC_SendRaw(botid, str);
	return 1;
}
and this is the error message
Код:
E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(188) : error 001: expected token: ";", but found "-identifier-"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Where they expect the ";" ??
Reply
#3

new str[60];
Reply
#4

Quote:
Originally Posted by Aly
Посмотреть сообщение
new str[60];
Thanks lol, btw how about the double message?
Reply
#5

IT all seems fine with the code you've posted.The error is somewhere else.
Reply
#6

Hmm so i figure out the problem i think it's caused by the bots. I currently have 2 bots on my IRC, tested joining when the 2nd bot haven't joined and it worked fine.

So now, my question is, how do i make only 1 bot to do SendClientMessageToAll ?
Thanks for the help tho, i really don't know anything about scripting :c


Oh and here's the command to send message in-game from IRC, i used it to do the same thing with the joining message (Might help)
Код:
IRCCMD:say(botid, channel[], user[], host[], params[])
{
	if (!isnull(params))
	{
		new msg[128];
		// Echo the formatted message
		format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
		IRC_GroupSay(groupID, channel, msg);
		format(msg, sizeof(msg), "*** %s on IRC: %s", user, params);
		SendClientMessageToAll(0xFF9900AA, msg);
	}
}
It doesn't appear double when using this command so i think i'm missing something from this
Reply
#7

What does IRC_GroupSay ?Can You post that function?
Reply
#8

Quote:
Originally Posted by Aly
Посмотреть сообщение
What does IRC_GroupSay ?Can You post that function?
Sorry for late reply, but i can't find that function anywhere in the script... (and the include)
Reply
#9

Just remove SendClientMessageToAll and leave that IRC_GroupSay function.
Reply
#10

/say is actually sending 2 client messages, if you format twice and send once it will still send twice.. i would suggest you to try using different cells for every format you do, if you want one message for server and one for irc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)