[UNSOLVED!!]Talking as a channel bot...
#1

Hey Guys,

I'm wanting to know how you can talk as a channel bot, like in IRC and stuff.
I've been playing on Tenshi's awesome PTP server and once in a while someone logins and can talk as the IRC channel bot, here's an example:

Someone is now a civilian
(Mod's name here): Don't attack me 'cos i'm a mod...
(player name here): yeah right
PTPBOT: yes he is, so don't make me ban you....


etc,etc,etc.....
I just wana know how i could login into my server as, lets say DeJordzta, but then be able to talk as, lets say my server was SArift and my bots name was s.a.dBOT, my bot s.a.dBOT??
I Hope this makes sence to you guys......
Reply
#2

pawn Код:
new string[256];
public OnRconCommand(cmd[])
{
  format(string, sizeof(string), "%s", cmd);
  IrcSay(string);
  return 1;
}
The bot will say everything you type in the console, except you type any console commands.
Also, not that irc sided commands, like /quit or /ns register, wont work.

And this will also not work, if you have the irc bot implented into your gamemode

EDIT: Sorry, didn't read your reply good enough. Wait a minute
here:


pawn Код:
public ircOnUserSay(conn, channel[], user[], message[])
{
    if(message[0] != '!') return 1;
   
    irccmd(serversay,9,conn,channel,user,message);
    return 1;
}

irccmd_serversay(conn, channel[], user[], params[])
{
  if(!ircIsOp(conn,channel,user)) return IrcSay("Only irc ops can use this command");

  new string[128];

    if(!strlen(params)) return IrcSay("USAGE: !serversay <message>");

    format(string,sizeof(string), "***s.a.dBOT: %s", params);
    SendClientMessageToAll(0xFF0000AA, string);

    IrcSay(string);
    return 1;
}
also, here's irccmd. It's a slight modiffication of dcmd
pawn Код:
#define irccmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (irccmd_%1(conn,channel,user,"")))||(((%3)[(%2) + 1] == 32) && (irccmd_%1(conn,channel,user,(%3)[(%2) + 2]))))) return 1

And I doubt you could treat the bot as an actual player, to be able to register him
Reply
#3

thats an IRC command done from IRC, but you can make something similar pretty easily.

Quote:

dcmd_bot(playerid, cmdtext[])
{
new message[256], index;

message = strrest(cmdtext, index);

if (!strlen(message))
return SendClientMessage(playerid, red, "Usage: /bot <message>");

format(message, sizeof(message), "* Bot: %s", message);
SendClientMessageToAll(blue, message);

return 1;
}

dont forget to make sure 'strrest' is defined in your script
Reply
#4

kewl, thanx guys!

EDIT:

yea, i used your script Ez 'cos Dice7's script didn't work, had too many errors and i dont know how to fix them...

i have got everything right and only changed the bot name but it comes up with only one error which is:

Код:
bot.pwn(59) : error 033: array must be indexed (variable "message")
PS this is a filterscript, this shouldn't change anything should it?

here's what i have so far:

Код:
#include <a_samp>


#define FILTERSCRIPT

#define strrest
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" IRC bot Chat!");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	SendClientMessageToAll(0xFF000AA, "Please Repect the TokyoDrift Bot!");
	SendClientMessageToAll(0xFF000AA, "Not doing so will get you banned!");
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(bot, 3, cmdtext);
	return 0;
}

dcmd_bot(playerid, cmdtext[])
{
  new message[500], index;

  message = strrest(cmdtext, index);

  if (!strlen(message))
   return SendClientMessage(playerid, 0xFF0000AA, "Usage: /bot <message>");

  format(message, sizeof(message), "**TokyoDrift: %s", message);
  SendClientMessageToAll(0x0000FFFF, message);

  return 1;
}
Help?!
Reply
#5

read post above as it has been edited, sorry 4 double post too...
Reply
#6

Don't Worry, had a long look at SA-MP Wiki and found the /me command which is basically what i need to make the Bot thing.
Thnx all again tho!

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/bot", true, 4)) // 4 is the length of /bot
  {
    if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /bot [message]");
    new str[128];
    format(str, sizeof(str), "*Tokyo-Drift_BOT %s", str, cmdtext[4]);
    SendClientMessageToAll(0xFFFF00AA, str);
    return 1;
  }
  return 0;
}
EDIT: not working, i used the script above but when i typed /bot Hi! it just came up in text as
Код:
SERVER: You are now logged in as Admin
->->->->*Tokyo-Drift_BOT<-<-<-<-<-
DeJordzta: hey all, how r u guyz?
Reply
#7

Not really. There is a way to get 2 colours in your client messages, I just forgot how. It makes the 'bots' seem like they're real people. Fools some noobs trust me, I've seen it lol.
Reply
#8

lolz not working, would like to have help with the dmcd script as it only has the message error.
Reply
#9

Here is the script by Dice7 that i have put into my filterscript but it still says it has errors:
Код:
\samp02Xserver.win32\filterscripts\irc.pwn(27) : warning 235: public function lacks forward declaration (symbol "ircOnUserSay")
\samp02Xserver.win32\filterscripts\irc.pwn(31) : warning 217: loose indentation
\samp02Xserver.win32\filterscripts\irc.pwn(37) : error 017: undefined symbol "ircIsOp"
\samp02Xserver.win32\filterscripts\irc.pwn(37) : error 017: undefined symbol "IrcSay"
\samp02Xserver.win32\filterscripts\irc.pwn(41) : error 017: undefined symbol "IrcSay"
\samp02Xserver.win32\filterscripts\irc.pwn(35) : warning 203: symbol is never used: "conn"
\samp02Xserver.win32\filterscripts\irc.pwn(35 -- 48) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
and here is the actual FS itself:
Код:
#include <a_samp>

//Talk As Bot IRC Op Command Filterscript by Dice7


   
#define FILTERSCRIPT

#define irccmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (irccmd_%1(conn,channel,user,"")))||(((%3)[(%2) + 1] == 32) && (irccmd_%1(conn,channel,user,(%3)[(%2) + 2]))))) return 1


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" 		TALK AS BOT, By DEJORDZTA		");
	print("--------------------------------------\n");
	return 1;
}



public OnFilterScriptExit()
{
	return 1;
}

public ircOnUserSay(conn, channel[], user[], message[])
{
	if(message[0] != '!') return 1;

    irccmd(serversay,9,conn,channel,user,message);
    return 1;
}

irccmd_serversay(conn, channel[], user[], params[])
{
  if(!ircIsOp(conn,channel,user)) return IrcSay("Only irc ops can use this command");

  new string[128];

	if(!strlen(params)) return IrcSay("USAGE: !serversay <message>");

	format(string,sizeof(string), "***TD-BOT: %s", params);
	SendClientMessageToAll(0xFF0000AA, string);
	
	return 1;
}
return 0;
Thnx for any help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)