The online racing simulator
Need some help with Cruise InSim.
Hello. I found the Open Source cruise insim which is downloadable in this forum. Original thread for that cruise http://www.lfsforum.net/showthread.php?p=1683389 I fixed the most bugs and finished commands etc. But there is one big problem which I cant fix. Sometimes when somone connects it connects like other player in server and got all his stats from user file. There is also that bug that for example Johny (player1) writes !showoff but in chat log it shows that Johny (player2) has these stats and it shows even the players which are disconnected a while ago. Anyone can help me with that? Im thinking about packet that it doesnt works right and that when player disconnect it doesnt delete him from player list. Hope someone can help me
Anyone can help?
Sorry for triple post. Now I realised that the InSim doesnt delete players from playerlist when player disconnects. WHen in server there are 8 connections and I write !reinit command which I added to this cruise from my old InSim it shows that there are more in my case it showed 38 connections.
Have you got something to recognize that the player has left?

In your CNL statement you should have something like this.

RemoveFromConnectionsList(CNL.UCID);


If you do have that in the statement please send us your current CNL statement so we can see why it must not be working.

Oh and the reinit command will not shutoff the insim it puts it to sleep for a few seconds then makes it show again so that will not help with trying to get players out of the connection list.
Cnl
Here is my CNL code.


<?php 
// A client left the server.
        
private void CNL_ClientLeavesHost(Packets.IS_CNL CNL)
        {
            try
            {
                
clsConnection Conn Connections[GetConnIdx(CNL.UCID)];
                
clsConnection Conn2 Connections[GetConnIdx(Connections[CNL.UCID].Chasee)];

                
MsgAll("^6»^7 " Conn.PlayerName " ^7(" Conn.Username ") disconnected.");

                
#region ' Robbery Goes to PITS '
                
if (Conn.UniqueID == RobberUCID && RobInChase == 1)
                {
                    
Conn.RobTimerActiv 0;
                    
MsgAll("^6»^7 " Conn.PlayerName " ^7was fined ^1$" RobCash);
                    
MsgAll("^6»^7 REASON: Escaping from the police!");
                    
Conn.Cash -= RobCash;
                    
RobTimers 0;
                    
BankTimer.Enabled false;
                    
BankTimer.Stop();
                    
RobInChase 0;
                    
IsRobbable false;
                    
RobberUCID = -1;
                }
                
#endregion

                #region ' Specting whilst suspect being Chased '
                
if (Conn.Chasee != -1)
                {
                    
MsgAll("^6»^7 " Conn.PlayerName "^7 lost " Conn2.PlayerName "^7!");
                    if (
Conn.IsCadet == 1)
                    {
                        
MsgAll("^6»^7 " Conn.PlayerName " was fined ^1$300");
                        
MsgAll("^6»^7 Reason: Losing the chase on Track!");
                        
Conn.Cash -= 300;
                    }
                    
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN19Conn.UniqueID);
                    
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN20Conn.UniqueID);
                    
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN20Conn2.UniqueID);
                    
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN21Conn.UniqueID);
                    
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN22Conn.UniqueID);
                    
#region ' Check UCID '
                    
foreach (clsConnection C in Connections)
                    {
                        if (
C.Chasee == Conn.UniqueID)
                        {
                            
C.Chasee = -1;
                            
C.ChaseePlayerName "";
                            
C.ChaseeUsername "";
                            
C.Busted 0;
                            
C.ChaseCondition 0;
                            
C.CTimer 0;
                            
C.InChaseOrNot 0;
                        }
                        if (
C.Username == Conn.JoinedBackupUsername)
                        {
                            
C.BackupCallerUsername "";
                        }
                        if (
C.Username == Conn.BackupCallerUsername)
                        {
                            
C.JoinedBackupUsername "";
                        }
                    }
                    
#endregion
                    
Conn2.IsBeingChased 0;
                    
Conn.InChaseOrNot 0;
                    
Conn.ChaseePlayerName "";
                    
Conn.ChaseeUsername "";
                    
Conn.Chasee = -1;
                    
Conn.ChaseCondition 0;
                    
Conn.JoinChase 0;
                    
Conn.CTimer 0;
                    
SirenShutsOff();
                }
                
#endregion

                #region ' Suspect Spected whilst being Chased '
                
if (Conn.IsBeingChased == 1)
                {
                    
MsgAll("^6»^7  " Conn.PlayerName " ^7was fined ^1$700");
                    
MsgAll("^6»^7 Reason: Leaving as Suspect whilsts Being chased!");
                    
Conn.Cash -= 700;
                    
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN20Conn.UniqueID);
                    foreach (
clsConnection C in Connections)
                    {
                        if (
C.Chasee == Conn.UniqueID)
                        {
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN19C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN20C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN21C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN22C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN23C.UniqueID);
                            
C.Chasee = -1;
                            
C.ChaseeUsername "";
                            
C.ChaseePlayerName "";
                            
C.ChaseCondition 0;
                            
C.InChaseOrNot 0;
                            
C.JoinChase 0;
                            
C.CTimer 0;
                        }
                    }
                    
Conn.IsBeingChased 0;
                    
SirenShutsOff();
                }
                
#endregion

                #region ' Busted Ran Away '
                
if (Conn.BustedRanAway == 1)
                {
                    foreach (
clsConnection C in Connections)
                    {
                        if (
C.Username == Conn.OfficerUsername)
                        {
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN39C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN40C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN41C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN42C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN43C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN44C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN45C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN46C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN47C.UniqueID);
                            
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN48C.UniqueID);
                            
C.OpenBustedBox 0;
                            
C.BustedUsername "";
                            if (
C.Chasee != -1)
                            {
                                if (
C.Chasee == Conn.UniqueID)
                                {
                                    
Conn.Chasee = -1;
                                    
Conn.ChaseCondition 0;
                                }
                            }
                        }
                    }
                    if (
Conn.AcceptFines == 1)
                    {
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN39Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN40Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN41Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN42Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN43Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN44Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN45Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN46Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN47Conn.UniqueID);
                        
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_BTN48Conn.UniqueID);
                        
Conn.AcceptFines 0;
                    }
                    
MsgAll("^6»^7 " Conn.PlayerName " ^7runs away but fined ^1$1800");
                    
Conn.OfficerUsername "";
                    
Conn.Cash -= 1800;
                    
Conn.BustedRanAway 0;
                }
                
#endregion

                #region ' Account Reset Issue '
                
if (AccountReset == false)
                {
                    foreach (
clsConnection C in Connections)
                    {
                        if (
C.FailCon == 0)
                        {
                            
FileInfo.UpdateUserLeave(C);
                        }
                    }
                }
                if (
AccountReset == true)
                {
                    
AccountReset false;
                }
                
#endregion

                
RemoveFromConnectionsList(CNL.UCID);        // Update Connections[] list

            
}
            catch { }
        }
?>

Anything wrong here? Atleast I couldn`t find that anything is wrong there. Really need help with this one and I would be grateful if you all will be more interested in my problem.

FGED GREDG RDFGDR GSFDG