Making a bot skips the register dialog.
#1

Lately I've tried to make a bot in my server, I've followed KC's tutorial, it went all good but then the bot keeps connecting and disconnecting due to the register dialog, how to make the bot skip it?

Thank you.
Reply
#2

Quote:
Originally Posted by kc
Посмотреть сообщение
Common problems

My NPC leaves my server after it joins
Your script is forcing the NPC to login, or you have an anti-cheat / ping kicker that is interfering with your NPC. You can add...
pawn Код:
if(IsPlayerNPC(playerid)) return 1;
... as the first line of any callbacks that bots will use, e.g. OnPlayerRequestClass or OnPlayerRequestSpawn. For an efficient, simple way of excluding NPCs from loops, check out foreach by ******.


My NPC doesn't join my server at all
This is most likely caused by your server being passworded.

I can't get the npc_record filterscript to load
You either don't have the filterscript, or it is already loaded. Try continuing anyway.

My NPC just stands at the spawnpoint
Go back, and re-do the OnPlayerSpawn part of the tutorial.

My NPCs used to connect, but now I have upgraded to >= RC5 they don't.
There is a new maxnpc server.cfg variable that defaults to 0. add...
Код:
maxnpc number_goes_here
...to your server.cfg to fix this issue.
kc mentioned what you'll need to do in that case.
Reply
#3

I did it but it didn't work, thats why I am asking here.
Reply
#4

It worked fine when I used to have NPCs few years ago. If the register dialog is in a filterscript (an example) and you used the code above in gamemode, it won't work.

Check if the player is NPC before you check whether a player is registered or not.
Reply
#5

There is a function to check if hes a bot.Sry,I cant give you code i am on my phone.
Reply
#6

Код:
	if(IsPlayerNPC(playerid)) return 1;
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
I've done this before it checks if the account exists, is it supposed to be like this or?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)