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!

Matias

So, you want us to script and waste a key shortcut just because you suck driving down the hills? No bro, learn to use the brakes first. Convoy Trucking won't waste all the key shortcuts in this kind of stuff which can be easily evaded by pressing spacebar while going downhills.

Avenger

I actually tried to loop from timers but i failed -_-
anyways even with hand break sometimes you hit something which causes you to fly lol...

Matias

Quote from: Avenger on August 27, 2013, 20:25
I actually tried to loop from timers but i failed -_-
anyways even with hand break sometimes you hit something which causes you to fly lol...

Can i ask you at which downhills are you driving? I dont know any hill that drives you right into water. And if you press handbrake and you fly then remove your mods because they are getting glitched and causing you to fly.

Dobby

Quote from: Avenger on August 27, 2013, 20:25
I actually tried to loop from timers but i failed -_-
anyways even with hand break sometimes you hit something which causes you to fly lol...

Whats the loop for? :o you just gotta set it to repeating and it should loop no problem each interval.
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!

Avenger

now that im flying, it's just sometime i click gang break and loose control like right now in the server i flipped because i lost control goin 100 mph-_-
anyways the loop/repeat whatever..
and i don't have any mods...

Hobo

I don't get it. Do you mean "Engine brake"? Because I don't think you need to script in a break for engines. Just tell people not to drive them for a bit.

Brake for moose or else you'll break your car.


[tr]
[td]

[/td]
[td][/td]
[td]

[shadow=black,left]My PC Specs:
-AMD Ryzen 7 2700X
-EVGA RTX 3080
-ASUS Prime X470-Pro Motherboard
-CORSAIR Vengeance RGB PRO 32GB RAM
-ADATA SX8200 NVME SSD 960GB
-Seagate IronWolf Pro 8TB HDD
-Western Digital Blue 2TB HDD
-ADATA Ultimate SU800 2TB SDD x2
-ADATA Ultimate SU800 1TB SSD x2
-Corsair HX750 Professional PSU
-NZXT H440 white/black case
[/shadow]
[/td]
[/tr]
[/table]

Rubber

Quote from: Hobo on August 27, 2013, 21:09
I don't get it. Do you mean "Engine brake"? Because I don't think you need to script in a break for engines. Just tell people not to drive them for a bit.

Brake for moose or else you'll break your car.

Engine brake is used to slow down the engine, which slows down the vehicle.

Dobby

Quote from: Rubber on August 27, 2013, 21:57
Quote from: Hobo on August 27, 2013, 21:09
I don't get it. Do you mean "Engine brake"? Because I don't think you need to script in a break for engines. Just tell people not to drive them for a bit.
Brake for moose or else you'll break your car.
Engine brake is used to slow down the engine, which slows down the vehicle.

Which is what brake and handbrake are for :)
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!

Hobo

Quote from: Dobby. on August 27, 2013, 22:05
Quote from: Rubber on August 27, 2013, 21:57
Quote from: Hobo on August 27, 2013, 21:09
I don't get it. Do you mean "Engine brake"? Because I don't think you need to script in a break for engines. Just tell people not to drive them for a bit.
Brake for moose or else you'll break your car.
Engine brake is used to slow down the engine, which slows down the vehicle.

Which is what brake and handbrake are for :)
Yes, I'm aware of that but as you can see in the topic title he wrote "Engine BREAK" which makes no sense.

Also, an extra brake is not needed (if that's what you're suggesting).


[tr]
[td]

[/td]
[td][/td]
[td]

[shadow=black,left]My PC Specs:
-AMD Ryzen 7 2700X
-EVGA RTX 3080
-ASUS Prime X470-Pro Motherboard
-CORSAIR Vengeance RGB PRO 32GB RAM
-ADATA SX8200 NVME SSD 960GB
-Seagate IronWolf Pro 8TB HDD
-Western Digital Blue 2TB HDD
-ADATA Ultimate SU800 2TB SDD x2
-ADATA Ultimate SU800 1TB SSD x2
-Corsair HX750 Professional PSU
-NZXT H440 white/black case
[/shadow]
[/td]
[/tr]
[/table]

Dobby

Quote from: Foose on August 27, 2013, 19:57
So, you want us to script and waste a key shortcut just because you suck driving down the hills? No bro, learn to use the brakes first. Convoy Trucking won't waste all the key shortcuts in this kind of stuff which can be easily evaded by pressing spacebar while going downhills.

This.

+Locked. 
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!