SA-MP Forums Archive
Echoing messages to IRC?? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Echoing messages to IRC?? (/showthread.php?tid=63849)



Echoing messages to IRC?? - Outbreak - 31.01.2009

I'm wondering how i can echo messages to my IRC chennel that only & % and ~ can read...

At the moment i've got important messages shown to admins in game. I've looked at the script and tried it myself but the messages just echo so everyone in the channel can read them...




Re: Echoing messages to IRC?? - Outbreak - 31.01.2009

I tried that, didn't really like it that way, just wondeirng how to send a message to & % ~ only...


Re: Echoing messages to IRC?? - Streetplaya - 31.01.2009

Oooh you can. Loop through the userlist and notice users with a specific mode.


Re: Echoing messages to IRC?? - Outbreak - 31.01.2009

Thats what i was thinking...because you loop through for the % & and ~ for the irc to ingame commands, so there must be a way to loop through and send a message.

I'm new to the irc stuff so how would i loop through and then send the messages to the % & and ~


Re: Echoing messages to IRC?? - Outbreak - 31.01.2009

Is this anything close to what i should have?

pawn Код:
stock SendPMecho(msg[])
{
    new ircLevel[4];
  ircGetUserLevel(conn, channel, user, ircLevel);
    if(!strcmp(ircLevel, "~", true,1) || !strcmp(ircLevel, "&", true,1) || !strcmp(ircLevel, "@", true,1) || !strcmp(ircLevel, "%", true,1)) return true;
    ircSay(RandomBot(), channel, msg);
    return true;
    }
2 errors
pawn Код:
(1259) : error 017: undefined symbol "conn"
(1261) : error 017: undefined symbol "channel"



Re: Echoing messages to IRC?? - smallo - 01.02.2009

define those errors.


Re: Echoing messages to IRC?? - Outbreak - 01.02.2009

I tried that not sure what to define them as.

Anyone know how to fix this?


Re: Echoing messages to IRC?? - Outbreak - 01.02.2009

Anyone know how i can echo certain messages from ingame to an IRC channel, that only % & @ ~ can read?

I've posted what i tried above but i got the two errors, not sure how to define those two to get it working.


Re: Echoing messages to IRC?? - Streetplaya - 01.02.2009

What u have to do:

- get the irc userlist into a string
- count all spaces in that string
- split the userlist string using strtok
- check whether the user has the mode you want
- send a notice to that user if so


Re: Echoing messages to IRC?? - Outbreak - 01.02.2009

I've never really done anything with IRC stuff before, so its confusing for me..

Is the above code i posted anything close to what i need?




Re: Echoing messages to IRC?? - Outbreak - 06.02.2009

Could someone tell me what i need to do for this? i really dont have a clue if im heading in the right direction with the above code or not.


Re: Echoing messages to IRC?? - Outbreak - 06.02.2009

thanks for the reply. i'll search for that.


Re: Echoing messages to IRC?? - woot - 07.02.2009

-/msg %#chan text

This will just send the text to halfopped users and higher in a certain channel.
The rest is up to you


Re: Echoing messages to IRC?? - Streetplaya - 07.02.2009

well, i've just done something like this

Код:
stock MsgToOps(conn, channel, msg[])
{
	new ulist[512];
	ircGetUserList(conn, channel, ulist, sizeof(ulist));
	new spaces = CountSpaces(ulist);
	new users[spaces][30], idx;
	new ulevel[4], str[128];
	for (new i=0; i<spaces; i++)
	{
	  format(users[i], 30, "%s", strtok(ulist, idx));
	  ircGetUserLevel(conn, channel, users[i], ulevel);
	  if (strcmp(ulevel, "@") == 0 || strcmp(ulevel, "~") == 0 || strcmp(ulevel, "%") == 0 || strcmp(ulevel, "&") == 0)
	  {
	    format(str, sizeof(str), "PRIVMSG %s %s", users[i], msg);
	    ircSendRawData(conn, str);
	  }
	}
}

stock CountSpaces(str[])
{
	new cnt = 0;
	for (new i=0; i<strlen(str); i++)
	{
	  if (str[i] == ' ') cnt++;
	}
	return cnt;
}
i havent tested it and i dont know whether it works.. maybe Y_Less knows