Quantcast
Channel: SA-MP Forums - Filterscripts
Viewing all articles
Browse latest Browse all 595

[FilterScript] Vehicle Velocity Control [Simple but effective]

$
0
0
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

Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>