random numberplates
#1

hi everyone how to make random vehicle number plate like: ASD 258 but this number save in mysql or .ini and when player go to kate numbers script check does this number exist if exist create another if not create and i want number take in checpoint, sorry for bad my english i think you undrestand what i say. Thanks
Reply
#2

something like this
pawn Код:
for(i=400; i<611;++)
{
new string[256];
format(string,256," lol %d",i);
SetVehicleNumberPlate(i,string);
}
left just save it
Reply
#3

pawn Код:
new const alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
new plate[8];

format(plate, sizeof(plate), "%c%c%c %03d", alpha[random(sizeof(alpha))], alpha[random(sizeof(alpha))], alpha[random(sizeof(alpha))], random(1000));
Reply
#4

pawn Код:
#define randomEx(%0,%1) (%0<%1?%0+random(%1-%0+1):%1+random(%0-%1+1))
//Then somewhere in your code...
new str[8];
format(str, sizeof(str), "%c%c%c %03d", randomEx('A', 'Z'), randomEx('A', 'Z'), randomEx('A', 'Z'), random(1000));
//After that compare the string with another ones in your files.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)