Retrieve car colors and direction? -
DJ_Shocker - 18.06.2014
Ok so I'm looking into creating some speed cameras and have some questions.
The way I'm wanting to do it is to have Law enforcement notified and formatted like this:
[CONTROL] All units be advised we have a speeding [car color/colors] [car name] in [location/area] traveling [direction: east/west/north/south]
is this possible and if so, how could one achieve the car colors/direction? I can do the car name and location.
Re: Retrieve car colors and direction? -
PrivatioBoni - 18.06.2014
Try this for car colour:
https://sampforum.blast.hk/showthread.php?tid=235398
Try this for direction:
https://sampwiki.blast.hk/wiki/GetVehicleZAngle
Re: Retrieve car colors and direction? -
DJ_Shocker - 18.06.2014
Quote:
Originally Posted by PrivatioBoni
|
I noticed at the bottom of the GetVehicleZAngle "GetPlayerFacingAngle" that could possibly work as well, correct?
Re: Retrieve car colors and direction? -
PrivatioBoni - 18.06.2014
I don't see why not, the player would still be facing a certain angle in a car, and there are no important notes of that nature on the wiki. I guess it's worth a shot, but I've never had a need for that particular function, or in fact anything to do with direction.
Re: Retrieve car colors and direction? -
DJ_Shocker - 19.06.2014
Ok so I've created an array that changes all color codes to their text name.
I've gotten a lot of this nearly done, but here's my issue with the colors:
(67531) : error 012: invalid function call, not a valid address
(67531) : warning 202: number of arguments does not match definition
(67531) : warning 202: number of arguments does not match definition
(67531) : warning 215: expression has no effect
(67531) : warning 215: expression has no effect
(67531) : error 001: expected token: ";", but found ")"
(67531) : fatal error 107: too many error messages on one line ( I hate this error lol it states the obvious! Ugh)
Anyways here's the segment:
pawn Код:
if(IsARadar(i) && AlreadyRadar[i] != 1 && SpeedCam == 1)
{
TextDrawShowForPlayer(i,flash);
SetTimerEx("RemoveFlash",CAMERA_FLASH_TIME,false,"i",i);
new zone[MAX_ZONE_NAME];
new idcar = GetPlayerVehicleID(i);
new Float:Angle;
new color1,color2;
color = VehicleColorNames(GetVehicleColor(idcar),color1,color2); //Line 67531
GetPlayer2DRadarZone(i, zone, sizeof(zone));
AlreadyRadar[i] = 1;
SetTimerEx("SetAlreadyRadar", 1000, 0, "i", i);
foreach(new n : Player)
{
if(ShowSpeedCam[n] == 1 && IsACop(n))
{
format(string, sizeof(string), "{39AACC}[CONTROL]: {FFFFFF}All units, we have reports of a speeding %s and %s %s in %s traveling %s",color1,color2,VehicleName[GetVehicleModel(idcar)], zone,GetDirection(GetPlayerFacingAngle(i,Angle));
SendTeamMessage(1, COLOR_ALLDEPT, string);
SendTeamMessage(2, COLOR_ALLDEPT, string);
SendTeamMessage(3, COLOR_ALLDEPT, string);
break;
}
}
}
What i'm trying to figure out how to do is make the statement like this: "[CONTROL]: All units, we have reports of a speeding blue and white Phoenix in Ganton traveling east."
I'm trying to figure out how to set the message to use color1 for the first color, and color2 for the second color. I know not ALL vehicles have 2 colors, I haven't gotten that far yet, but for some odd reason I cannot get this right. I've been fighting this all day.
Re : Retrieve car colors and direction? -
mirou123 - 19.06.2014
Change
Код:
VehicleColorNames(GetVehicleColor(idcar),color1,color2);
To
Код:
GetVehicleColor(idcar,color1,color2)
//Then to change IDs to names use this in your format()
VehicleColorNames[color1], VehicleColorNames[color2]