[Question] AttachObjectToPlayer -
tony_fitto - 21.10.2010
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.
Re: [Question] AttachObjectToPlayer -
Memoryz - 21.10.2010
You just destroy it like any other object.
Re: [Question] AttachObjectToPlayer -
tony_fitto - 21.10.2010
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?
Re: [Question] AttachObjectToPlayer -
Grim_ - 22.10.2010
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.
Re: [Question] AttachObjectToPlayer -
Rac3r - 22.10.2010
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
|