Plate system?
#1

Basicly I want to add a license plate system to the script.

This is the Car_Create thingy:

Код:
Car_Create(ownerid, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, type = 0, addsiren = 0)
{
    for (new i = 0; i != MAX_DYNAMIC_CARS; i ++)
	{
		if (!CarData[i][carExists])
   		{
   		    if (color1 == -1)
   		        color1 = random(127);

			if (color2 == -1)
			    color2 = random(127);

   		    CarData[i][carExists] = true;
            CarData[i][carModel] = modelid;
            CarData[i][carOwner] = ownerid;

            CarData[i][carPos][0] = x;
            CarData[i][carPos][1] = y;
            CarData[i][carPos][2] = z;
            CarData[i][carPos][3] = angle;

            CarData[i][carColor1] = color1;
            CarData[i][carColor2] = color2;
            CarData[i][carPaintjob] = -1;
            CarData[i][carLocked] = false;
            CarData[i][carImpounded] = -1;
            CarData[i][carImpoundPrice] = 0;
            CarData[i][carFaction] = type;
            CarData[i][carSiren] = addsiren;

            for (new j = 0; j < 14; j ++)
			{
                if (j < 5)
				{
                    CarData[i][carWeapons][j] = 0;
                    CarData[i][carAmmo][j] = 0;
                }
                CarData[i][carMods][j] = 0;
            }
            CarData[i][carVehicle] = CreateVehicle(modelid, x, y, z, angle, color1, color2, -1, 0);

            if (CarData[i][carVehicle] != INVALID_VEHICLE_ID) {
                ResetVehicle(CarData[i][carVehicle]);
            }
            mysql_tquery(g_iHandle, "INSERT INTO `cars` (`carModel`) VALUES(0)", "OnCarCreated", "d", i);
            return i;
		}
	}
	return -1;
}
Appreciate any help. I want it, like when you buy a car, to create a plate and keep that plate, basicly like in real life, you know.. Thanks in advance.
Reply
#2

are you asking about SetVehicleNumberPlate or how to save it? save the string used in a file the moment u use setpvnplate thing then reuse it onvspawn for the players
Reply
#3

Well i use a default license plate, and im not sure if this is what your looking for but this might help you on your way. So yeah you gotta edit it so it will make random unique plates. and if you succeed i'do be happy to know how because it's very good to have.

You want to add VehicleNumberPlate to your enum
Код:
#define DEFAULT_NUMBER_PLATE "94-FF-2A"
new VehicleID[MAX_DYNAMIC_CARS];

Car_Create(ownerid, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, type = 0, addsiren = 0)
{
    for (new i = 0; i != MAX_DYNAMIC_CARS; i ++)
    new vehicleid = GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective;
	{
		if (!CarData[i][carExists])
   		{
   		    if (color1 == -1)
   		        color1 = random(127);

			if (color2 == -1)
			    color2 = random(127);

   		    CarData[i][carExists] = true;
            CarData[i][carModel] = modelid;
            CarData[i][carOwner] = ownerid;

            CarData[i][carPos][0] = x;
            CarData[i][carPos][1] = y;
            CarData[i][carPos][2] = z;
            CarData[i][carPos][3] = angle;

            CarData[i][carColor1] = color1;
            CarData[i][carColor2] = color2;
            CarData[i][carPaintjob] = -1;
            CarData[i][carLocked] = false;
            CarData[i][carImpounded] = -1;
            CarData[i][carImpoundPrice] = 0;
            CarData[i][carFaction] = type;
            CarData[i][carSiren] = addsiren;
            CarData[i][VehicleNumberPlate] = DEFAULT_NUMBER_PLATE;
            SetVehicleNumberPlate(VehicleID[vehicleid], CarData[i][VehicleNumberPlate]);

            for (new j = 0; j < 14; j ++)
			{
                if (j < 5)
				{
                    CarData[i][carWeapons][j] = 0;
                    CarData[i][carAmmo][j] = 0;
                }
                CarData[i][carMods][j] = 0;
            }
            CarData[i][carVehicle] = CreateVehicle(modelid, x, y, z, angle, color1, color2, -1, 0);

            if (CarData[i][carVehicle] != INVALID_VEHICLE_ID) {
                ResetVehicle(CarData[i][carVehicle]);
            }
            mysql_tquery(g_iHandle, "INSERT INTO `cars` (`carModel`) VALUES(0)", "OnCarCreated", "d", i);
            return i;
		}
	}
	return -1;
}
The things i added are marked Bold and Red
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)