Is it possible to attach a object to a NPC?
#1

Well, i was wondering if it is possible, i would think it is but it would have to track the NPC's moments, if it is could someone please give me a example script?

- Thanks
Reply
#2

AttachObjectToPlayer should work just fine.
Reply
#3

https://sampwiki.blast.hk/wiki/AttachObjectToPlayer

You might just replace playerid with the ID of your NPC.
Reply
#4

Yes would work

In your mini-script:
pawn Код:
public OnNPCSpawn()
  {
    StartRecordingPlayback(RECORDING_TYPE, RECORDING);
    SendCommand("/attachobject");
  }
IN your gamemode:
pawn Код:
CMD:attachobject(playerid,params[])
{
         AttachObjectToPlayer(/*blahblah*/);
         return 1;
}
Reply
#5

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Yes would work

In your mini-script:
pawn Код:
public OnNPCSpawn()
  {
    StartRecordingPlayback(RECORDING_TYPE, RECORDING);
    SendCommand("/attachobject");
  }
IN your gamemode:
pawn Код:
CMD:attachobject(playerid,params[])
{
         AttachObjectToPlayer(/*blahblah*/);
         return 1;
}
And if a player uses that command? He will get that object too!

pawn Код:
CMD:attachobject(playerid,params[])
{
    if(!IsPlayerNPC(playerid)
    {
         AttachObjectToPlayer(/*blahblah*/);
         return 1;
    }
}
Reply
#6

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
And if a player uses that command? He will get that object too!

pawn Код:
CMD:attachobject(playerid,params[])
{
    if(!IsPlayerNPC(playerid)
    {
         AttachObjectToPlayer(/*blahblah*/);
         return 1;
    }
}
lol yes... but your still wrong:

pawn Код:
CMD:attachobject(playerid,params[])
{
    if(IsPlayerNPC(playerid)//it's for npc's :p
    {
         AttachObjectToPlayer(/*blahblah*/);
         return 1;
    }
}
xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)