attach objects to players?
#2

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


Messages In This Thread
attach objects to players? - by Ananisiki - 22.02.2013, 05:53
Re: attach objects to players? - by JamesS - 22.02.2013, 06:03
Re: attach objects to players? - by RajatPawar - 22.02.2013, 06:03
Re: attach objects to players? - by SupremeCommander - 22.02.2013, 06:07
Re: attach objects to players? - by Ananisiki - 22.02.2013, 07:03
Re: attach objects to players? - by Ananisiki - 22.02.2013, 07:06

Forum Jump:


Users browsing this thread: 1 Guest(s)