Random License Plate
#1

How to make this code:
Код:
{
    new string[50];
    format(string,sizeof(string),"{000000}%c%c%c %i%i%i",(65+random(26)),(65+random(26)),(65+random(26)),random(10),random(10),random(10));
    SetVehicleNumberPlate(vehicleid,string);
}
Fit here:
Код:
public OnVehicleSpawn(vehicleid)
{
    if(gDestroyVehicle[vehicleid])  									// if vehicle id is marked for deletion
    {
        ////foreach(Player, i)                            					// for all players
        for(new i; i<MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i) && IsPlayerInVehicle(i,vehicleid))      	// if connected and in vehicleid
			{
				RemovePlayerFromVehicle(i);                                     	// remove from vehicle
			}
		}
    	SetVehicleVirtualWorld(vehicleid,255);                                  // set vehicle to unused vw to prevent players from using it
    	SetTimerEx("KillCar",10000,0,"d",vehicleid);
		for(new i = 0; i < sizeof(CreatedCars); i++)
    	{
    	    if(CreatedCars[i] == vehicleid)
    	    {
    	        CreatedCars[i] = INVALID_VEHICLE_ID;
    	        break;
			}
    	}
    }
	return 1;
}
Reply
#2

bump
Reply
#3

pawn Код:
for(new x;x<sizeof(CreatedCars);x++)
    {
        format(string, sizeof(string), "XMT %d", CreatedCars[x]);
        SetVehicleNumberPlate(CreatedCars[x], string);
        SetVehicleToRespawn(CreatedCars[x]);
    }
Something like this this will set a random Numberplat
Reply
#4

Okay I will try it out!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)