public OnObjectMovedEventArgs(GameObject o, Vector3 newpos, Vector3 oldpos, Vector3 newrot, Vector3 oldrot)
 {
     obj = o;
     NewPos = newpos;
     OldPos = oldpos;
     NewRot = newrot;
     OldRot = oldrot;
 }
 public OnObjectCreatedEventArgs(GameObject o)
 {
     obj = o;
 }
 internal static bool RemoveObject(GameObject v)
 {
     if (v == null) return false;
     if (OnObjectDestroyed != null) OnObjectDestroyed(null, new OnObjectCreatedEventArgs(v));
     lock (Objects)
     {
         for (int i = 0; i < Objects.Count(); i++)
         {
             if (Objects[i] == null) continue;
             if (Objects[i]== v) { Samp.Util.Log.Debug("Removing Object."); Objects[i] = null; return true; }
         }
     }
     return false;
 }
Example #4
0
 public static GameObject[] GetObjectsInArea(Vector3 wpos, float distance)
 {
     // todo: interior? virtulworld?
     List<GameObject> objs = new List<GameObject>();
     lock (GameObject.Objects)
     {
         for (int i = 0; i < GameObject.Objects.Length; i++)
         {
             if (GameObject.Objects[i] == null) continue;
             Vector3 opos = GameObject.Objects[i].Pos;
             Util.Log.Debug("objdist: " + wpos.Distance(opos));
             if (wpos.Distance(opos) > 20.0F) continue;
             objs.Add(GameObject.Objects[i]);
         }
     }
     GameObject[] retobjs = new GameObject[objs.Count()];
     for (int i=0;i<objs.Count();i++)
     {
         retobjs[i] = objs[i];
     }
     return retobjs;
 }
Example #5
0
 public static void DestroyObject(GameObject obj)
 {
     if (GameObject.RemoveObject(obj)) NativeFunctionRequestor.RequestFunctionWithArgs("DestroyObject", "i", obj.ID);
 }
Example #6
0
 public void AttachObject(GameObject obj,Vector3 offset, Vector3 rot)
 {
     NativeFunctionRequestor.RequestFunctionWithArgs("AttachObjectToPlayer", "iiffffff", obj.ID, ID, offset.X, offset.Y, offset.Z, rot.X, rot.Y, rot.Z);
 }