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



SetVehicleNumberPlate - zxc1 - 01.11.2011

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.


Re: SetVehicleNumberPlate - TheLoolyWiz - 01.11.2011

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



Re: SetVehicleNumberPlate - Jakku - 01.11.2011

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


Re: SetVehicleNumberPlate - zxc1 - 01.11.2011

Thanks!