AttachObject problems..
#1

If I've attached an object to a player, how do I DeAttach it?

Cause I've made a nice script but I can't DeAttach the object, and I don't want to delete it because I may want to re-attach it later(and if I destroy the object the pawn won't detect it).

Help plz?
Reply
#2

It's quite simple, all you need to do is to recreate the object in it's same positions and rotations.

For example:

pawn Код:
new object;

object = CreateObject(modelid,x,y,z,rotx,roty,rotz,drawdistance);

AttachObjectToPlayer(object,playerid,stuff here);

//And when you want to de-attach, simply:

new Float:x,Float:y,Float:z,Float:rotX,Float:rotY,Float:rotZ;

GetObjectPos(object,x,y,z);
GetObjectRot(object,rotX,rotY,rotZ);

DestroyObject(object);

object = CreateObject(modelid,x,y,z,rotX,rotY,rotZ,draw_distance);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)