[Question] AttachObjectToPlayer
#1

Hey All Community Members.

I'm quite new in the new "AttachObjectToPlayer" function, and I'm about to create a object for a briefcase and i just wonder how i can destroy the object, because you should be able to get a briefcase and destroy it.

Hope i get answer so i can release it soon on SA:MP.

-Thanks, btw I searched but there are nothing about it on the community.
Reply
#2

You just destroy it like any other object.
Reply
#3

Werd, so if I'm going to create a briefcase for everyone that plays on the server how should I do that, create a briefcase one by one?
Reply
#4

I'm not really understanding your questions. If you want to create a briefcase and attach it to a player when they spawn, and destroy it when they die, use the following code:
pawn Код:
public OnPlayerSpawn(playerid)
{
   SetPVarInt(playerid, "Object", CreateObject(briefcaseid, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00));
   AttachObjectToPlayer(GetPVarInt(playerid, "Object"), playerid, 2.0, 2.0, 0.0, 0.00, 0.00, 0.00);
   return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
   DestroyObject(GetPVarInt(playerid, "Object"));
   SetPVarInt(playerid, "Object", -1);
   return 1;
}
You can mess with the offsets yourself to get it in the position of your liking.
Reply
#5

Eh?

I thought holding objects were handled differently to noraml CreateObject?
pawn Код:
SetPlayerHoldingObject(playerid, modelid, bone, x, y, z)
StopPlayerHoldingObject(playerid)
The param is for modelid. You don't need to create an object for this.
pawn Код:
SetPlayerHoldingObject(playerid, 955, 1, 0, 0, 0);
To remove the object, just simple use this:
pawn Код:
StopPlayerHoldingObject(playerid);
Imagine the terrible collisions you would get with normal objects, it just wouldn't be suitable.
Quote:
Originally Posted by ****** search!
Gta Sa:Mp Id ForuM
3 Oct 2009 ... Gta Sa:Mp Id ForuM ... Game Object ID List ( xmovie.xenoma.net ). Weapons : ... 1210 - briefcase w/target circle 1211 - fire hydrant ...
samp-id.blogspot.com/ - Cached
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)