22.02.2013, 06:03
https://sampwiki.blast.hk/wiki/AttachObjectToPlayer
here you go. Command for admins only (zcmd & sscanf based) :
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.
here you go. Command for admins only (zcmd & sscanf based) :
PHP код:
new 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!");
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.