SA-MP Forums Archive
[FilterScript] Simple Vehicle Speedometer/Health/Vehicle Name - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Simple Vehicle Speedometer/Health/Vehicle Name (/showthread.php?tid=589767)

Pages: 1 2


Simple Vehicle Speedometer/Health/Vehicle Name + Vehicle Menu(New!) - FreAkeD - 22.09.2015

Introduction

This is a simple FilterScript where it will display your vehicles statistics on the bottom of your screen in a textdraw. Version 2 now includes a vehicle menu. You can find whats new below.


Features

Version 1 Version 2 Pictures

Version 1
Version 2


Download

Github


Bugs

None currently.

If you have any suggestions please let me know down below !


Re: Simple Vehicle Speedometer/Health/Vehicle Name - SecretBoss - 22.09.2015

Nice textdraws


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 22.09.2015

Quote:
Originally Posted by SecretBoss
View Post
Nice textdraws
Thank you !


Re: Simple Vehicle Speedometer/Health/Vehicle Name - MrCreed - 22.09.2015

Good filterscript, thanks for sharing it.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 22.09.2015

Quote:
Originally Posted by MrCreed
View Post
Good filterscript, thanks for sharing it.
Cheers! No problem.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - Pottus - 22.09.2015

1.) You are using the the wrong type of textdraws. (Use player textdraws)
2.) You don't even destroy textdraws so this would eventually hit textdraw limit.
3.) Incorrect calculation for vehicle speed.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 23.09.2015

Quote:
Originally Posted by Pottus
View Post
1.) You are using the the wrong type of textdraws. (Use player textdraws)
2.) You don't even destroy textdraws so this would eventually hit textdraw limit.
3.) Incorrect calculation for vehicle speed.
Cheers for the heads up, I've fixed them.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - Pottus - 23.09.2015

Okay another problem is you don't loop through all the players in OnFilterScriptInit() and create the textdraws for any connected players. Another problem is you also don't delete any textdraws in OnFilterScriptExit().


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 27.09.2015

Updated to Version 2. A new 'Vehicle Menu' has been added!

Version 2:


Re: Simple Vehicle Speedometer/Health/Vehicle Name - Edw - 27.09.2015

Nice.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 27.09.2015

Quote:
Originally Posted by Edw
Посмотреть сообщение
Nice.
Thank you


Re: Simple Vehicle Speedometer/Health/Vehicle Name - Bolex_ - 27.09.2015

Pretty Nice


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 27.09.2015

Quote:
Originally Posted by Scripter18
Посмотреть сообщение
Pretty Nice
Thanks alot!


Re: Simple Vehicle Speedometer/Health/Vehicle Name - dan40o - 27.09.2015

There is a problem with the Health. When i crash the car still shows 100.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 27.09.2015

Quote:
Originally Posted by dan40o
Посмотреть сообщение
There is a problem with the Health. When i crash the car still shows 100.
Are you sure? I just tested it and everytime I crashed into an object the health always went down.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - dan40o - 27.09.2015

yes I am sure i'll post a picture wait a sec.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - dan40o - 27.09.2015

Look


Re: Simple Vehicle Speedometer/Health/Vehicle Name - FreAkeD - 27.09.2015

Quote:
Originally Posted by dan40o
Посмотреть сообщение
Look
Honestly, I'm not too sure. It has to be something related to your script probably? Because it works find for me.


Re: Simple Vehicle Speedometer/Health/Vehicle Name - dan40o - 27.09.2015

Fixed it. I removed the loop under OnPlayerUpdate
Код:
public OnPlayerUpdate(playerid)
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		new vspeed[25];
		format(vspeed, sizeof(vspeed), "Speed: ~y~%d ~g~KM/H", GetVehicleSpeed(playerid));
		PlayerTextDrawSetString(playerid, VehicleSpeed[playerid], vspeed);
		
		new vhealthtd[32], Float:vHealth;
		GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
		new Float:percentage = (((vHealth - 250.0) / (1000.0 - 250.0)) * 100.0);
		
		format(vhealthtd, sizeof(vhealthtd), "Vehicle Health: ~g~%.0f%", percentage);
		PlayerTextDrawSetString(playerid, VehicleHealth[playerid], vhealthtd);
	}
	return 1;
}



Re: Simple Vehicle Speedometer/Health/Vehicle Name - ahameed4755 - 27.09.2015

NICE!