Is it possible to attach a object to a 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: Is it possible to attach a object to a NPC? (
/showthread.php?tid=292954)
Is it possible to attach a object to a NPC? -
Flake. - 26.10.2011
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
Re: Is it possible to attach a object to a NPC? -
Joe Staff - 26.10.2011
AttachObjectToPlayer should work just fine.
Re: Is it possible to attach a object to a NPC? -
[MWR]Blood - 26.10.2011
https://sampwiki.blast.hk/wiki/AttachObjectToPlayer
You might just replace playerid with the ID of your NPC.
Re: Is it possible to attach a object to a NPC? -
Michael@Belgium - 26.10.2011
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;
}
Re: Is it possible to attach a object to a NPC? -
Sasino97 - 26.10.2011
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;
}
}
Re: Is it possible to attach a object to a NPC? -
Michael@Belgium - 26.10.2011
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