10.06.2009, 07:15
It's pretty easy, I suppose I'll go ahead and make a script that randomizes vehicles after they spawn
EDIT*Just tested it, works fine now.
EDIT** I actually really like that lol, hope someone makes good use of it.
pawn Код:
//At the top of your FS or GM
new Float:RandVehicles[3][4]; //X,Y,Z,A -- change [x] to the amount of random vehicles you have
new RandVehicleID[3]; // Change[x] to be the same as the previous one
new RandVAmount;
new RandVehicleModels[3] = { //Change [x] to be the amount of models you have
400,
401, //Vehicle models, all but last one has a ','
402
};
CreateRandomVehicle(Float:X,Float:Y,Float:Z,Float:A,ID)
{
new tmp;
if(ID==-1)tmp=RandVAmount; else tmp = ID;
RandVehicles[tmp][0]=X;
RandVehicles[tmp][1]=Y;
RandVehicles[tmp][2]=Z;
RandVehicles[tmp][3]=A;
new rand=random(sizeof(RandVehicleModels));
RandVehicleID[tmp]=CreateVehicle(RandVehicleModels[rand],X,Y,Z,A,-1,-1,60000);
if(ID==-1)RandVAmount++;
}
//Inside of OnGameModeInit or OnFilterScriptInit
public OnFilterScriptInit()
{
CreateRandomVehicle(100,100,100,100,-1); //-1 means the vehicle is new
CreateRandomVehicle(100,100,100,100,-1); //-1 means the vehicle is new
CreateRandomVehicle(100,100,100,100,-1); //-1 means the vehicle is new
}
//Inside of OnVehicleSpawn
public OnVehicleSpawn(vehicleid)
{
for(new o; o<RandVAmount; o++)
{
if(vehicleid==RandVehicleID[o])
{
DestroyVehicle(RandVehicleID[o]);
CreateRandomVehicle(RandVehicles[o][0],RandVehicles[o][1],RandVehicles[o][2],RandVehicles[o][3],o);
break;
}
}
}
EDIT** I actually really like that lol, hope someone makes good use of it.