Vice City: Multiplayer

VC:MP Discussion => Bugs and Crashes => Support => Closed Bug Reports => Topic started by: NicusorN5 on Feb 24, 2017, 05:23 PM

Title: [BUG] vehicle.SetHandlingData()
Post by: NicusorN5 on Feb 24, 2017, 05:23 PM
Description
Function vehicle.SetHandlingData() is not working with custom vehicles .

Reproducible
Always

What you were doing when the bug happened
Using the X button to boost the car . Code :
function onKeyDown( player, key )
{
local vehicle = player.Vehicle;
if (key == x)
{
if (vehicle != null) {
local Nos = ReadIniInteger("NOS.ini","NOS",vehicle.ID.tostring());
        if (Nos == null) Nos = 0;
if (Nos > 0)
{
vehicle.SetHandlingData(14, vehicle.GetHandlingData(14) + 100.0);
vehicle.SetHandlingData(13,vehicle.GetHandlingData(13)+100);
vehicle.Lights = true
Nos--;
WriteIniInteger("NOS.ini","NOS",player.Vehicle.ID.tostring(),Nos);
}
else MessagePlayer("[#ff0000]You don't have any more NO2!",player);

}
}

What you think caused the bug
XML settings ?
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: MatheuS on Feb 25, 2017, 11:30 AM
Should be your code that is in trouble, here usually works this function in mod vehicles.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: NicusorN5 on Feb 25, 2017, 11:56 AM
100 % no idea what the hell I'm doing
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: KAKAN on Feb 25, 2017, 01:32 PM
ReadIniInteger("NOS.ini","NOS",vehicle.ID.tostring());
Um, sry, what?
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: MatheuS on Feb 25, 2017, 01:50 PM
Quote from: KAKAN on Feb 25, 2017, 01:32 PMReadIniInteger("NOS.ini","NOS",vehicle.ID.tostring());
Um, sry, what?

He's using .tostring() to save numbers. loooool

To save numbers you must use .tointeger() or .tofloat(). (Only use .tofloat for non-integer numbers. eg.: 0.5).

Replace these lines:
local Nos = ReadIniInteger("NOS.ini","NOS",vehicle.ID.tostring());// old linelocal Nos = ReadIniInteger("NOS.ini","NOS",vehicle.ID.tointeger());// new line
WriteIniInteger("NOS.ini","NOS",player.Vehicle.ID.tostring(),Nos); //old lineWriteIniInteger("NOS.ini","NOS",player.Vehicle.ID.tointeger(),Nos); // new line
Sorry for my English
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: KAKAN on Feb 25, 2017, 02:14 PM
And I don't think its a good idea to do that every freak'ng second. Depending on the file size, it may get terribly slow.... Instead, if you still love INI, take an array, store the data in it, and update/save it to the INI while the server closes. Load the data from the INI to the array when the server starts :) That'd be more efficient :D
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: NicusorN5 on Feb 25, 2017, 03:32 PM
Read it's freacking Read INI INT

it's return type it's int and its :  ReadIniInteger(string,string,string)
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: KAKAN on Feb 25, 2017, 05:41 PM
http://forum.vc-mp.org/?topic=117.0
he's using RelativeSpeed for some reason. Try that.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: PunkNoodle on Feb 26, 2017, 01:12 AM
Are you using an old server version? This bug was fixed in some of the server updates, make sure you got the latest server.exe.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: NicusorN5 on Feb 26, 2017, 06:42 AM
Lol , I'm using the lastest version , but still not working :( ...
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: Murdock on Feb 26, 2017, 07:11 PM
Haven't tested, but as far I know this bug is still listed in the list of bugs & suggestions (http://forum.vc-mp.org/?topic=1377.0)
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: PunkNoodle on Feb 27, 2017, 03:13 AM
@Murdock
Quote from: Stormeus on Jul 20, 2016, 05:19 AMAn update for VC:MP 0.4 (04rel004) servers has been released.
  • Added support for setting vehicle handling rules for custom vehicles. This functionality is complemented by a client update to implement this for clients.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: rww on Feb 27, 2017, 07:42 PM
Quote from: ...happymint_ on Feb 27, 2017, 03:13 AM@Murdock
Quote from: Stormeus on Jul 20, 2016, 05:19 AMAn update for VC:MP 0.4 (04rel004) servers has been released.
  • Added support for setting vehicle handling rules for custom vehicles. This functionality is complemented by a client update to implement this for clients.

But it doesn't work. I tested this on LCS-DM month ago.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: Murdock on Feb 27, 2017, 11:07 PM
Quote from: rww on Feb 27, 2017, 07:42 PMBut it doesn't work. I tested this on LCS-DM month ago.

Didn't see it work on DDRP either, that's probably why it's still on the bugs list
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: NicusorN5 on Mar 18, 2017, 03:33 PM
I used vehicle.RelativeSpeed *= 1.1 . Spamming X will make the car fly lol.

Any other solution?
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: NicusorN5 on May 28, 2017, 05:45 PM
*Bump*

This bug is annoying like hell.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: maxorator on May 28, 2017, 05:49 PM
Fix is in next update.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: Sebastian on May 28, 2017, 05:49 PM
<@maxorator> I'll debug that soon

EDIT: Great news ! Thanks !
Was it a client-side or a server-side problem ?
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: KAKAN on May 29, 2017, 07:50 AM
Quote from: sseebbyy on May 28, 2017, 05:49 PMWas it a client-side or a server-side problem ?
server-side.
Title: Re: [BUG] vehicle.SetHandlingData()
Post by: Stormeus on May 29, 2017, 08:43 AM
Quote from: KAKAN on May 29, 2017, 07:50 AM
Quote from: sseebbyy on May 28, 2017, 05:49 PMWas it a client-side or a server-side problem ?
server-side.

No, this was a client-side issue.