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



Vehicle Plate - DannySnoopy - 27.02.2012

Hello, i searched every where but none of them were helpful. so what i'm asking is, if some one
can show me how to create a plate which wil contain "LS-[veh ID]"
For example, i spawned vehicle id 1, so the plate will be "LS-01",
Or vehicle id 25 the plate will be "LS-25".

Thanks for the helpers!


Re: Vehicle Plate - Konstantinos - 27.02.2012

pawn Код:
public OnVehicleStreamIn( vehicleid, forplayerid )
{
    new string[ 16 ];
    format( string, sizeof( string ), "LS - %d", vehicleid );
    SetVehicleNumberPlate( vehicleid, string );
    return 1;
}



Re: Vehicle Plate - aco_SRBIJA - 27.02.2012

You forgot to respawn vehicle. Else those codes will not be seeable. I just think it, or maybe it's fixed.


Re: Vehicle Plate - Konstantinos - 27.02.2012

Actually, I was wondering too about this and I wasn't sure if I should or not.
pawn Код:
public OnVehicleStreamIn( vehicleid, forplayerid )
{
    new string[ 16 ];
    format( string, sizeof( string ), "LS - %d", vehicleid );
    SetVehicleNumberPlate( vehicleid, string );
    SetVehicleToRespawn( vehicleid );
    return 1;
}
if the first one doesn't work try with respawning as aco_SRBIJA mentioned


Re: Vehicle Plate - DannySnoopy - 27.02.2012

Quote:
Originally Posted by aco_SRBIJA
Посмотреть сообщение
You forgot to respawn vehicle. Else those codes will not be seeable. I just think it, or maybe it's fixed.
you're right, it didn't work ffs


Re: Vehicle Plate - aco_SRBIJA - 27.02.2012

Now it's all ok


Re: Vehicle Plate - DannySnoopy - 27.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Actually, I was wondering too about this and I wasn't sure if I should or not.
pawn Код:
public OnVehicleStreamIn( vehicleid, forplayerid )
{
    new string[ 16 ];
    format( string, sizeof( string ), "LS - %d", vehicleid );
    SetVehicleNumberPlate( vehicleid, string );
    SetVehicleToRespawn( vehicleid );
    return 1;
}
if the first one doesn't work try with respawning as aco_SRBIJA mentioned
lol removed all my cars


Re: Vehicle Plate - Konstantinos - 27.02.2012

Weird.
On vehicle spawn it set the plate and respawn the vehicle id.
There is no reason to remove your cars.


Re: Vehicle Plate - DannySnoopy - 27.02.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Weird.
On vehicle spawn it set the plate and respawn the vehicle id.
There is no reason to remove your cars.
I added it under OnVehicleSpawn, here.

Код:
public OnVehicleSpawn(vehicleid)
{
	VehicleSecurity[vehicleid] = 0;
	new id = GetVehicleID(vehicleid);
	if(IsValidVehicle(id))
	{
		if(VehicleColor[id][0] >= 0 && VehicleColor[id][1] >= 0)
		ChangeVehicleColor(vehicleid, VehicleColor[id][0], VehicleColor[id][1]);
		LinkVehicleToInterior(vehicleid, VehicleInterior[id]);
		SetVehicleVirtualWorld(vehicleid, VehicleWorld[id]);
		for(new i=0; i < sizeof(VehicleMods[]); i++)
		{
			AddVehicleComponent(vehicleid, VehicleMods[id][i]);
		}
		ChangeVehiclePaintjob(vehicleid, VehiclePaintjob[id]);
	}
	return 1;
}
public OnVehicleStreamIn( vehicleid, forplayerid )
{
    new string[ 16 ];
    format( string, sizeof( string ), "LS - %d", vehicleid );
    SetVehicleNumberPlate( vehicleid, string );
    SetVehicleToRespawn( vehicleid );
    return 1;
}



Re: Vehicle Plate - Konstantinos - 27.02.2012

Then add it under the command you create vehicles.