SA-MP Forums Archive
R_Bot doen't connect - 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)
+--- Thread: R_Bot doen't connect (/showthread.php?tid=401004)



R_Bot doen't connect - Narushi - 21.12.2012

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;
}



Re: R_Bot doen't connect - LarzI - 21.12.2012

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


Re: R_Bot doen't connect - Threshold - 21.12.2012

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.


Re: R_Bot doen't connect - LarzI - 21.12.2012

- nevermind -


Re: R_Bot doen't connect - Narushi - 21.12.2012

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;
}



Re: R_Bot doen't connect - Threshold - 21.12.2012

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

EDIT: Just try using: Kick(botid);


Re: R_Bot doen't connect - LarzI - 21.12.2012

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;
}



Re: R_Bot doen't connect - Narushi - 21.12.2012

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