Jump to content

How would I get the actual name of the primary color of a vehicle?


OJS

Recommended Posts

Okay, so I have been trying to get the primary color of the suspects vehicle for a little over 3 days so far. The farthest I got was getting the HEX Code of the color, but not the actual name which is what I need. When I tried to translate the HEX Code with the ColorTranslator in C# it keeps crashing LSPDFR claiming the data provided is not the correct type. I could really use some help with trying to get the actual name of the color. You know like whether or not it is red, blue, green, yellow, etc. Because I am 100% certain no one is going to understand the notification statement if it says something like: 

Quote

Respond Code 3! The vehicle is a #FCBA03 Bison with License Plate Number: 00ADF854.

Or something like that. Now you're probably wondering what have I tried?

 

Well at first I was thinking it would be as simple as creating a var that is like this:

var vColor = SuspectVehicle.PrimaryColor;

And just including vColor.ToString() into the notification, but that just gives me:

Quote

Respond Code3! The vehicle is a Color [A=255, R=8, G=8, B=8] EMPEROR with license plate number 46EEK572.

Which is definitely not helpful at all. Then I tried using the ColorTranslator with the FromHTML() method using the PrimaryColor.Name and at one point for some reason I only got the number 0 returned in the notification. Please help.

Link to comment
Share on other sites

22 hours ago, TheMaybeast said:

Not sure what solution other developers utilize, but I personally use this solution by LMS: https://github.com/LMSDev/LSPDFR-API/blob/master/Extensions/VehicleExtension/VehicleExtension.cs

I'm not entirely sure how to use this, could you explain a bit about what this script is doing? I noticed the "VehicleColor GetColors(this vehicle v)" method, but I am not sure how to incorporate this into my callouts. 

Link to comment
Share on other sites

i use this

(issueVehicle.PrimaryColor.ToKnownColor().ToString() == "0" ? "" : issueVehicle.PrimaryColor.ToKnownColor().ToString())

there is not always a known color

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...