[Tutorial] Creating a new NPC

Did you tell it to move anywhere?
Reply

Anybody having the issue of the bot spawning in the sky, use AddStaticVehicleEx() with the same parameters as CreateVehicle. There's no need to set the spawn location of the bot. This will fix it.
Reply

Quote:
Originally Posted by Xlithan
View Post
Anybody having the issue of the bot spawning in the sky, use AddStaticVehicleEx() with the same parameters as CreateVehicle. There's no need to set the spawn location of the bot. This will fix it.
It didn't fix it for me and nothing can fix it it seems. It can't be a script problem because it was always working without any problems, then 0.3x came and it stopped working all of a sudden, nothing at all was changed in the scripts. The bots simply don't get put into their vehicles and the vehicles remain on their spawn coordinate. Tried a lot of things, tried what you advised, tried using both normal and PVars to store the vehicle ID in which they should be put, tried changing the seat, tried using the timer to delay their placement in the created vehicles, nothing...
Reply

if i have recorded my npc i don't have the mynpc.rec in my folder how to fix that?
Reply

bump
Reply

MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);


what is the number for "colored red"
Reply

Quote:
Originally Posted by Craker
View Post
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);


what is the number for "colored red"
https://sampwiki.blast.hk/wiki/NPC:Main_Page
Reply

I'm new to scripting. Is there a Download Link for this NPC_Record.pwn and .amx file? I got lost and im confused now. If someone could help me out with that. That would be Awesome. I will leave Credit to those who help me with my ingame command /credits
Reply

Quote:
Originally Posted by ClubU295
View Post
I'm new to scripting. Is there a Download Link for this NPC_Record.pwn and .amx file? I got lost and im confused now. If someone could help me out with that. That would be Awesome. I will leave Credit to those who help me with my ingame command /credits
Please check your default SA-MP package and just see filterscripts folder, it has npc_record.pwn and .amx file.
Reply

Nice tutorial! Wel ldone.
Reply

I got a lot of errors...

I'm did it on a FilterScript

PHP Code:
#define RECORDING "mynpc" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.
#include <a_npc>
main(){}
public 
OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPERECORDING);
#if RECORDING_TYPE == 1
  
