npc_record - 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: npc_record (
/showthread.php?tid=498852)
npc_record -
AroseKhanNiazi - 05.03.2014
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
Re: npc_record -
XK - 05.03.2014
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;
}
Re: npc_record -
AroseKhanNiazi - 05.03.2014
thanks but when i do it saw invalid command
Re: npc_record -
XK - 05.03.2014
here is the filterscript that lets /vrecord work:
Re: npc_record -
AroseKhanNiazi - 05.03.2014
works fine but the bot keeps standing at spawn loc
Re: npc_record -
XK - 05.03.2014
It should work fine i tested it you might have recorded it wrong way
Re: npc_record -
Clad - 05.03.2014
Try to edit OnPlayerSpawn also
Re: npc_record -
AroseKhanNiazi - 05.03.2014
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