attach objects to players?
#1

^^^^^^^^
Reply
#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
#3

AttachObjectToPlayer
Reply
#4

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

my pawnos crashing when i add this..
Reply
#6

^^^^^^^^
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)