SA-MP Forums Archive
Random License Plate - 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: Random License Plate (/showthread.php?tid=394501)



Random License Plate - goviscrap - 22.11.2012

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;
}



Re: Random License Plate - goviscrap - 24.11.2012

bump


Re: Random License Plate - RenSoprano - 24.11.2012

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


Re: Random License Plate - goviscrap - 24.11.2012

Okay I will try it out!