SA-MP Forums Archive
[Tutorial] Creating a new NPC - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Creating a new NPC (/showthread.php?tid=95034)

Pages: 1 2 3 4 5 6 7 8


Re: Creating a new NPC - DeadDon - 06.09.2011

You dont have OnPlayerSpawn info for just usual NPCs without vehicles. -.-"
My bot just stands at spawn place, but he is not recorded driving cars.


Re: Creating a new NPC - MicroD - 17.09.2011

How to add bot name like other players on tab list?


Re: Creating a new NPC - loganout - 18.09.2011

On my server the NPC does not move around, I'm using a GM BMG

Incoming connection: 127.0.0.1:60029
[npc: join] PorteiroVIP has joined the server <0:127.0.0.1>
Incoming connection: 189.6.8.98:60263
[join] Vinicius_Smith has joined the server <1:189.6.8.98>
File Name: Conce / Vinicius_Smith.ini
Vinicius_Smith logged on the server.

However when I put in grandlarc worked perfectly

please!


Re: Creating a new NPC - manchestera - 16.10.2011

Ok ive done it as a fs and it complies find no errors or warnings but it isnt appearing ingame and i cant see it tring to login in.

Code:
#define FILTERSCRIPT

#include <a_samp>



#if defined FILTERSCRIPT

new MyFirstNPCVehicle; //Global variable!
public OnFilterScriptInit()
{
  print("my filterscript");
  ConnectNPC("MyFirstNPC","area51tank1");
  MyFirstNPCVehicle = CreateVehicle(432, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
  return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

#endif

public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
    {
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
    }
    return 1;
  }
  //Other stuff for normal players goes here!
  return 1;
}



Re: Creating a new NPC - whitedragon - 16.10.2011

Do you load filterscript?


Re: Creating a new NPC - manchestera - 16.10.2011

yes the fliterscript loads fine.

edit- Ive got signs now of him connecting in the server log but he disconnects striaght away


Re: Creating a new NPC - Jagofr - 16.10.2011

My npc gets into the server but disconnects after a few seconds
pawn Code:
[npc:join] npcname has joined the server (0:127.0.0.1)
[npc:part] npcname has left the server (0:0)
!edit:! Never Mind Fixed it..


Re: Creating a new NPC - cowmilker69 - 23.04.2012

i can't compile it because i get this:
C:\Users\user1\Desktop\GTA SA server\filterscripts\gl_npcs.pwn(162) : error 021: symbol already defined: "OnFilterScriptInit"
C:\Users\user1\Desktop\GTA SA server\filterscripts\gl_npcs.pwn(169) : error 021: symbol already defined: "OnFilterScriptInit"
C:\Users\user1\Desktop\GTA SA server\filterscripts\gl_npcs.pwn(176) : error 021: symbol already defined: "OnPlayerSpawn"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

The hell? how to fix?


Re: Creating a new NPC - stormchaser206 - 04.05.2012

My NPC are not saving to scriptfiles or recordings?


Re: Creating a new NPC - adelechevarria - 04.05.2012

Wheres the Download


Re: Creating a new NPC - faff - 13.05.2012

Npc's are allowed on my server xD But i got an problem... How can i despawn the npc ?
I want to do it whit a timer xD!


Re: Creating a new NPC - stormchaser206 - 14.05.2012

My npc just falls out of the car at random points, heres a video:
YouTube





Re: Creating a new NPC - Suraj - 14.05.2012

Thx it was very useful for me


Re: Creating a new NPC - stormchaser206 - 15.05.2012

Quote:
Originally Posted by stormchaser206
View Post
My npc just falls out of the car at random points, heres a video:
http://www.youtube.com/watch?v=r3I91qCOqoA
Someone please help / bump


Re: Creating a new NPC - maverick378 - 16.05.2012

Are you a teacher or something..?You can make this tutorial understoodable.......Nice done


Re: Creating a new NPC - JEkvall95 - 11.06.2012

I don't get it right what code should I put as a whole to make it work in the game mod?

public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
//Other stuff for normal players goes here!
return 1;
}


Re: Creating a new NPC - JEkvall95 - 13.06.2012

This tutorioal doesn't work. I think I have followed all the steps. Well actually I need help I don't get it to work. What have I done wrong?


Re: Creating a new NPC - x96664 - 14.11.2012

Awesome tutorial! Rep+


Re: Creating a new NPC - [KHK]Khalid - 14.11.2012

Quote:
Originally Posted by IIKINGII
View Post
How can i change the skin of my bot
https://sampwiki.blast.hk/wiki/SetPlayerSkin.


Re: Creating a new NPC - romka - 06.12.2012

my bot just standing at the spawn point please help i to spawn tutorial again put just standing at the spawn