public OnNPCEnterVehicle(vehicleidseatidStartRecordingPlayback(RECORDING_TYPERECORDING);
  public 
OnNPCExitVehicle() StopRecordingPlayback();
#else
  
public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPERECORDING);
#endif
ConnectNPC("Dave","mynpc");
public 
OnFilterScriptInit()
{
  print(
"my filterscript");
  
ConnectNPC("MyFirstNPC","mynpc");
  return 
1;
}
new 
MyFirstNPCVehicle//Global variable!
public OnFilterScriptInit()
{
  print(
"my filterscript");
  
ConnectNPC("MyFirstNPC","mynpc");
  
MyFirstNPCVehicle CreateVehicle(4000.00.05.00.0335000);
  return 
1;
}
public 
OnPlayerSpawn(playerid)
{
  if(
IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  
{
    new 
npcname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnpcnamesizeof(npcname)); //Getting the NPC's name.
    
if(!strcmp(npcname"MyFirstNPC"true)) //Checking if the NPC's name is MyFirstNPC
    
{
      
PutPlayerInVehicle(playeridMyFirstNPCVehicle0); //Putting the NPC into the vehicle we created for it.
    
}
    return 
1;
  }
  
//Other stuff for normal players goes here!
  
return 1;

Errors:

PHP Code:
C:\Users\Bruno\Desktop\Untitled.pwn(18) : error 010invalid function or declaration
C
:\Users\Bruno\Desktop\Untitled.pwn(20) : warning 235: public function lacks forward declaration (symbol "OnFilterScriptInit")
C:\Users\Bruno\Desktop\Untitled.pwn(23) : error 004: function "ConnectNPCis not implemented
C
:\Users\Bruno\Desktop\Untitled.pwn(29) : warning 235: public function lacks forward declaration (symbol "OnFilterScriptInit")
C:\Users\Bruno\Desktop\Untitled.pwn(30) : error 021symbol already defined"OnFilterScriptInit"
C:\Users\Bruno\Desktop\Untitled.pwn(32) : error 004: function "ConnectNPCis not implemented
C
:\Users\Bruno\Desktop\Untitled.pwn(33) : error 017undefined symbol "CreateVehicle"
C:\Users\Bruno\Desktop\Untitled.pwn(37) : warning 235: public function lacks forward declaration (symbol "OnPlayerSpawn")
C:\Users\Bruno\Desktop\Untitled.pwn(39) : error 017undefined symbol "IsPlayerNPC"
C:\Users\Bruno\Desktop\Untitled.pwn(45) : error 017undefined symbol "PutPlayerInVehicle"
C:\Users\Bruno\Desktop\Untitled.pwn(33) : warning 204symbol is assigned a value that is never used"MyFirstNPCVehicle"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
7 Errors

Reply

This error While Compiling the file
Quote:

C:\Users\Farhad_2\Desktop\Zendegi Majazi Iran\npcmodes\mynpc.pwn(2 : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
C:\Users\Farhad_2\Desktop\Zendegi Majazi Iran\npcmodes\mynpc.pwn(2 : error 017: undefined symbol "StartRecordingPlayback"
C:\Users\Farhad_2\Desktop\Zendegi Majazi Iran\npcmodes\mynpc.pwn(34) : warning 235: public function lacks forward declaration (symbol "OnNPCSpawn")
C:\Users\Farhad_2\Desktop\Zendegi Majazi Iran\npcmodes\mynpc.pwn(34) : error 017: undefined symbol "StartRecordingPlayback"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

2 Errors.

Reply

Thankks for help
Reply

Help me pls
other bots connect to server without problem
but this bot that i made with this tutorial has problem
i can't fix it
[08:14:01] [npc:join] Maryam_Driverr has joined the server (5:127.0.0.1)
[08:14:16] [npcart] Maryam_Driverr has left the server (5:0)
heeeeeeeelp pls
Reply

Quote:
Originally Posted by mehdimmz
View Post
Help me pls
other bots connect to server without problem
but this bot that i made with this tutorial has problem
i can't fix it
[08:14:01] [npc:join] Maryam_Driverr has joined the server (5:127.0.0.1)
[08:14:16] [npcart] Maryam_Driverr has left the server (5:0)
heeeeeeeelp pls
This occurs when a recording file is missing. Make sure if your using the default NPC system, it has a compiled NPC script(.amx) inside the npcmodes folder, and a proper recording file inside the recordings folder(npcmodes/recordings). The recording file should be a .rec file.
Reply

Is that really your picture Abagail ?
Reply

Did anyone try this in samp 0.3z? I ask this cuz either the creator of the tutorial or the guy who made a tutorial vid of this on ******* wrote that this works in 0.3x but he's not sure that it worx in 0.3z SO i need infos on whether it works in 0.3z or not cuz i tried it once in 0.3z and i got everything in place and all needed scripts compiled without errors (might aswell call this 1/3rd success) and the npc enters the server and "doesnt leave" (2/3rd success) but I DONT SEE IT GOING ON THE ROUTE I RECORDED! (no success :S )
Reply

I read a part of it and i have a question

What if a normal player wanted to add an NPC (Paid for it or whatever) we should give him the recon password?
Reply

Quote:
Originally Posted by Arastair
View Post
I read a part of it and i have a question

What if a normal player wanted to add an NPC (Paid for it or whatever) we should give him the recon password?
No, not if you want your server to be messed with, only you should know the RCON password plus only you can add them into the script anyway.
Reply

Hello i have few questions about his tut please help :


1. it was working for my seems to by perfect till i change vehicle modelid to train 538 then my npc join server and just stand in sf train station car parking , before i change modelid they drive on rail raod with a cars

2.how can i make them trackable by using /mapp command
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)