multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 425 forks source link

Vehicle damage by crashing depends on FPS #2956

Open PlatinMTA opened 1 year ago

PlatinMTA commented 1 year ago

Describe the bug

The more FPS you have, the less damage dealt. Physics play a factor here, #929 is related.

Steps to reproduce

test_fps_vehicle_crash.zip 1) Download and start that resource. 2) Go to x,y,z: /sp -2523 -616 133 3) Use /fps to set your desired FPS 4) Use /launch to launch the vehicle to the wall 5) Use /resetveh to reset the vehicle position

You will see that higher FPS will make the vehicle have less damage while crashing. 25FPS will dealt arround 148HP of damage, while 144FPS will do 124HP dmg. 24HP points of damage is not THAT noticeable, but it's a unfair advantage.

Version

Any.

Additional context

This only happens for crashing, bullet damage is constant and is related to damage value on the weapon property (30 damage = 30 HP lost). Just to consider, the damage dealt to other players/peds is arround 1/3 of that.

Relevant log output

No response

Security Policy

ItsHamidMustafa commented 1 year ago

I'm a new dev, idk things that much but ig if we can add extra damage to the vehicle [On high FPS], the problem can be solved.. public OnVehicleDeath(vehicleid, killerid, weaponid) { new Float:fps = GetTickCount() / 1000.0; if(fps > 60.0) // If FPS is higher than 60 { SetVehicleHealth(vehicleid, 0.0); // Deal maximum damage } else { // Normal vehicle death handling // ... } return 1; }

You can add damage, somehow like

{
    new Float:fps = GetPlayerFPS(killerid);
    if(fps > 60.0)
    {
        new Float:health = GetVehicleHealth(vehicleid);
        SetVehicleHealth(vehicleid, health - 24.0);
    }
}