This Weird or Fixable?
#3

So you want it to printf proceed every time car loads or you just want to printf when ever the Cartime is called?

Here's how you do it if you want it to print when ever Cartime is called:
Код:
public Cartime()
{
    new bool:vehicleused[MAX_VEHICLES];
    foreach (new x : Player)
    {
        if(IsPlayerConnected(x) && IsPlayerInAnyVehicle(x))
        {
            vehicleused[GetPlayerVehicleID(x)] = true;
        }
    }
    for(new i=1; i <= MAX_CAR; i++)
    {
        if(CarInfo[Carid[i]][cType] == 3)
        {
             if(CarInfo[Carid[i]][cTime] <= 1 && strcmp(CarInfo[Carid[i]][cOwner], "None", true))
            {
                strmid(CarInfo[Carid[i]][cOwner], "None", 0, strlen("None"), 255);
                SetVehicleToRespawn(Carid[i]);
                CarInfo[Carid[i]][cTime] = 0;
            }
            if(CarInfo[Carid[i]][cTime] > 0)
            {
                CarInfo[Carid[i]][cTime] --;
            }
               if(!vehicleused[i] && !strcmp(CarInfo[Carid[i]][cOwner], "None", true))
            {
                SetVehicleToRespawn(i);
            }
        }
    }
    print("proceed"); 
}
And if you want it to print on the loop. just use this one:

Код:
public Cartime()
{
    new bool:vehicleused[MAX_VEHICLES];
    foreach (new x : Player)
    {
        if(IsPlayerConnected(x) && IsPlayerInAnyVehicle(x))
        {
            vehicleused[GetPlayerVehicleID(x)] = true;
        }
    }
    for(new i=1; i <= MAX_CAR; i++)
    {
        if(CarInfo[Carid[i]][cType] == 3)
        {
             if(CarInfo[Carid[i]][cTime] <= 1 && strcmp(CarInfo[Carid[i]][cOwner], "None", true))
            {
                strmid(CarInfo[Carid[i]][cOwner], "None", 0, strlen("None"), 255);
                SetVehicleToRespawn(Carid[i]);
                CarInfo[Carid[i]][cTime] = 0;
            }
            if(CarInfo[Carid[i]][cTime] > 0)
            {
                CarInfo[Carid[i]][cTime] --;
            }
               if(!vehicleused[i] && !strcmp(CarInfo[Carid[i]][cOwner], "None", true))
            {
                SetVehicleToRespawn(i);
                print("proceed");  
            }
        }
    }

}
OR if you want it to show max vehicle on printf, just do

Код:
public Cartime()
{
    new bool:vehicleused[MAX_VEHICLES];
    new VehicleSpawnedCount;
    foreach (new x : Player)
    {
        if(IsPlayerConnected(x) && IsPlayerInAnyVehicle(x))
        {
            vehicleused[GetPlayerVehicleID(x)] = true;
        }
    }
    for(new i=1; i <= MAX_CAR; i++)
    {
        if(CarInfo[Carid[i]][cType] == 3)
        {
             if(CarInfo[Carid[i]][cTime] <= 1 && strcmp(CarInfo[Carid[i]][cOwner], "None", true))
            {
                strmid(CarInfo[Carid[i]][cOwner], "None", 0, strlen("None"), 255);
                SetVehicleToRespawn(Carid[i]);
                CarInfo[Carid[i]][cTime] = 0;
            }
            if(CarInfo[Carid[i]][cTime] > 0)
            {
                CarInfo[Carid[i]][cTime] --;
            }
               if(!vehicleused[i] && !strcmp(CarInfo[Carid[i]][cOwner], "None", true))
            {
                SetVehicleToRespawn(i);
                VehicleSpawnedCount++;
            }
        }
    }
    printf("max vehicle respawned: %d",  VehicleSpawnedCount);  
}
Not tested.
Reply


Messages In This Thread
This Weird or Fixable? - by SequenceCuz - 07.12.2014, 00:19
Re: This Weird or Fixable? - by SequenceCuz - 07.12.2014, 01:32
Re: This Weird or Fixable? - by SkyCloud - 07.12.2014, 02:11
Re: This Weird or Fixable? - by SequenceCuz - 07.12.2014, 02:33
Re: This Weird or Fixable? - by SequenceCuz - 07.12.2014, 03:22

Forum Jump:


Users browsing this thread: 1 Guest(s)