npc_record
#1

i loaded the filter script worked fine but when i use command it say invalid command
and i am rcon logged in i wan't to add bots in my server and also tell how to make an bot register or else my server will kick him
Reply
#2

First of all you have to go ingame and load the filterscript npc_record then write /vrecord "anyname you want"
and it will start record,then when you finish recording write /stoprecord
then go to npcmodes and you will find the file with the name you wrote at /vrecord ,then go to pawno and:
pawn Код:
public OnGameModeInit()
{
    ConnectNPC("YourNPC","Record"); // Your NPC's name,you can choose anything,Recor is the name you wrote at /vrecord..
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(!IsPlayerNPC(playerid)) return 0; // If the player is not NPC, nothing will happend

    new playername[64]; //Player String
    GetPlayerName(playerid,playername,64); //This is to get the NPC's name

    if(!strcmp(playername, "YourNPC", true)) { // Detecting if the NPC is spawned. If it is not spawned or the name is wrong, nothing will happend
    // The code you want to do with the NPC...,like if you have recorded npc using a vehicle just make under ongamemode in it NpcCar = AddStaticVehicle(.....
    }
    return 1;
}
Now to anti Npc hackers:
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) {
        new ip_addr_npc[64+1];
        new ip_addr_server[64+1];
        GetServerVarAsString("bind",ip_addr_server,64);
        GetPlayerIp(playerid,ip_addr_npc,64);

        if(!strlen(ip_addr_server)) {
            ip_addr_server = "Your server ip..";
        }

        if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
            // this bot is remote connecting
            printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
            Kick(playerid);
            return 0;
        }
        printf("NPC: Connection from %s is allowed.",ip_addr_npc);
    }

    return 1;
}
Reply
#3

thanks but when i do it saw invalid command
Reply
#4

here is the filterscript that lets /vrecord work:
Reply
#5

works fine but the bot keeps standing at spawn loc
Reply
#6

It should work fine i tested it you might have recorded it wrong way
Reply
#7

Try to edit OnPlayerSpawn also
Reply
#8

Quote:
Originally Posted by XK
Посмотреть сообщение
It should work fine i tested it you might have recorded it wrong way
i recorded on another server and run it on another server
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)