FOR THE SERVER(Engine Break)

Started by Avenger, August 27, 2013, 09:27

Avenger

Well i actually really want this to be in the server, seeing how trucks have this in real life aswell...
Well it's an engine break slows down the vehicle SLOWLY ...
anyways here it is i will explain


public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE))
    {
        if(IsPlayerInAnyVehicle(playerid)) SlowDownVehicle(playerid);
    }
    return 1;
}



stock SlowDownVehicle(playerid)
{
     new Float:vx,Float:vy,Float:vz;
     GetVehicleVelocity(GetPlayerVehicleID(playerid),vx,vy,vz);
     SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * 0.9, vy *0.9, vz * 0.9);
     return 1;
}


0.8 slowed down the vehicle kinda to fast but 0.9 it just at the spot :D

Well here you have it,
This code has been tested and work really great it took me a while to get it working but i did it :D well i REALLY hope this code will be accepted to the server i would love to use this when going downhill with a truck instead of braking :D plus will make server a little more realistic.

thank you for reading :D

BTW:
if you put ear phones on you can actually hear it slowing down :D

Tyler

If you'd like this in the server, post it in suggestions.


[23:19:46] (CB:16) Fish: thats going in my sig

Avenger


Tyler



[23:19:46] (CB:16) Fish: thats going in my sig

Avenger

can you move the thread?
i don't wanna make another thread, might be spam...

Avenger

ok so i have updated the script, apparently that code had a really bad bug on it where when u press accelerate it just stops, so i remade it.

Spekter

Quote from: Avenger on August 27, 2013, 09:50
can you move the thread?
i don't wanna make another thread, might be spam...


Done.




Ethan

server already has something similar to this with the damage system... you get your vehicle to 'poor' state with enough damage/wreckless driving and your vehicle will move very slowly... its not needed

Spekter

Quote from: Ethan on August 27, 2013, 14:36
server already has something similar to this with the damage system... you get your vehicle to 'poor' state with enough damage/wreckless driving and your vehicle will move very slowly... its not needed


Uhm.. i'm pretty sure it was like that in the past, before Mick added the engine stalling if the vehicle is in poor condition. Now there is no speed difference if the vehicle is poor, just the chance of random stalling.




Ethan

everytime i get a vehicle in less than fair condition I have never gotten up to full speed as if it was perfect

Spekter

Quote from: Ethan on August 27, 2013, 14:57
everytime i get a vehicle in less than fair condition I have never gotten up to full speed as if it was perfect


Perhaps you should test your theory again.




Rubber

Quote from: Sveki on August 27, 2013, 15:45
Quote from: Ethan on August 27, 2013, 14:57
everytime i get a vehicle in less than fair condition I have never gotten up to full speed as if it was perfect


Perhaps you should test your theory again.

Sveki is correct. Speed does not decrease with damage. But at poor it has the potential to quit.

On topic: Avenger and I were talking in game and he thought of this. I told him to apply for scripter because he seems like he knows his stuff. He put a lot of time into this unlike most people who suggest things. He even wrote the code for it! Not many suggestions include the script for it. This suggestion is not for the damage system, it is to replicate engine breaking (you know...like on real trucks). Look up some youtube videos if you dont understand the situation. I support this because engine breaking is for cool kids  8)

Ethan

well i meant this suggestion was similar to the damage system, not anyway related to.. seems interesting at the least

Avenger

Well as rubber said, yes, but sometime when im going fast downhill and i break and loose control of the truck and have to fail a mission because my trailer falls in the water  :-\ so this would be good to slow down the vehicle, and i would make it so you just click and hold FIRE_KEY but i couldn't get a timer that loops :/

Dobby

Quote from: Avenger on August 27, 2013, 19:52
Well as rubber said, yes, but sometime when im going fast downhill and i break and loose control of the truck and have to fail a mission because my trailer falls in the water  :-\ so this would be good to slow down the vehicle, and i would make it so you just click and hold FIRE_KEY but i couldn't get a timer that loops :/

Go learn about timers :)

If you're sometimes going fast downhill you should use the break key. Or handbreak and maybe you won't end up going in the water. I mean 70mph? you can't control it?  ::)
Quote from: mick88 on May 24, 2015, 21:39
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!