SA-MP Forums Archive
NPC HELp How to send command from 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)
+--- Thread: NPC HELp How to send command from npc (/showthread.php?tid=389235)



NPC HELp How to send command from npc - ExpertSahil - 01.11.2012

I want my NPC to use this command: /botcar when his recording plays, he is in vehicle and this command related to the vehicle.


Re: NPC HELp How to send command from npc - rjjj - 01.11.2012

An option is CallRemoteFunction :


pawn Код:
CallRemoteFunction("OnPlayerCommandText", "ds", npcid, "/botcar");  //Replace "npcid" with the NPC's ID.


I hope that I have helped .


Re: NPC HELp How to send command from npc - DBan - 01.11.2012

Quote:
Originally Posted by rjjj
Посмотреть сообщение
An option is CallRemoteFunction :


pawn Код:
CallRemoteFunction("OnPlayerCommandText", "ds", npcid, "/botcar");  //Replace "npcid" with the NPC's ID.


I hope that I have helped .
Or you can just use this: https://sampwiki.blast.hk/wiki/NPC:SendCommand which is a native function to force an npc to send a command.

Maybe that's what you're looking for?


Re: NPC HELp How to send command from npc - ExpertSahil - 01.11.2012

I just want it to be done by npc itselfs i mean i dont want to type any word but just npc spawn and use this command


Re: NPC HELp How to send command from npc - DBan - 01.11.2012

Quote:
Originally Posted by ExpertSahil
Посмотреть сообщение
I just want it to be done by npc itselfs i mean i dont want to type any word but just npc spawn and use this command
So then use https://sampwiki.blast.hk/wiki/NPC:OnNPCSpawn, then https://sampwiki.blast.hk/wiki/NPC:SendCommand in that.


Re: NPC HELp How to send command from npc - ExpertSahil - 01.11.2012

Error is coming out
SendCommand is already defined


Re: NPC HELp How to send command from npc - DBan - 01.11.2012

Quote:
Originally Posted by ExpertSahil
Посмотреть сообщение
Error is coming out
SendCommand is already defined
You have to use a seperate filterscript. In this filterscript, only include <a_npc>, rather than <a_samp>.


Re: NPC HELp How to send command from npc - ExpertSahil - 01.11.2012

Solved, thanks