How can I do this?
#1

Hello guys,

I saw on a server that a "bot" sends randomly messages, but not with SendClientMessage.
The bot just wrote it into Mainchat, and it had a name.

I tried:
pawn Код:
SendPlayerMessage("Bot", "Hi");
but this didnt work....gave me error.

pawn Код:
SendPlayerMessage(playerid, "Hi");
works only for a player.

How can I define the playerid to a bot-name, means a name that I coose.

Can anyone help me?

PS: if you don't understand what I mean, please tell.


I would be happy about a solution.

Jeffry
Reply
#2

Use SendChat..
Ive seen it in the bar on my pawno

Im guessing it works like SendCommand,
But makes the bot talk
Reply
#3

I have mine set up to SendClientMessageToAll(COLOR, "Bot: Hey");

Reply
#4

Quote:
Originally Posted by ScottCFR
I have mine set up to SendClientMessageToAll(COLOR, "Bot: Hey");
Thats what i have too. But I want my Bot answering to people.
@ Joe: Oke, I will have a look on this later. im on laptop without pawn.

SendChatMessage belongs to this: http://forum.sa-mp.com/index.php?topic=49741.0 Wont work.
Reply
#5

Bump!
Does anyone knows this?
Reply
#6

the trick is to script it in the NPC filterscript, have a look
Код:
#define RECORDING "PirateShip" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.
#include <a_npc>
new CyclesMin=20;
new CyclesMax=30;
new CyclesATM=0;
forward TimerPirateShip();
public OnRecordingPlaybackEnd()
	StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
main()
{
  printf("PirateShip");
}
public OnNPCModeInit()
{
	SetTimer("TimerPirateShip",2000,1);
}
public TimerPirateShip()
{
	CyclesATM++;
	if(CyclesATM>CyclesMin)
	{
		if(CyclesATM>CyclesMax || random(10)<2)
		{
			new Amount=100000;
			new NPCcmd[32];
			format(NPCcmd,sizeof(NPCcmd),"/dt %d",Amount);
			SendCommand(NPCcmd);
			new msg[128];
			format(msg,128,"/Aq I lost a Treasure, it is worth $%d! Can someone bring it back?",Amount);
			SendCommand(msg);
			format(msg,128,"I lost a Treasure, it is worth $%d! Can someone bring it back?",Amount);
			SendChat(msg);
			CyclesATM=0;
		}
	}
}
of course i am too lazy to modify it to send random messages >-<
Reply
#7

Ahh, looks nice.
Only problem: Im having 0.2X server.

So will this only work with 0.3?
Reply
#8

umm.. idk, 2 weeks after i started scripting, the 0.3 update got released ^^
i dont see any reason why it shouldnt run at 0.2x
Reply
#9

0.2X hosted list.
Reply
#10

It wont work in 0.2 as bots only exist in 0.3. But you can just save a random message and then send as SendClientMessage

Example from 1 of my scripts
pawn Код:
new PoliceLetter[6][150] = {
{"Hello Kim. As you might have heard there is about to be going a big gang war soon. I don't know when or where. But you need to get some cops ready"},
{"Hey Kim. I just wrote this letter to say hi and hear hows it going out there? My phone is broke lately so i can't call you. Jack"},
{"Bad news. My best cop just got killed by the Mackoli's. Hope you can bring me some new soon. Jack"},
{"Great news Kim! I just got a mole inside the Bonelli family! With this mole we can get alot of information. Hope you feel well. Jack"},
{"Hello Kim. Have you heard? Some chineese triad just came to the city! Like we don't have enough shit to deal with... Jack"},
{"You have surely heard about The Pimp. He has recruited alot of men lately. Too many to just be protecting hes girls. Somethings wrong"}
};

dcmd_readletter(playerid,params[])
{
    #pragma unused params
    if(DeliverPoliceLetter[playerid] == 0) return 0;
    else
    {
      new rand = random(sizeof(PoliceLetter));
      SendClientMessage(playerid,COLOUR_GREEN,"You check if noone is looking and opens the letter");
      SendClientMessage(playerid,COLOUR_YELLOW,PoliceLetter[rand]);
      }
    return 1;
}
I have a police job where you deliver a letter to a person named "kim". Made this command for fun. It sends a random message when /readletter. Hope it helps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)