Object Thingy, but no error.

Started by FarisDon, Jan 29, 2016, 07:06 AM

Previous topic - Next topic

FarisDon

function onObjectShot(object,player,weapon)
{
if ( object.Model == 2546)
{
 Message("BLA");
}
}
Hi, Folks, as you can see the Code, i've tried my best to fix it, but i was unable to, and i wasn't getting any error as well, just shooting it, and tried different method of making this code, but it also doesn't show me any message "BLA"
So, i'm actually confused, Why? If their isn't any error than why the code isn't working?
P.S: sorry, for my bad English.

DizzasTeR

#1
When you create objects you must manually set if the object should track shots/bumps or not.
local myObject  = CreateObject(... )
myObject.TrackingShots = true;


Now if you use that callback it should work.

Edit: More info http://forum.vc-mp.org/?topic=403.msg2591#msg2591

FarisDon

#2
Quote from: Doom_Kill3R on Jan 29, 2016, 07:16 AMWhen you create objects you must manually set if the object should track shots/bumps or not.
local myObject  = CreateObject(... )
myObject.TrackingShots = true;

Now if you use that callback it should work.

Edit: More info http://forum.vc-mp.org/?topic=403.msg2591#msg2591
Well, I really appreciate your help! but i've one problem, or a question you can say, Do, I always have to make arrays like this  local myObject  <-  CreateObject(... ) this to enable Tracking shots? cause i've many Objects without this array, and i've tried to enable them without making this kinda array to them function onObjectShot(object,player,weapon)
{
object.TrackingShots = true;
if ( object.ID == 5) Message("BLA");
}
as you can see, and it doesn't worked! so is their any other way except making those array ( =, <-) stuff to make these work?
Edit: - Anyway thanks :) Topic Locked