SetVehicleNumberPlate
#1

pawn Код:
for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
    {
        new string[32];
        new playerid;
        new car = GetPlayerVehicleID(playerid);
        format(string, sizeof(string),"LV - %d",car);
        SetVehicleNumberPlate(Vehicles, string);
    }
This code is under the public OnGameModeInit.
Why is that not working? It's shows "LV - 0" on everyvehicle's plate.
Reply
#2

Try this:
pawn Код:
for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
    {
        new string[32];
        new pName[MAX_PLAYER_NAME], playerid;
        new car = GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string),"LV - %d",car);
        SetVehicleNumberPlate(Vehicles, string);
    }
Reply
#3

You must spawn the vehicles before setting the plate. After setting it, you must respawn the vehicle.

pawn Код:
//Spawn vehicles before this part:

for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
{
new string[30];
format(string, sizeof(string),"LV - %d", Vehicles);
SetVehicleNumberPlate(Vehicles, string);
SetVehicleToRespawn(Vehicles);
}

EDIT:
Sorry, I copied the wrong code. Fixed
Reply
#4

Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)