Looking for explanations and differences between these
#1

I'm looking for a detailed difference between -

https://sampwiki.blast.hk/wiki/NPC:OnPlayerText
and
https://sampwiki.blast.hk/wiki/OnPlayerText


Also, I was wondering how exactly an NPC works.

If an NPC runs as a completely different script, we could put some major pieces of code not involving main players away from the MAIN script into the NPC's pawn file and perform them in the NPC's script which would cause less lag yet work the same way?

Instead of running massive string checks under OnPlayerText, we could run these checks under the NPC's script and separate these from the main script, which would probably reduce the load (this can make a big difference in a 300-400 player server/800-1000 player server)

Same for the other functions we're provided with in a_npc

Also, I'm looking for an explanation of SendChat and SendCommand in NPC scripts since there's no wiki documentation on this, I want to know how this works.

Can someone enlighten me?


My main question - Do NPC's run on completely different scripts from the main gamemode? If yes, can they accurately handle the SAME code as the main gamemode

And even if this is possible, how much would this be accurate and how can this be useful/a disadvantage?
Reply
#2

In an NPC script you only have access to the callbacks and functions that are listed in a_npc.inc. Any other default sa-mp include (a_samp, a_objects, a_player, ...) may not be included. This means that you don't have access to things like IsPlayerAdmin, CreateObject, CreateVehicle, etc.

It is true that every NPC runs in its own process. Every time an NPC connects a new samp-npc process is started.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
In an NPC script you only have access to the callbacks and functions that are listed in a_npc.inc. Any other default sa-mp include (a_samp, a_objects, a_player, ...) may not be included. This means that you don't have access to things like IsPlayerAdmin, CreateObject, CreateVehicle, etc.

It is true that every NPC runs in its own process. Every time an NPC connects a new samp-npc process is started.
But if we separately include a_objects and stuff like that (they're natively MADE to be separately included, but it's just that people only do that separate include's in libraries) they'll still work the same way, and they're as accurate as the main ones in the gamemode, right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)