11.07.2012, 19:13
kSpeedo
Karagon's Speedometer System - Version 1.0Features:
-4 Part Speedometer Filterscript
-Displays Vehicle name, fuel level, damage level, and speed (KM/H)
-Fuel Level and damage level changes colors in relation to the level of that value. (Green -> Yellow -> Red)
-Changeable settings found at the top of the script (Some are recommended not to be changed, but you can change them at your own risk)
How to install:
1) Download the package at the end of this post.
2) Change the definition of MAX_PLAYERS at the top of the script. The default I have set is 200. If you require more players in your server, change it. If you require less, change it.
3) Compile the script.
4) Put it in your Filterscripts directory in your server directory.
5) Add it to server.cfg as "filterscripts kSpeedo" if you want it loaded when the server starts, or, load it via RCON commands in the game (/rcon login first, then /rcon loadfs kSpeedo)
6) Enter a vehicle and enjoy.
Definition Explanation
The following defines are in the script for your use:
Код:
//This is stuff that you can change. #define DEF_GAS (100) //Default gas level for the vehicles in the server when the filterscript is loaded. (DEFAULT: 100) #define DISTANCE (250) //Distance in which FUEL_INCREMENT will be removed from the fuel (DEFAULT: 250) #define FUEL_INCREMENT (1) //The value that will be removed from the fuel when DISTANCE is met. (DEFAULT: 1) #define TEXT_DRAW_FONT (2) //Font for the text draw. It's recomended that you not change this. (DEFAULT: 2) #define TEXT_DRAW_X_FACTOR (0.4) // Font size X factor (DEFAULT: 0.4) (RECOMENDED NOT TO CHANGE) #define TEXT_DRAW_Y_FACTOR (0.8) // Font size Y factor (DEFAULT: 0.8) (RECOMENDED NOT TO CHANGE) #define EXIT_VEHICLE_ON_NO_GAS (true) // If the player should exit the vehicle when the fuel is 0, set this true. #define WARNING (20) // Number at which to send a warning to the player. (DEFAULT: 20) #define WARNING_LIMIT (10000) // Time to wait before sending another message about low fuel. (DEFAULT: 10000)
-DISTANCE is the distance in which the FUEL_INCREMENT will be subtracted from the car's fuel level.
-TEXT_DRAW_FONT is the font for the text draw. It's not recommended to change this unless you want to redo the TEXT_DRAW_X_FACTOR and TEXT_DRAW_Y_FACTOR
-EXIT_VEHICLE_ON_NO_GAS is the definition that controls if the player will be forced out of the vehicle when the fuel level is at 0 or less than 0. True if you want it to, false if not. You can edit the part of the script when this is used.
-WARNING is the gas level in which a warning will be given to the player.
-WARNING_LIMIT determines how often a message will be sent to the user. I find 10,000 to be decent, non-spammy.
Notes
-This uses OnPlayerUpdate for the speedometer. I know some people do not like it to be used this way, but wish such a small amount of code, I've decided to use this. But, if you experience some lag issues, change it to a 1 to a 1.5 (maybe 2 second) timer for the server. I won't help with this, as this is how I am releasing it. How I release it is how I'll leave it. Don't contact me to help you change any thing to the script.
-The stock functions, and public functions, if changed, I am not responsible for it. It's your mistake if you mess it up, so make sure you know what you're doing when you mess with it.
-It is recommended that you load this into your main GM, IF you have an admin command for players to spawn vehicles, or vehicles spawn in the GM. (If you don't, the fuel will be 0 for all vehicles that spawn)
-Leave the command text in the script. This is for credits. Don't remove them if you use the script. (Thanks )
-Feel free to play with the display, but leave the credits.
-YOU make the gas stations.
Credits:
-Karagon for the script.
Disclaimer
This is an original idea. You may see similar speedometers in the SA-MP world, and this is a 100% original work by me. I originally made it for a server I was creating, but after a few things, I've decided not to open that server, so I'm releasing a few things I made for it. (This may be the only one for right now related to this script). Work on this started about a week ago.
Pictures:
One
Two
Three
Four
Five
Downloads
Dropbox Link
*Note: By Downloading, you agree to keep my name in the credits, and not to re-upload it, and that you will not consider it yours in any way.
No mirrors, please.