SA-MP Forums Archive
attach objects to players? - 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: attach objects to players? (/showthread.php?tid=417671)



attach objects to players? - Ananisiki - 22.02.2013

^^^^^^^^


Re: attach objects to players? - JamesS - 22.02.2013

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

here you go. Command for admins only (zcmd & sscanf based) :

PHP код:
new CreateObject(193410,0,0,0,0,0);
CMD:attachobjecttoplayer(payeridparams[])
{
 if(
gPLAYER_INFO[Playerid][ADMIN_LEVEL] > 0)
 {
 * * new 
toplayerobjectid;
 * * if(!
sscanf(params"ui"toplayerobjectid))
 * * {
 * * * * 
AttachObjectToPlayer(objectidtoplayer0,0,0,0,0,0);
 *}
 *else 
SendClientMessage(playerid, -1"USAGE: '/attachobjecttoplayer [partofname/playerid] [objectid]");
 }
 else 
SendClientMessage(playerid, -1"You are not authorized to use this command!"); 
Now, you could also replace the object id by a string, and put "usnew 1 = CreateObject(19341, 0,0,0,0,0,0);
CMD:attachobjecttoplayer(payerid, params[])
{
if(gPLAYER_INFO[Playerid][ADMIN_LEVEL] > 0)
{
* * new toplayer, objectid;
* * if(!sscanf(params, "ui", toplayer, objectid))
* * {
* * * * AttachObjectToPlayer(objectid, toplayer, 0,0,0,0,0,0);
*}
*else SendClientMessage(playerid, -1, "USAGE: '/attachobjecttoplayer [partofname/playerid] [objectid]");
}
else SendClientMessage(playerid, -1, "You are not authorized to use this command!");



you could use a string in the object id, and set "us[lentgh] there. instead. also. Also, you have to replace the if(gPLAYER_INFO[Playerid][ADMIN_LEVEL] > 0), to your script ofcourse.

Didn't test it, but it should work.


Re: attach objects to players? - RajatPawar - 22.02.2013

AttachObjectToPlayer


Re: attach objects to players? - SupremeCommander - 22.02.2013

There is no AttachDynamicObjectToPlayer (for Incognito's streamer) so you have to create an object via CreateObject and then use AttachObjectToPlayer.


Re: attach objects to players? - Ananisiki - 22.02.2013

my pawnos crashing when i add this..


Re: attach objects to players? - Ananisiki - 22.02.2013

^^^^^^^^