Interior Vehicle Color Changing
#8

PHP код:
public SpawnVehicleOnSlot(slotid)
{
    if(
slotid || slotid >= MAX_VEHICLE_SLOTS) return 0;

    if(!
VehicleSlots[slotid][vsUsed]) return 0;

    new 
model VehicleSlots[slotid][vsModelID];

    if(
model == -1)
    {
        
model 0// standard group
        
VehicleSlots[slotid][vsModelID] = 0;
    }

    if(
model >= && model 21// Random car out of a Group!
    
{
        
model VGroups[model][random(VGroupCount[model])];
    }

    if(
model 400 || model 611) return printf("Vehicle Slot %d invalid. model: %d  vsModelID: %d"slotidmodelVehicleSlots[slotid][vsModelID]);

    if(
VehicleSlots[slotid][vsVehicleID] > 0// On a respawn, this is VERY important!!!
    
{
        
DestroyVehicle(VehicleSlots[slotid][vsVehicleID]);
        
VIDs[VehicleSlots[slotid][vsVehicleID]-1] = -1;
    }

    new 
Float:oXFloat:oYFloat:oZ;
    
GetVehicleModelInfo(modelVEHICLE_MODEL_INFO_WHEELSFRONToXoYoZ); // This one will fix some vehicles to be in the ground (Busses, trucks etc)

    
VehicleSlots[slotid][vsVehicleID] = CreateVehicle(modelVehicleSlots[slotid][vsX], VehicleSlots[slotid][vsY], VehicleSlots[slotid][vsZ] - oZVehicleSlots[slotid][vsA], -1, -11000000);

    if(
VehicleSlots[slotid][vsVehicleID] <= 0) return printf("Vehicle Slot %d could not spawn. No free vehicle slots."slotid);

    
VIDs[VehicleSlots[slotid][vsVehicleID]-1] = slotid;

    
VehicleSlots[slotid][vsLastUpdate] = GetTickCount();
    
VehicleSlots[slotid][vsLastDriver] = -1;
    
VehicleSlots[slotid][vsAnyUpdate] = false;

    
#if DEFAULT_TUNING == true

    
if(VehicleComponentsArray[model-400][0] > 0)
    {
        for(new 
0random(TUNE_CHANCE*2); ++) AddVehicleComponent(VehicleSlots[slotid][vsVehicleID], VehicleComponentsArray[model-400][random(VehicleComponentsArray[model-400][0])+1]);

        if(
Chance(TUNE_CHANCE)) AddVehicleComponent(VehicleSlots[slotid][vsVehicleID], WheelsArray[random(sizeof(WheelsArray))]); // Any Wheel
        
if(Chance(TUNE_CHANCE)) AddVehicleComponent(VehicleSlots[slotid][vsVehicleID], 1010); // Nitro x10
        
if(Chance(TUNE_CHANCE)) AddVehicleComponent(VehicleSlots[slotid][vsVehicleID], 1087); // Hydraulics
    
}

    
#endif

    
return VehicleSlots[slotid][vsVehicleID];

Reply


Messages In This Thread
Interior Vehicle Color Changing - by Tass007 - 26.09.2016, 08:48
Re: Interior Vehicle Color Changing - by Dayrion - 26.09.2016, 09:23
Re: Interior Vehicle Color Changing - by Tass007 - 26.09.2016, 09:32
Re: Interior Vehicle Color Changing - by Dayrion - 26.09.2016, 09:34
Re: Interior Vehicle Color Changing - by JaKe Elite - 26.09.2016, 09:38
Re: Interior Vehicle Color Changing - by Tass007 - 26.09.2016, 09:44
Re: Interior Vehicle Color Changing - by JaKe Elite - 26.09.2016, 10:23
Re: Interior Vehicle Color Changing - by Tass007 - 26.09.2016, 10:34
Re: Interior Vehicle Color Changing - by Dayrion - 26.09.2016, 11:29

Forum Jump:


Users browsing this thread: 5 Guest(s)