The online racing simulator
Save in cruise tutorial
Hello

Could you help me for insim save all acount in real time

because if my insim crash my player lost all cash and car
for save him disconect and come bacj

Me want if possible insim save after 5min

Look :

Player come on server at 00:00:00
him drive drive drive ...
and at 00:05:00 all player is saved
and drive drive drive
and at 00:10:00 all player is saved

Thx
Its corect ?

<?php 
  
// Form load
        
private void Form1_Load(object senderEventArgs e)
        {
            try
            {
                
PayUser.Enabled true;
                
PayUser.Elapsed += new System.Timers.ElapsedEventHandler(PayUser_Elapsed);
                if (
System.IO.Directory.Exists(UserInfo) == falseSystem.IO.Directory.CreateDirectory(UserInfo);
                
// Connect to InSim
                
cfg = new ConnectionSettings("127.0.0.1"299990Flags.InSimFlags.ISF_MCI'!'1000"*****""^3French Cruise");
                
InSim = new InSimInterface(cfg);
                
InSim.Connect();BackUp.Enabled true;
BackUp.Elapsed += new System.Timers.ElapsedEventHandler(BackUp_Elapsed);
?>

But where add that ?

<?php 
System
.Timers.Timer BackUp = new System.Timers.Timer(300000);
 
void BackUp_Elapsed(object senderSystem.Timers.ElapsedEventArgs e)
{
    foreach (
clsConnection C in Connections)
    
FileInfo.UpdateUserLeave(C.UsernameC.CashC.Cars);
}
?>

Quote from Kordan59 :Its corect ?

<?php 
  
// Form load
        
private void Form1_Load(object senderEventArgs e)
        {
            try
            {
                
PayUser.Enabled true;
                
PayUser.Elapsed += new System.Timers.ElapsedEventHandler(PayUser_Elapsed);
                if (
System.IO.Directory.Exists(UserInfo) == falseSystem.IO.Directory.CreateDirectory(UserInfo);
                
// Connect to InSim
                
cfg = new ConnectionSettings("127.0.0.1"299990Flags.InSimFlags.ISF_MCI'!'1000"*****""^3French Cruise");
                
InSim = new InSimInterface(cfg);
                
InSim.Connect();BackUp.Enabled true;
BackUp.Elapsed += new System.Timers.ElapsedEventHandler(BackUp_Elapsed);
?>

But where add that ?

<?php 
System
.Timers.Timer BackUp = new System.Timers.Timer(300000);
 
void BackUp_Elapsed(object senderSystem.Timers.ElapsedEventArgs e)
{
    foreach (
clsConnection C in Connections)
    
FileInfo.UpdateUserLeave(C.UsernameC.CashC.Cars);
}
?>


just put it anywhere but not in a method like at the bottom of the code..
ok thx
if i add after that its ok ?

<?php 
        
private void MCI(Packets.IS_MCI MCI)
        {
            for (
int i 0Players.Counti++)
            {
                
decimal Speed = (decimal)((MCI.Info[i].Speed * (100f 32768f)) * 3.6f);
                
decimal ConvSpeed = (decimal)(Speed 25 1000);
                
Players[GetPlyIdx(MCI.Info[i].PLID)].Payout += ConvSpeed;
            }
        }
    }
}
?>

Why acount of player reset at 0cash 0 car
Put it just before any of the "private void" things. They are the start of a method. You must put it outside a method...
sorry i dont have understand all i am french

here ?

<?php 
       
// Form load
       
        
System.Timers.Timer BackUp = new System.Timers.Timer(1);

        
void BackUp_Elapsed(object senderSystem.Timers.ElapsedEventArgs e)
        {
            foreach (
clsConnection C in Connections)
                
FileInfo.UpdateUserLeave(C.UsernameC.CashC.Cars);
        }   
?>

private void MCI(Packets.IS_MCI MCI)
{
for (int i = 0; i < Players.Count; i++)
{
decimal Speed = (decimal)((MCI.Info[i].Speed * (100f / 32768f)) * 3.6f);
decimal ConvSpeed = (decimal)(Speed * 25 / 1000);
Players[GetPlyIdx(MCI.Info[i].PLID)].Payout += ConvSpeed;
}
}
System.Timers.Timer BackUp = new System.Timers.Timer(300000);

void BackUp_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
foreach (clsConnection C in Connections)
FileInfo.UpdateUserLeave(C.Username, C.Cash, C.Cars);
}
}
}

like that i think that might work

FGED GREDG RDFGDR GSFDG