'SetVehicleNumberPlate' Doesn't works?
#1

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.
Reply
#2

You need to re-spawn the vehicle after setting it's license (number) plate.
Reply
#3

I have this already test it, but that doesn't work.
Reply
#4

Okay, try doing it by command.

pawn Код:
CMD:changeplate(playerid, params[])
{
    #pragma unused params
    SetVehicleNumberPlate(GetPlayerVehicleID(playerid), "Testing123");
    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
    return 1;
}
Reply
#5

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");
    }
Reply
#6

And all the boards have the same Numbers on the plate...

http://uploadffs.nl/images/sampproble.png


XYZR 000?
Reply
#7

Quote:
Originally Posted by BlackBank3
Посмотреть сообщение
And all the boards have the same Numbers on the plate...

http://uploadffs.nl/images/sampproble.png


XYZR 000?
Yes, "XYZR 000" is the default vehicle license (number) plate.
Reply
#8

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.
Reply
#9

Код:
public OnVehicleSpawn(vehicleid)
{
    if(vehicleid >= 0 && vehicleid <= 2000)
    {
        SetVehicleNumberPlate(vehicleid, "{01DF01} DL V1.0");
        SetVehicleToRespawn(vehicleid);
    }
}
Use this, works fine for me
Reply
#10

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.
Reply
#11

Quote:
Originally Posted by BlackBank3
View Post
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.
Reply
#12

Quote:
Originally Posted by Hash [NL-RP]
View Post
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.
Reply
#13

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)