NPC HELp How to send command from npc
#1

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

An option is CallRemoteFunction :


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


I hope that I have helped .
Reply
#3

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?
Reply
#4

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
Reply
#5

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.
Reply
#6

Error is coming out
SendCommand is already defined
Reply
#7

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>.
Reply
#8

Solved, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)