[0.3c] License Plate OnGameModeInit -
Camacorn - 16.02.2011
Ok, i want all vehicles to have the same license plate on startup, so i added this to OnGameModeInit:
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleNumberPlate(i, "plate");
print("PLATES SET");
}
I added the "print("PLATES SET");" so that i know if its being called and it is.
I also tried adding a line to make them respawn but it didnt help, i also tried it under OnVehicleSpawn but that didnt help either, what can i do?
Re: [0.3c] License Plate OnGameModeInit -
randomkid88 - 16.02.2011
You need to respawn the vehicles for them to take effect. Add SetVehicleToRespawn(i) after SetVehicleNumberPlate.
Another good place to set plates is under OnVehicleStreamIn.
Re: [0.3c] License Plate OnGameModeInit -
[WF]Demon - 16.02.2011
That is where you are wrong RandomKid. i have this in my GM after creating all the cars and it works like a charm, the correct thing i think you are talking about is for the player to see the effects it must stream out for atleast 3 seconds and then when it streams back in that player can see it, if it is changing them on the gamemodes entrance then it will work just fine. as for his questions, are you doing this after you are creating the cars, or before or in the middle of creation? if not after you create the vehicles then put it after
- [WF]Demon
Re: [0.3c] License Plate OnGameModeInit -
Krx17 - 17.02.2011
Crodox, you are actually wrong. When a vehicle streams out, it is destroyed on the player's system, and when it streams in, it is recreated with the saved parameters(model, license plate, etc), that's why it works after you stream in and out. If a vehicle never streams out for a player, the plate will never be put on. That's why you must use SetVehicleToRespawn.
Re: [0.3c] License Plate OnGameModeInit -
Camacorn - 17.02.2011
Tried this with no help:
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleNumberPlate(i, "PLATE");
SetVehicleToRespawn(i);
print("PLATE SET");
}
Re: [0.3c] License Plate OnGameModeInit -
Camacorn - 17.02.2011
Quote:
Originally Posted by randomkid88
You need to respawn the vehicles for them to take effect. Add SetVehicleToRespawn(i) after SetVehicleNumberPlate.
Another good place to set plates is under OnVehicleStreamIn.
|
Nevermind, this fixed it, Thank you
Re: [0.3c] License Plate OnGameModeInit -
[WF]Demon - 17.02.2011
W/E you think (sorry for this bump) but it works for me in OnGameModeInit w/o SetVehicleToRespawn, but whatever works for people it works for them, the way i do it it works for me so i use it.
Re: [0.3c] License Plate OnGameModeInit -
randomkid88 - 17.02.2011
If you do it in OnGamemodeInit, do you do it like this?
pawn Код:
SetVehicleNumberPlate(CreateVehicle(...), "Plate");
Otherwise, the wiki says:
Quote:
Note: The vehicle must be respawned or restreamed for the changes to take effect.
|
Re: [0.3c] License Plate OnGameModeInit -
[WF]Demon - 17.02.2011
ReStreamed, OnGameModeInit is called when the gamemode loads, there will be no players connected at the time so it will work, look here is what i do
pawn Код:
//Create Vehicles Here
for(new i; i < MAX_VEHICLES; i++)
{
if(IsVehicleConnected(i))
{
new randnumplate = random(sizeof(RandomPlates));
SetVehicleNumberPlate(i, RandomPlates[randnumplate]);
}
}
since that works the wiki must be wrong
Re: [0.3c] License Plate OnGameModeInit -
Hal - 17.02.2011
Quote:
Originally Posted by randomkid88
If you do it in OnGamemodeInit, do you do it like this?
pawn Код:
SetVehicleNumberPlate(CreateVehicle(...), "Plate");
Otherwise, the wiki says:
|
If you do it before the vehicles are created (in OnGameModeInit) then there is no need to respawn them, because they havent spawned and that first spawn will have the set plate.