SetVehicleNumberPlate -
SnG.Scot_MisCuDI - 05.03.2012
Im making a cmd where players type /plate and then each new car they make it has that plate for only their car.
But its not working :/
And how can i add color to the plate?
pawn Код:
CMD:plate(playerid,params[])
{
for(new Vehicles = 1; Vehicles < MAX_VEHICLES; Vehicles++)
{
new string[30];
format(string, sizeof(string),"%d", Vehicles);
SetVehicleNumberPlate(playerid, string);
}
return 1;
}
and it wont spawn with the cars when server starts only when i respawn cars
pawn Код:
for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
{
new string[30];
for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
format(string, sizeof(string),"{ff00ff}SnG-Fun", Vehicles);
SetVehicleNumberPlate(Vehicles,string);
}
Re: SetVehicleNumberPlate -
Programie - 05.03.2012
I don't know if I understand you correctly.
You want to write a command "/plate" which can be used to change the text of the number plate?
Re: SetVehicleNumberPlate -
SnG.Scot_MisCuDI - 05.03.2012
Yes. When the player types /plate any new vehicle they spawn it will add that plate to their vehicle
Re: SetVehicleNumberPlate -
Programie - 05.03.2012
You could write the current string to a PVar or an array.
Quick 'n Dirty code:
Код:
CMD:plate(playerid, params[])
{
if (strlen(params))
{
SetPVarString(playerid, "PlateText", params);
}
else
{
SendClientMessage(playerid, 0xA00000AA, "Usage: /plate <Your Text>");
}
return true;
}
And if you create the vehicle using CreateVehicle you could set the plate text to the text of the PVar.
Quick 'n Dirty code:
Код:
new plateText[32];
new vehicleID = CreateVehicle(modelID, posX, posY, posZ, angle, color1, color2, respawnDelay);
GetPVarString(playerID, "PlateText", plateText, sizeof(plateText));
SetVehicleNumberPlate(vehicleID, plateText);
WARNING: Untested code! I just want to show you the way I would do it.
Re: SetVehicleNumberPlate -
SnG.Scot_MisCuDI - 06.03.2012
How can i make all cars spawn with the same plate when server starts? I tried adding it to OngameModeInit but it wont change the plates
Re : SetVehicleNumberPlate -
falor - 06.03.2012
Код:
SetVehicleNumberPlate(AddStaticVehicle(523,-1591.30004883,706.59997559,-5.59999990,274.00000000,252,1), "HPV P02"); //HPV1000
SetVehicleNumberPlate(AddStaticVehicle(523,-1591.09997559,707.59997559,-5.59999990,273.99902344,252,1), "HPV P03"); //HPV1000
The plates are "HPV P02" & "HPV P03"
Just add before "AddStaticVehicle" -> SetVehicleNumberPlate(
And AFTER -> , "YOUR PLATE (MAX 32 CAR)");
Respuesta: Re : SetVehicleNumberPlate -
Sergiosousa - 06.03.2012
Re: SetVehicleNumberPlate -
SnG.Scot_MisCuDI - 06.03.2012
i used this code
pawn Код:
for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
{
new string[30];
for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
format(string, sizeof(string),"{ff00ff}SnG-Fun", Vehicles);
SetVehicleNumberPlate(Vehicles,string);
}
that used to work but now it doesnt. I dont under stand why you have different codes.
Re: SetVehicleNumberPlate -
Programie - 06.03.2012
That should work (untested!):
pawn Код:
for (new vehicleID = 0; vehicleID < MAX_VEHICLES; vehicleID++)
{
new string[30];
format(string, sizeof(string), "{ff00ff}SnG-Fun %d", vehicleID);
SetVehicleNumberPlate(vehicleID, string);
}
Re: SetVehicleNumberPlate -
MP2 - 06.03.2012
You have to respawn vehicles after setting the numberplate, or set it straight after creation.