Speed Camera Plate
#1

/* Automatic Speeding Camera system, Created by FusiouS


**************************
Version: 1.0, Release 1
SA-MP Version: 0.3c
Credits for speeding cam system: FusiouS
Special thanks & Credits for testing speedometer: Destrojer
**************************

Features:

- Checks player speed when he is moving with vehicle
- If vehicle speed is over specified speed limit, speeding camera give's ricket automatically
- All camera's speed limit can be decided: 1 can be for example 40mp/h, 2nd for 60mp/h and 3rd for 80mp/h and so on..
- Easy camera creating system


TERMS OF USE: You are free to modify this script for your own use.
Do not remove credits or re-release this as your own.

*/


// Required Include
#include <a_samp>
#include <Streamer>
// New stuff

#include <zcmd>

new UpdateSeconds = 1;
new MaxObjects = 20;


new VehicleNames[212][] = { // Ze samp fуra, autora neznбm
"Landstalker","Bravura","Buffalo","Linerunner","Pe reniel","Sentinel","Dumper","Firetruck","Trashmast er","Stretch","Manana","Infernus",
"Voodoo","Pony","Mule","Cheetah","Ambulance","Levi athan","Moonbeam","Esperanto","Taxi","Washington", "Bobcat","Mr Whoopee","BF Injection",
"Hunter","Premier","Enforcer","Securicar","Banshee ","Predator","Bus","Rhino","Barracks","Hotknife"," Trailer","Previon","Coach","Cabbie",
"Stallion","Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squ alo","Seasparrow","Pizzaboy","Tram","Trailer","Tur ismo","Speeder",
"Reefer","Tropic","Flatbed","Yankee","Caddy","Sola ir","Berkley's RC Van","Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider",
"Glendale","Oceanic","Sanchez","Sparrow","Patriot" ,"Quad","Coastguard","Dinghy","Hermes","Sabre","Ru stler","ZR3 50","Walton","Regina",
"Comet","BMX","Burrito","Camper","Marquis","Baggag e","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood",
"Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa","RC Goblin","Hotring Racer A","Hotring Racer B",
"Bloodring Banger","Rancher","Super GT","Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTr ain",
"Nebula","Majestic","Buccaneer","Shamal","Hydra"," FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck",
"Willard","Forklift","Tractor","Combine","Feltzer" ,"Remington","Slamvan","Blade","Freight","Streak", "Vortex","Vincent","Bullet","Clover",
"Sadler","Firetruck","Hustler","Intruder","Primo", "Cargobob","Tampa","Sunrise","Merit","Utility","Ne vada","Yosemite","Windsor","Monster A",
"Monster B","Uranus","Jester","Sultan","Stratum","Elegy","R aindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freig ht","Trailer",
"Kart","Mower","Duneride","Sweeper","Broadway","To rnado","AT-400","DFT-30","Huntley","Stafford","BF-400","Newsvan","Tug","Trailer A","Emperor",
"Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)",
"Police Car (LVPD)","Police Ranger","Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggag e Trailer A","Luggage Trailer B",
"Stair Trailer","Boxville","Farm Plow","Utility Trailer"
};
new Float:carpos_x,Float:carpos_y,Float:carpos_z;
public OnFilterScriptInit() {
print("\nAutomatic Speeding Camera System loaded!");
print("Version: 1.0, Release 1");
print("Credits: FusiouS\n");
SetTimer("UpdateSpeed", UpdateSeconds*1000, 1);
CreateObject(18880, 2397.18091, -33.90270, 25.35980, 0.00000, 0.00000, 86.82000);
print("\nDynamic plates activated !");
for(new i=1; i<MAX_VEHICLES; i++)
{
new string[128];
format(string, 128, "SA - %d",i);
SetVehicleNumberPlate(i, string);
GetVehiclePos(i,carpos_x,carpos_y,carpos_z);
SetVehicleToRespawn(i);
SetVehiclePos(i,carpos_x,carpos_y,carpos_z);
}
return 1;
}
// Camera Objects

/* modelid X Coord Y Coord Z Coord RotateX RotateY RotateZ */




public OnFilterScriptExit() {
for(new i=1; i<MAX_VEHICLES; i++)
{
SetVehicleNumberPlate(i, "XYZR 000");
GetVehiclePos(i,carpos_x,carpos_y,carpos_z);
SetVehicleToRespawn(i);
SetVehiclePos(i,carpos_x,carpos_y,carpos_z);
}
}

