R_Bot doen't connect
#1

Hey,

I wanna learn more about Bots and found the RNPC Plugin.
But my NPC's doens't connect to my Server :S
Why?

Here is my Code:
Код:
COMMAND:cbot(playerid,params[])
{
	for(new i=0; i<sizeof(R_Bot); i++)
	{
	    if(R_Bot[i] > 0) continue;
	    new ID[5];
	    formatEx(playerid,0xFEFEFEFF,"You create a Bot with ID: %i",i);
	    format(ID,sizeof(ID),"%i",i);
	    R_Bot[i] = ConnectRNPC(ID); break;
	}
	return 1;
}
Reply
#2

You should honestly give them names instead of numbers only
pawn Код:
new ID[ 8 ];
format( ID, sizeof( ID ), "Bot%i", i );
- nevermind -
Reply
#3

He's not breaking it straight away, he's breaking it once the new NPC has connected, so that only one NPC connects, not more. Also go to your server.cfg, make sure you have a line saying this:

Код:
maxnpcs 5
You can replace 5 with however many bots you want to be on your server, in this case, more than 0.
Reply
#4

- nevermind -
Reply
#5

Okay thanks it works
And how i can disconnect/kick them?

This one doesn't work ^^
Код:
COMMAND:dbot(playerid,params[])
{
	new ID;
	if(sscanf(params,"i",ID)) {
		Fehler(playerid,"[Usage]: /dbot [BotID]");
		for(new i=0; i<sizeof(R_Bot); i++)
		{
		    if(R_Bot[i] == 0) continue;
		    formatEx(playerid,0xFEFEFEFF,"_________ CONNECTED BOT's ________",0);
		    formatEx(playerid,0xFEFEFEFF,"%i",i);
		}
		return 1;
	}
	if(R_Bot[ID] == 0) return Fehler(playerid,"This Bot doens't exist!");
    RNPC_StopPlayback(R_Bot[ID]);
	return 1;
}
Reply
#6

So the bot has the correct number when it joins I guess.

EDIT: Just try using: Kick(botid);
Reply
#7

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
So the bot has the correct number when it joins I guess.

EDIT: Just try using: Kick(botid);
Ohh, of course. My bad.

pawn Код:
COMMAND:dbot(playerid,params[])
{
    new ID;
    if(sscanf(params,"i",ID))
    {
        Fehler(playerid,"[Usage]: /dbot [BotID]");
        for(new i=0; i<sizeof(R_Bot); i++)
        {
            if(R_Bot[i] == 0) continue;
            formatEx(playerid,0xFEFEFEFF,"_________ CONNECTED BOT's ________",0);
            formatEx(playerid,0xFEFEFEFF,"%i",i);
        }
        return true;
    }
    if(R_Bot[ID] == 0)
        return Fehler(playerid,"This Bot doens't exist!");
    Kick(R_Bot[ID]);
    return 1;
}
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
EDIT: Just try using: Kick(botid);
But this are BotID's. Not playerid's
If I kick Bot 0, i would kick myself
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)