Random cars at a certain position - 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: Random cars at a certain position (
/showthread.php?tid=397756)
Random cars at a certain position -
Stanford - 06.12.2012
How do I make the server spawn a random cars at a certain position? please post the thing down here, thank you
also I dont want some cars like Hunter and planes and monster to be spawned at that position.
Re: Random cars at a certain position -
Stanford - 06.12.2012
Any help?
Re: Random cars at a certain position -
Stanford - 07.12.2012
Help?!
Re: Random cars at a certain position -
Trollolollo - 07.12.2012
I Think Someone Post The Same Topic With You In This Forum,
So Just Find It
Sorry Cause I Cant Help You Cause Im New In Pawno
Re: Random cars at a certain position -
RajatPawar - 07.12.2012
Make an array of random car IDs..like this
pawn Код:
new randomcars[]=
{
461,
521,
561
//Add more vehicle IDs here
};
Then in your OnGameModeInIt,
pawn Код:
AddStaticVehicle(random(sizeof(randomcars)), X pos,Y pos,Z pos, Float:angle, color1, color2)
Re: Random cars at a certain position -
LarzI - 07.12.2012
Quote:
Originally Posted by Rajat_Pawar
Make an array of random car IDs..like this
pawn Код:
new randomcars[]= { 461, 521, 561 //Add more vehicle IDs here };
Then in your OnGameModeInIt,
pawn Код:
AddStaticVehicle(random(sizeof(randomcars)), X pos,Y pos,Z pos, Float:angle, color1, color2)
|
Not quite.
The definition of the array is used correctly, but when you're going to use it in the function you need to do this:
pawn Код:
randomcars[ random( sizeof( randomcars ))]
, else you're just generating a random number between 1 (or is it 0?) and 3