how to make a NPC to just stand?
#1

how can i make a NPC TO STAND and dont move ?

example i am making a medic npc to stand outside of hospital with checkpoint infront of him
Reply
#2

SetMyPos and use "npcidle" for the npcmode in ConnectNPC... On my phone so short to the point..
Reply
#3

Create a new npcmode (in the npcmodes folder and compile it) for instance lets call it idlemedic. It should contain:
pawn Код:
#include <a_npc>
main(){}
Now go to your gamemode/fs and add the following things:
pawn Код:
//under ongamemode/filterscriptinit
ConnectNPC("Medic[BOT]","idlemedic");//Medic[BOT] stands for his name and idlemedic for the script name

//under onplayerspawn
    if(IsPlayerNPC(playerid))
    {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Medic[BOT]", true))
    {
      //Here you set his position, interior and whatever you want
    }
    return 1;
    }

//here continues your code in the onplayerspawn callback
P.S: It's not tested so if you encounter some issues you can pm me.
Reply
#4

Quote:
Originally Posted by Wizzy951
Посмотреть сообщение
Create a new npcmode (in the npcmodes folder and compile it) for instance lets call it idlemedic. It should contain:
pawn Код:
#include <a_npc>
main(){}
Now go to your gamemode/fs and add the following things:
pawn Код:
//under ongamemode/filterscriptinit
ConnectNPC("Medic[BOT]","idlemedic");//Medic[BOT] stands for his name and idlemedic for the script name

//under onplayerspawn
    if(IsPlayerNPC(playerid))
    {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Medic[BOT]", true))
    {
      //Here you set his position, interior and whatever you want
    }
    return 1;
    }

//here continues your code in the onplayerspawn callback
P.S: It's not tested so if you encounter some issues you can pm me.
it dont show
Reply
#5

It dont show what? That the npc connects? if so change maxnpcs in server.cfg
Reply
#6

Why don't you use this awsome release ?
https://sampforum.blast.hk/showthread.php?tid=303828
Reply
#7

Quote:
Originally Posted by Clad
Посмотреть сообщение
Why don't you use this awsome release ?
https://sampforum.blast.hk/showthread.php?tid=303828
thats the one i was trying rite now it dont work
Reply
#8

Quote:
Originally Posted by Crayder
Посмотреть сообщение
It dont show what? That the npc connects? if so change maxnpcs in server.cfg
i did exacly how u told me but it wont show at all even changed the npcmax to 50
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)