forward UpdateSpeed(playerid);
enum SavePlayerPosEnum {
Float:LastX,
Float:LastY,
Float:LastZ
}

#define COLOR_YELLOW 0xFFFF00AA
#define SLOTS 200
#define COLOR_PURPLE 0xC2A2DAAA

new objectcreated;
new SavePlayerPos[SLOTS][SavePlayerPosEnum];
new distance1[MAX_PLAYERS];

public OnVehicleSpawn(vehicleid)
{
new string[128];
format(string, 128, "SA - %d",vehicleid);
SetVehicleNumberPlate(vehicleid, string);
GetVehiclePos(vehicleid,carpos_x,carpos_y,carpos_z );
SetVehicleToRespawn(vehicleid);
SetVehiclePos(vehicleid,carpos_x,carpos_y,carpos_z );
return 1;
}
public UpdateSpeed(playerid)
{
new Float:x,Float:y,Float:z;
new Float:distance,value;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, x, y, z);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePla yerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
// Distance: meters in the last second
value = floatround(distance * 3600);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
distance1[i] = floatround(value/1600);

SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;


// Speeding controllers

/* CoordX CoordY CoorZ Radius Speedlimit (MP/H) */

AddSpeedingCam(i, 2397.18091, -33.90270, 25.35980, 29, 40);
}
}
}

IsPlayerInCircle(playerid,Float:x,Float:y,radius)
{
if(GetPlayerDistanceToPoint(playerid,Float:x,Float :y) < radius)
{
return 1;
}
return 0;
}

GetPlayerDistanceToPoint(playerid,Float:x,Float:y)
{
new Float:x1,Float:y1,Float:z1; GetPlayerPos(playerid,x1,y1,z1);
new Float:tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2) +
floatpower(floatabs(floatsub(y,y1)),2));
return floatround(tmpdis);
}

stock AddSpeedingCam(playerid, Float:xx, Float:yy, Float:zz, radius, speed1)
{
new fine[MAX_PLAYERS];
new string[256];
if(objectcreated!=MaxObjects)
{
CreateObject(playerid, xx, yy, zz, 0.0, 0.0, 10);
objectcreated++;
}
if((distance1[playerid])>speed1)
{
if(IsPlayerInCircle(playerid, xx, yy, radius) && GetPlayerState(playerid)== PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
fine[playerid]=((distance1[playerid]*17/10)-speed1);
PlayerPlaySound(playerid, 1132, 0.0, 0.0, 0.0);
format(string,sizeof(string),"[RADAR]:< Radar HW Radar #01-A > Vozidlo: %s [SPZ : %d]", VehicleNames[GetVehicleModel(vehicleid) - 400],SetVehicleNumberPlate(vehicleid));
SendClientMessage(playerid,COLOR_YELLOW, string);
}
}
}


Warning is there

format(string,sizeof(string),"[RADAR]:< Radar HW Radar #01-A > Vozidlo: %s [SPZ : %d]", VehicleNames[GetVehicleModel(vehicleid) - 400],SetVehicleNumberPlate(vehicleid));
Reply
#2

-_- wtf?
Reply
#3

What's the warning?
Next time add your code with [CODE] tags.
Reply
#4

http://ctrlv.cz/QNSD

Look its a photo

okey sorry for tag
Reply
#5

EDITED
Reply
#6

Try this:
Код:
format(string, sizeof(string), "[RADAR]:< Radar HW Radar #01-A > Vozidlo: %s [SPZ : %d]", GetVehicleName(vehicleid), SetVehicleNumberPlate(vehicleid));
And add this somewhere in your code:
Код:
stock GetVehicleName(vehicleid)
{
	new string [50];
	format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(vehicleid) - 400]);
	return string;
}
EDIT:
Now I saw that you have SetVehicleNumberPlate(vehicleid) which is setting the number plate, not getting the plate string. There's no function like GetVehicleNumberPlate. You have to store the number plate when setting it and then to get the string.
Reply
#7

My bad sorry
Reply
#8

I need when the car go on radar i see the name of car theay i have and plate a tryit this but errors.
Reply
#9

So what I have to do
Reply
#10

You have SetVehicleNumberPlate(vehicleid) which is setting the number plate and cannot be used in format. Maybe you're trying to get the number plate, but there's no function like this.

You have to store the number plate every time you change it. Then you can add it to the format.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)