'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
Hello,
I have some problems with the function 'SetVehicleNumberPlate'.
The Number Plate of the cars will not be changed...
My code for the changes:
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
SetVehicleNumberPlate(vehicleid, "{01DF01} DL V1.0");
return 1;
}
I'm doing something wrong? Or is it a bug?
Thanks.
Re: 'SetVehicleNumberPlate' Doesn't works? -
Scenario - 07.01.2011
You need to re-spawn the vehicle after setting it's license (number) plate.
Re: 'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
I have this already test it, but that doesn't work.
Re: 'SetVehicleNumberPlate' Doesn't works? -
Scenario - 07.01.2011
Okay, try doing it by command.
pawn Код:
CMD:changeplate(playerid, params[])
{
#pragma unused params
SetVehicleNumberPlate(GetPlayerVehicleID(playerid), "Testing123");
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
return 1;
}
Re: 'SetVehicleNumberPlate' Doesn't works? -
Infamous - 07.01.2011
If you are setting the same plate on all cars then set it under OnGameModeInIt and you won't have to respawn the vehicles. Make sure you use the following code after the vehicles listed under OnGameModeInIt.
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++) {
SetVehicleNumberPlate(i, "{01DF01} DL V1.0");
}
Re: 'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
And all the boards have the same Numbers on the plate...
http://uploadffs.nl/images/sampproble.png
XYZR 000?
Re: 'SetVehicleNumberPlate' Doesn't works? -
Scenario - 07.01.2011
Quote:
Originally Posted by BlackBank3
|
Yes, "XYZR 000" is the default vehicle license (number) plate.
Re: 'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
Quote:
Originally Posted by RealCop228
Okay, try doing it by command.
pawn Код:
CMD:changeplate(playerid, params[]) { #pragma unused params SetVehicleNumberPlate(GetPlayerVehicleID(playerid), "Testing123"); SetVehicleToRespawn(GetPlayerVehicleID(playerid)); return 1; }
|
This one works... Maybe too change the vehicle plate under OnGameModeInit, after the vehicles are created.
Quote:
Originally Posted by Infamous
If you are setting the same plate on all cars then set it under OnGameModeInIt and you won't have to respawn the vehicles. Make sure you use the following code after the vehicles listed under OnGameModeInIt.
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++) { SetVehicleNumberPlate(i, "{01DF01} DL V1.0"); }
|
I will try this, and hope that it works.
Quote:
Originally Posted by RealCop228
Yes, "XYZR 000" is the default vehicle license (number) plate.
|
Ok thanks for the info, i didn't know that.
Re: 'SetVehicleNumberPlate' Doesn't works? -
Hash [NL-RP] - 07.01.2011
Код:
public OnVehicleSpawn(vehicleid)
{
if(vehicleid >= 0 && vehicleid <= 2000)
{
SetVehicleNumberPlate(vehicleid, "{01DF01} DL V1.0");
SetVehicleToRespawn(vehicleid);
}
}
Use this, works fine for me
Re: 'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
Quote:
Originally Posted by Hash [NL-RP]
public OnVehicleSpawn(vehicleid)
{
if(vehicleid >= 0 && vehicleid <= 2000)
{
SetVehicleNumberPlate(vehicleid, "Text");
SetVehicleToRespawn(vehicleid);
}
}
|
I have test this already under OnVehicleSpawn, but that doesn't work.
Re: 'SetVehicleNumberPlate' Doesn't works? -
Hash [NL-RP] - 07.01.2011
Quote:
Originally Posted by BlackBank3
I have test this already under OnVehicleSpawn, but that doesn't work.
|
When you start the server Make sure you respawn all the cars first.
Re: 'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
Quote:
Originally Posted by Hash [NL-RP]
When you start the server Make sure you respawn all the cars first.
|
Hmm, Not thinked about that.
Maybe OnVehicleSpawn doesn't call if there is created a new vehicle, i wil test it.
Re: 'SetVehicleNumberPlate' Doesn't works? -
BlackBank - 07.01.2011
It works now.
I have made this code under OnGameModeInit, after all the vehicles are created.
pawn Code:
new vehicles_loaded = CreateVehicle(522, 0.0, 0.0, 0.0, 0.0, -1, -1, 10000);
DestroyVehicle(vehicles_loaded);
for(new i = 1; i < vehicles_loaded; i++)
{
SetVehicleToRespawn(i);
}
And it works perfect.
Thanks everbody for your help.