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 ?
Should be your code that is in trouble, here usually works this function in mod vehicles.
100 % no idea what the hell I'm doing
ReadIniInteger("NOS.ini","NOS",vehicle.ID.tostring());
Um, sry, what?
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 line
local Nos = ReadIniInteger("NOS.ini","NOS",vehicle.ID.tointeger());// new line
WriteIniInteger("NOS.ini","NOS",player.Vehicle.ID.tostring(),Nos); //old line
WriteIniInteger("NOS.ini","NOS",player.Vehicle.ID.tointeger(),Nos); // new line
Sorry for my English
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
Read it's freacking Read INI INT
it's return type it's int and its : ReadIniInteger(string,string,string)
http://forum.vc-mp.org/?topic=117.0
he's using RelativeSpeed for some reason. Try that.
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.
Lol , I'm using the lastest version , but still not working :( ...
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)
@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.
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.
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
I used vehicle.RelativeSpeed *= 1.1 . Spamming X will make the car fly lol.
Any other solution?
*Bump*
This bug is annoying like hell.
Fix is in next update.
<
@maxorator> I'll debug that soon
EDIT: Great news ! Thanks !
Was it a client-side or a server-side problem ?
Quote from: sseebbyy on May 28, 2017, 05:49 PMWas it a client-side or a server-side problem ?
server-side.
Quote from: KAKAN on May 29, 2017, 07:50 AMQuote 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.