NPC:Main Page

From SA-MP Wiki

(Redirected from Category:NPC)
Jump to: navigation, search


NPC:Main Page was added in SA-MP 0.3a This feature was added in SA-MP 0.3a and will not work in earlier versions!


Introduction

The NPCs (Non-Player Characters, also known as 'bots') are a feature introduced since SA-MP 0.3. This new feature allows you to add one or more NPCs inside your server who will work like 'virtual players'. They use a server slot, just like a player would do. What the NPCs do inside your server is scripted using PAWN scripts. The scripts with the 'artificial inteligence' of each NPC isn't scripted inside the gamemode file, nor in a filterscript. They use their own compiled scripts for this task, which have to stay inside the npcmodes directory. That is, if you want to have 20 different NPCs doing different things, you will most likely have to have 20 pawn compiled scripts inside the npcmodes directory. This doesn't mean that you can't use the normal player functions applied to your NPCs (like SetPlayerPos, for example) from inside a gamemode or filterscript.

Each NPC runs in its own process. This can make better use for multi-core proccesors. The new NPC feature adds some more callbacks and functions which can be used just inside NPC scripts. Normally, these scripts just include the a_npc include file, and not the a_samp one as most gamemodes and filterscripts do. There are also a couple of added functions which work in gamemodes and filterscripts to make easier the NPC handling.

The following resources are exclusive for NPC scripts, unless otherwise is stated:

NPC script callbacks

NPC script functions

Functions used only within gamemode/filterscript

Personal tools
Navigation
Toolbox
In other languages