SA-MP Forums Archive
Vehicle Number Plates - Random OnVehicleSpawn - 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: Vehicle Number Plates - Random OnVehicleSpawn (/showthread.php?tid=128772)



Vehicle Number Plates - Random OnVehicleSpawn - [NYRP]Mike. - 19.02.2010

Hey Guys!

I've been working on my script and now i'm wondering if it's possible to give every car a Certain NumberPlate, for example every numberplate will start off with: "NGRP", then the last 3 letters would be random, i've tried it with just Army Cars, but it doesn't seem to set the numberplate, here's my code.

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new string[56];
    if(vehicleid >= 1 && vehicleid <= 9)
    {
        new randnumb = 1 + random(9);
      format(string, sizeof(string),"NGRP %d%d%d",randnumb,randnumb,randnumb);
      SetVehicleNumberPlate(vehicleid, string);
    }
    return 1;
}
but the vehicle numberplate just wont change, any ideas? Thanks.


(( Nevermind SetVehicleNumberPlate has been removed, thanks though. ))


Re: Vehicle Number Plates - Random OnVehicleSpawn - wolfcock - 27.12.2010

i don't know, but nice


Re: Vehicle Number Plates - Random OnVehicleSpawn - Retardedwolf - 27.12.2010

@wolfcock, nice 10 months bump.

@Mike, if you still play SAMP, You need to respawn the vehicle.


Re: Vehicle Number Plates - Random OnVehicleSpawn - blackwave - 27.12.2010

Rofl, really made me laugh this 10 months bump XD


Re: Vehicle Number Plates - Random OnVehicleSpawn - _rAped - 28.12.2010

Jizz. Nice bump haha. For some other reason I felt to restate what he said.

You have to respawn the vehicle, when calling it under OnVehicleSpawn().
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new string[32];
    if(vehicleid >= 1 && vehicleid <= 9)
    {
        new randnumb = 1 + random(9);
        format(string, sizeof(string),"NGRP %d%d%d",randnumb,randnumb,randnumb);
        SetVehicleNumberPlate(vehicleid, string);
        SetVehicleToRespawn(vehicleid);
    }
    return 1;
}



Re: Vehicle Number Plates - Random OnVehicleSpawn - bartje01 - 28.12.2010

Lol. Why bumping this so hard?

And. I thought that the licenseplate didn't work anymore?


Re: Vehicle Number Plates - Random OnVehicleSpawn - _rAped - 28.12.2010

Quote:
Originally Posted by bartje01
Посмотреть сообщение
Lol. Why bumping this so hard?

And. I thought that the licenseplate didn't work anymore?
No other thread to reply on atm. (jking, have no idea).

Plates seems to work fine for me.


Re: Vehicle Number Plates - Random OnVehicleSpawn - robintjeh - 13.10.2011

not for me