[FilterScript] Vehicle Velocity Control [Simple but effective]
#1

Hey there! As this would be my first filterscript posted, I thought about creating this in the simplest way I could think of. I have tested this filterscript and so far, no bugs have been found. If any are found, please do report it to me either through a PM or through replying in this thread.

Usage Instructions
  1. Enter a vehicle(any) as a driver
  2. Accelerate to desired speed
  3. If you have reached your speed, hold the FIRE KEY (Default: LALT) to maintain the speed
  4. Your speed will be maintained if and only if you are holding the FIRE KEY
  5. The Velocity Control will disengage if the car is unbalanced
Media and Photos
Vehicle Velocity Control Enabled when FIRE KEY is held



Vehicle Velocity Control Disabled when FIRE KEY is released



Vehicle Velocity Control Disabled when the vehicle is unbalanced/rammed



Vehicle Velocity Control Disabled when the HANDBRAKE key is held/pressed



Script Clarifications/Explanations
Though I tried my best to simplify this script, I guess there would be some who can't understand some contents of this filterscript

PHP Code:
// The key used to engage Velocity Control
#define startkey KEY_FIRE // Change to desired key (DEFAULT: LALT)
// The key used to manually disengage Velocity Control
#define endkey KEY_HANDBRAKE // Change to desired key (DEFAULT: SPACE) 
PHP Code:
//Variable to hold the player's desired maintained speed
new Float:PlayerSpeed[MAX_PLAYERS];
//Variable to hold the player's facing angle
new Float:PlayerAngle[MAX_PLAYERS]; 
PHP Code:
//If the startkey(KEY_FIRE) is held in the same time if the player is inside a vehicle and is the driver of that vehicle
if ((newkeys startkey) && !(oldkeys startkey) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER
PHP Code:
//If the startkey is released or if the player's speed is 0, in other words, if the velocity control is disengaged by other means (handbrake or unstable vehicle)
if (!(keys startkey) || PlayerSpeed[playerid] == 0.00 ||
//If the player leaves the vehicle or if the player slows down too much
GetPlayerState(playerid) != PLAYER_STATE_DRIVER ||    (speed 0.7 PlayerSpeed[playerid]) ||
//If the vehicle ascends from ground too much
|| 
//If the vehicle changes direction
(floatabs(angle heading) > 50 && floatabs(angle heading) < 310)) 
Credits and Conclusion
There goes my first filterscript. I do have a lot going on in my mind, so I guess I'll be posting more. I really wanted to post this filterscript a month ago, but I was too lazy to create a very long process of thread creation like this one. The credits are said in the script, but for insanity's sake, I'll just add them here

CREDITS:
  • mick88 - Got the idea from mick88, and I somewhat learned from his Cruise Control FS
  • NealPeteros - Created the whole script from basic scratch
  • SAMP Community - Providing the necessary needs for this filterscript(Self-explainable)
  • PAWN - Programming Language used for this filterscript(Self-explainable)
  • PAWNO - Provided program that is responsible for PAWN, and all contents of this filterscript(Self-explainable)
Download Access
Reply
#2

Good
Reply
#3

Very interesting and nice script. It's like "cruise control" on real cars, just made for SA-MP.

Nice job, although you could have made the text nicer by having a textdraw or something popping up instead
Reply
#4

Quote:
Originally Posted by denNorske
View Post
Very interesting and nice script. It's like "cruise control" on real cars, just made for SA-MP.

Nice job, although you could have made the text nicer by having a textdraw or something popping up instead
Quote:

[Simple but effective]

creating this in the simplest way

It's simply made in the simplest way possible with the simplest mind used for simple purposes.
Reply
#5

Great job!
Reply
#6

Everything looks copied from this:- https://pastebin.com/fYBZZGWe looks like you only changed the stock names.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)