01.02.2014, 00:43
Hello Guys ,i've a problem with SpeedCam Sys. If i went by car with 70 MPH in 60 MPH I dont get a ticket ,i dont know what is the problem with it,can someone help me with it please ?
pawn Код:
#define MAX_SPEEDCAMS 23
enum SpeedCam
{
Float:SCamX,
Float:SCamY,
Float:SCamZ,
CamSpeed,
CamObject,
}
new SpeedCams[MAX_SPEEDCAMS][SpeedCam]=
{
//{X,Y,Z,Speed}
{2105.19, -1747.12, 18.37, 60},
{2295.02, -1741.30, 23.95, 60},
{2419.73, -1942.81, 19.31, 60},
{2909.44, -1572.65, 18.12, 90},
{2733.78, -196.80, 28.64, 90},
{2095.47, 314.76, 32.94, 90},
{630.34, 316.65, 18.38, 90},
{245.87, -1018.69, 55.17, 90},
{393.77, -1710.17, 15.67, 90},
{1054.00, -1860.62, 11.75, 90},
{1816.04, -1601.60, 17.44, 70},
{1667.12, -972.22, 36.02, 90},
{1671.59, -323.60, 41.99, 90},
{-1563.53, -2790.53, 46.37, 90},
{-791.0155, 477.4234, 27.4725, 60},
{1577.13,843.12,5.70,90},
{2396.20,2622.97,7.52,90},
{2081.86,963.24,16.42,90},
{2032.37,983.38,16.73,90},
{-1363.32,1738.22,27.22,90},
{-620.03,2745.99,60.41,90},
{2520.26,2406.45,10.58,60},
{2232.60,2402.86,14.49,60}
};
pawn Код:
for(new c=0; c<MAX_SPEEDCAMS; c++) {
new textlabel[50];
CreateDynamicObject(SpeedCams[c][CamObject], SpeedCams[c][SCamX], SpeedCams[c][SCamY], SpeedCams[c][SCamZ], 0.0, 0.0, 10.0);
format(textlabel, sizeof(textlabel), "Speed Limit\n%d MPH", SpeedCams[c][CamSpeed]);
CreateDynamic3DTextLabel(textlabel,COLOR_YELLOW,SpeedCams[c][SCamX], SpeedCams[c][SCamY], SpeedCams[c][SCamZ],25.0);//
}
pawn Код:
ptask SpeedCameraCheck[500](playerid)
{
new carid = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pAdmin] >=2 || IsACopCar(carid) || IsAnLVMPDCar(carid) || IsAnMPSCar(carid) || IsAFBICar(carid) || IsAnAmbulance(carid) || IsAnCHPCar(carid) || IsAnSASDCar(carid) || IsAnDOCCar(carid)
|| IsAPersonalCopCar(carid) || GetPlayerColor(playerid) == COLOR_VIP) {
return 1;
}
if(PlayerInfo[playerid][pReceivedSpeedTicket] >= 1) {
PlayerInfo[playerid][pReceivedSpeedTicket] --;
}
for(new c=0; c<MAX_SPEEDCAMS; c++) {
if(IsPlayerInRangeOfPoint(playerid, 15, SpeedCams[c][SCamX], SpeedCams[c][SCamY], SpeedCams[c][SCamZ]) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
new veh = GetPlayerVehicleID(playerid);
new Float:Speed = GetVehicleSpeed(veh, 0);
if(GetVehicleModel(veh) == 414 || GetVehicleModel(veh) == 456)
{
if(floatround(Speed/1.609) > 50)
{
if(PlayerInfo[playerid][pReceivedSpeedTicket] == 0) {
new string[128];
new SpeedPrice = 1500;
format(string,sizeof(string)," ** You were caught doing over 55 MPH in a Box Truck. Your were issued a ticket for $%d.",SpeedPrice);
SendClientMessageEx(playerid,COLOR_YELLOW,string);
if(PlayerInfo[playerid][pCarLic] == 1 && PlayerInfo[playerid][pCarLicP] > 1) {
PlayerInfo[playerid][pCarLicP] -= 1;
format(string,sizeof(string)," * You also received 1 point off your license. You have %d points remaining.",PlayerInfo[playerid][pCarLicP]);
SendClientMessageEx(playerid,COLOR_YELLOW,string);
}
else {
PlayerInfo[playerid][pCarLicP] =0;
PlayerInfo[playerid][pCarLic] =0;
SendClientMessageEx(playerid, COLOR_RED, " * Your drivers license has been revoked as you lost 5 points from your license. You must go get a new one at City Hall.");
}
format(string,sizeof(string)," * You must pay off this or any tickets at the DMV using /paytickets at the terminal inside.");
SendClientMessageEx(playerid,COLOR_LIGHTBLUE,string);
PlayerInfo[playerid][pSpeedTix] += SpeedPrice;
PlayerInfo[playerid][pReceivedSpeedTicket] = 10;
if(PlayerTruckJob[playerid][pTDActive] == 1)
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessageEx(playerid, COLOR_YELLOW, " * You have been caught speeding while on a Trucking Delivery, it has been recorded.");
PlayerTruckJob[playerid][pTDSpeeding] ++;
}
}
}
}
}
if(floatround(Speed/1.609) > SpeedCams[c][CamSpeed]) {
if(PlayerInfo[playerid][pReceivedSpeedTicket] == 0) {
new string[128];
new SpeedPrice = (floatround(Speed/1.609)-SpeedCams[c][CamSpeed])+800;
format(string,sizeof(string)," ** You were caught doing %dMPH in a %dMPH zone. Your were issued a ticket for $%d.",floatround(Speed/1.609),SpeedCams[c][CamSpeed],SpeedPrice);
SendClientMessageEx(playerid,COLOR_YELLOW,string);
if(PlayerInfo[playerid][pCarLic] == 1 && PlayerInfo[playerid][pCarLicP] > 1) {
PlayerInfo[playerid][pCarLicP] -= 1;
format(string,sizeof(string)," * You also received 1 point off your license. You have %d points remaining.",PlayerInfo[playerid][pCarLicP]);
SendClientMessageEx(playerid,COLOR_YELLOW,string);
}
else {
PlayerInfo[playerid][pCarLicP] =0;
PlayerInfo[playerid][pCarLic] =0;
SendClientMessageEx(playerid, COLOR_RED, " * Your drivers license has been revoked as you lost 5 points from your license. You must go get a new one at City Hall.");
}
format(string,sizeof(string)," * You must pay off this or any tickets at the DMV using /paytickets at the terminal inside.");
SendClientMessageEx(playerid,COLOR_LIGHTBLUE,string);
PlayerInfo[playerid][pSpeedTix] += SpeedPrice;
PlayerInfo[playerid][pReceivedSpeedTicket] = 10;
if(PlayerTruckJob[playerid][pTDActive] == 1)
{
if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
SendClientMessageEx(playerid, COLOR_YELLOW, " * You have been caught speeding while on a Trucking Delivery, it has been recorded.");
PlayerTruckJob[playerid][pTDSpeeding] ++;
}
}
}
}
}
}
return 1;
}
pawn Код:
ptask SpeedoCheck[1000](playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PlayerInfo[playerid][pSpeedoOn] == 1) {
new veh = GetPlayerVehicleID(playerid);
new Float:Speed = GetVehicleSpeed(veh, 0);
new string[128];
if(!IsABicycle(veh))
{
format(string,sizeof(string),"~b~SPEED:~n~~w~%d MPH~n~~g~GAS: ~w~%.2f",floatround(Speed/1.609),Gas[veh]);
PlayerTextDrawSetString(playerid,SpeedoText0,string);
}
}
return 1;
}