Vehicle Plates - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle Plates (
/showthread.php?tid=635204)
Vehicle Plates -
NealPeteros - 03.06.2017
Is there a function to get the vehicle id from its plate number? Is there a function that can be made to do this?
Re: Vehicle Plates -
Abagail - 03.06.2017
Vehicle plates aren't externally referenceable (there are no _Get functions), it is up to you to store plates for lookup. It's entirely possible to do it this way.
Re: Vehicle Plates -
NealPeteros - 03.06.2017
I used an alternative way. Adding the vehicle ID on the last part of the plate. My problem now is how to extract the ID
considering that vehicle ID's can range from tens, to hundreds, to thousands, if necessary.
Код:
format(string,sizeof(string),"SJ-%d%d", plate, vehicleid);
Re: Vehicle Plates -
StrikerZ - 03.06.2017
I guess you should making something like this.
PHP код:
new Plates[MAX_VEHICLES][30];
SetVehicleNumberPlateEx(vehicleid, plate[])
{
SetVehicleNumberPlateEx(vehicleid, plate);
format(Plates[vehicleid],30,plate);
return 1;
}
Usage: SetVehicleNumberPlateEx(vehicleid, "ABCD 123");
GetIDFromPlate(plate[])
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(!strcmp(Plates[i],plate)) return i;
}
return -1;
}
Usage: GetIDFromPlate("ABCD 123");
And save the Plates variable too.
Re: Vehicle Plates -
NealPeteros - 03.06.2017
Quote:
Originally Posted by Sunehildeep
I guess you should making something like this.
PHP код:
new Plates[MAX_VEHICLES][30];
SetVehicleNumberPlateEx(vehicleid, plate[])
{
SetVehicleNumberPlateEx(vehicleid, plate);
format(Plates[vehicleid],30,plate);
return 1;
}
Usage: SetVehicleNumberPlateEx(vehicleid, "ABCD 123");
GetIDFromPlate(plate[])
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(!strcmp(Plates[i],plate)) return i;
}
return -1;
}
Usage: GetIDFromPlate("ABCD 123");
And save the Plates variable too.
|
Awesome! Just wanna ask if
PHP код:
SetVehicleNumberPlateEx(vehicleid, plate[])
{
SetVehicleNumberPlateEx(vehicleid, plate);//shouldn't this be SetVehicleNumberPlate?
format(Plates[vehicleid],30,plate);
return 1;
}
Re: Vehicle Plates -
StrikerZ - 03.06.2017
Quote:
Originally Posted by NealPeteros
Awesome! Just wanna ask if
PHP код:
SetVehicleNumberPlateEx(vehicleid, plate[])
{
SetVehicleNumberPlateEx(vehicleid, plate);//shouldn't this be SetVehicleNumberPlate?
format(Plates[vehicleid],30,plate);
return 1;
}
|
Yea my bad