Vice City: Multiplayer

VC:MP Discussion => Bugs and Crashes => Support => Closed Bug Reports => Topic started by: karan20000000000 on Apr 17, 2015, 03:17 PM

Title: [Event bugged] onObjectShot()
Post by: karan20000000000 on Apr 17, 2015, 03:17 PM
This event seems to be giving wrong information as well as useless errors.
For example i created three objects and enabled their TrackingShots in a test script with the model and id as follows:
440, ID: 0
440, ID: 1
440, ID: 2
And onObjectShot event as follows:
function onObjectShot(player,object,weapon)
{
  print(object.Model+",.. ID: "+object.ID);
}
And then this was the output:
AN ERROR HAS OCCURED [Member Variable not found]
CALLSTACK
*FUNCTION [onObjectShot()] testing.nut line [142]
LOCALS
[weapon] 17
[object] INSTANCE
[player] INSTANCE
[this] TABLE


After this i changed the code in the event a bit as follows:
function onObjectShot(player,obje,weapon)
{
  local object = FindObject(obje.ID);
  print(object.Model+",.. ID: "+object.ID);
}

This time there were no errors in console but every time I shot any object, the model id and the ID of the  first object was being printed in console and the model id and ID of that new object was not being printed.
Output when I created objects:
[SCRIPT]  440, ID: 0
[SCRIPT]  450, ID: 1
[SCRIPT]  460, ID: 2

Output when I shot the objects:
[SCRIPT]  440,.. ID: 0
[SCRIPT]  440,.. ID: 0
[SCRIPT]  440,.. ID: 0
Title: Re: [Event bugged] onObjectShot()
Post by: Gudio on Apr 17, 2015, 08:13 PM
Correct parameters: object, player, weapon.
Please follow wiki (http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Events) next time.
Not a bug.
Title: Re: [Event bugged] onObjectShot()
Post by: Stormeus on Apr 17, 2015, 08:54 PM
Closed.