Help - 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: Help (
/showthread.php?tid=521908)
Fixed. -
Edw - 25.06.2014
Fixed.
Re : Help -
Clad - 25.06.2014
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.
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;
}
This will load the Kilos, But you must create the file.ini.
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;
}