25.06.2014, 08:37
You'd better use this.
It doesn't use time to add Kilos, It use the distance, And it will be more useful then timer.
This will load the Kilos, But you must create the file.ini.
It doesn't use time to add Kilos, It use the distance, And it will be more useful then timer.
pawn Код:
public timer1seconde(i)
{
if(IsPlayerInAnyVehicle(i)) // Player In Any vehicle
{
// Calculate the distance made by the vehicle
new vid = GetPlayerVehicleID(i);
CarInfoX[vid][cxMetre] += (vitesse[i]*10)/36;
if(CarInfoX[vid][cxMetre] > 999)
{
CarInfoX[vid][cxKilometre] += 1;
CarInfoX[vid][cxMetre] = 0;
}
}
return 1;
}
pawn Код:
public LoadKilo()
{
new file[32];
for(new idx = 1; idx < sizeof(CarInfoX) ; idx++)
{
format(file, sizeof(file),"vehicules/%d.ini", idx);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Metres",CarInfoX[idx][cxMetre]);
dini_IntSet(file, "Kilometres",CarInfoX[idx][cxKilometre]);
}
CarInfoX[idx][cxMetre] = dini_Int(file,"Metres");
CarInfoX[idx][cxKilometre] = dini_Int(file,"Kilometres");
}
print("[SCRIPT]: Kilometres Vehicles");
return 1;
}