SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Plugin Development (https://forum.sa-mp.com/forumdisplay.php?f=18)
-   -   [Plugin] CHandling - Server control of handlings & per-vehicle handlings (https://forum.sa-mp.com/showthread.php?t=663066)

dotSILENT 20/01/2019 09:01 PM

CHandling - Server control of handling.cfg & per-vehicle handlings
 
CHandling client & server plugin

CHandling is a client & server sided plugin which allows the server to have control over vehicle handlings. In addition, it modifies the default behaviour of GTA, allowing customized handlings between vehicles of the same model.
This means that you can have 10 Banshees while having each of them drive differently.

The client side is forced to use default handling values when connected to a CHandling-ready server.
Normal players can still play on the server, the plugin just wont have any effect on them.

Client sided plugin has a very simple update checker which can take the players to the download page of the latest release.

This is a test release, not everything is working as it should and some things may require a re-write.
I don't advice to introduce this to your players yet.


CURRENTLY SUPPORTS ONLY CARS! Boats, airplanes or bikes might not work properly, since they are handled differently in the game.

Supported versions
The plugin uses a .ini file for detecting the current version & loading proper memory offsets, the file is fetched from GitHub via libcurl when it doesn't exist, or when there is no matching version in the current file.
That means, that theorethically (unless some significant changes are made to SAMP), players wont need to download anything.

Currently supported versions (client): 0.3.7, 0.3.7 R2, 0.3.7 R3, 0.3.7 R3-1, 0.3.7 R4, 0.3DL R1

Download

Client side requires ASI Loader

Server side


Source code (client side)
Source code (server side)

WIKI (List of natives, descriptions etc)

Example filterscript which may also help testing/trying out



Thanks to
  • Zeex for sampGDK and SubHook
  • DK22Pac for his GTA plugin-sdk that I took some structs from
  • kurta999 for his AMX Native Redirect (taken from YSF)
  • Whitetiger for GetPacketId hook (taken from SAMPACv2)
  • ini for helping with various problems that occured along the way

dotSILENT 20/01/2019 09:25 PM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Known bugs
  • Some things such as various handling/model flags and suspension lines don't work for players that had the vehicle already streamed in unless it's re-streamed for them

HNIC 20/01/2019 10:15 PM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Been looking for something like this, great job!

Whitetiger 21/01/2019 12:41 AM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Great release man, i wonder if you could do something similar but for weapon.dat?

dotSILENT 21/01/2019 01:30 AM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
It's possible, I see that MTA did it but as far as I can see it's global, which makes sense. So one modification of weapon property is applied for every player.
I'm not sure about syncing the shoots then, don't know how samp does it under the hood but it probably wouldn't require any changing.

This plugin could evolve into some kind of all-in-one SAMP extension, but for that someone else would need to take it over. I don't have that much time, and I'm not the best at writing clean code when most of the things are experimental memory hacks.
IIRC wheel scaling could be easily added to this plugin as an additional handling option, it could make for some nice rim size modifications etc.
My main idea when creating this plugin was to create some sort of NFS-like upgrade packs for vehicles. You don't neccessarily need to set raw values. You can modify the existing ones, altering the handling.
In example, you can lower the mass by a percentage value and lower the drag multiplier, making the car go faster:
Code:

new Float:val;
GetVehicleHandling(vehicleid, HANDL_FMASS, val);
SetVehicleHandling(vehicleid, HANDL_FMASS, val*0.9); // 90% of previous mass
GetVehicleHandling(vehicleid, HANDL_FTURNMASS, val);
SetVehicleHandling(vehicleid, HANDL_FTURNMASS, val*0.9);
GetVehicleHandling(vehicleid, HANDL_FDRAGMULTIPLIER, val);
SetVehicleHandling(vehicleid, HANDL_FDRAGMULTIPLIER, val*0.9);

It's worth noting that subsequent calls to SetVehicleHandling wont create additional packets, since the modifications are all sent in a single packet at the next ProcessTick.

SyS 21/01/2019 01:36 AM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Nice :)

RogueDrifter 21/01/2019 03:57 AM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Good job, i was going to look at it as something good for stopping people who mess around with vehicle's original handling after reading "The client side is forced to use default handling values when connected to a CHandling-ready server." But then again it requires the asi loader file on the client side which not many would download. Thanks for your efforts tho!

Nathan94 21/01/2019 02:00 PM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
I'm using the testing filterscript and I keep getting "Failed to set handling value, check if it's correct". Can someone help?

dotSILENT 21/01/2019 02:28 PM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Make sure you input float values with a dot and not a period (0.1 etc)
Also, there are value-correctness checks, you can see the proper value ranges here: Handling attributes

Some attribites such as the anim group cannot be set.

Nathan94 21/01/2019 02:44 PM

Re: CHandling - Server control of handlings & per-vehicle handlings
 
Quote:

Originally Posted by dotSILENT (Post 4078248)
Make sure you input float values with a dot and not a period (0.1 etc)
Also, there are value-correctness checks, you can see the proper value ranges here: Handling attributes

Some attribites such as the anim group cannot be set.

I am inputting everything correctly and yet it doesn't work. And yes, I am taking in mind the value-correctness checks, already read through the whole wiki on github.

Here's a pic of what I'm inputting:
https://ibb.co/q9WgfwN

Edit: forgot to mention in case you ask, I am trying to change the engine acceleration flag.


All times are GMT. The time now is 09:30 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.