The online racing simulator
Searching in All forums
(62 results)
yoran765
S2 licensed
Hmm never tried your method before will get into it right now Thanks!
LFS_EXTERNAL - IS_CON - Problemo!
yoran765
S2 licensed
Hi!

Been searching round' the forum and noticed that i cant get IS_CON to work with Playernames/Usernames Code i have right now :

private void CON_CarContact(Packets.IS_CON CON)
{
try
{

clsConnection CrashID1 = Connections[GetConnIdx2(CON.A.PLID)];
clsConnection CrashID2 = Connections[GetConnIdx2(CON.B.PLID)];

MsgAll("^2Collision Detected!");


MsgAll("^2Collision: " + Connections[GetConnIdx2(CON.A.PLID)] + " ^2hit " + Connections[GetConnIdx2(CON.B.PLID)] + " ^2 And killed him and raped him");

}
catch { }

}

If i hit somebody it does say collision Detected. But it doesn't show this :

MsgAll("^2Collision: " + Connections[GetConnIdx2(CON.A.PLID)] + " ^2hit " + Connections[GetConnIdx2(CON.B.PLID)] + " ^2 And killed him and raped him");

Any help?

Thanks
yoran765
S2 licensed
Just fixed it... Just a second after posting my thread xD
LFS_External - Cruise Project - Cars Buggy
yoran765
S2 licensed
Hi,

I've been making my own project for fun but i got a problemo

I've updated my version to 1.1.1.7 and ofcourse if you make the buttons too long it will bug out. So for the fix i used this code. :

string TempCars1 = "^7*^2* ^7UF1 ^7XFG ^7XRG ^7LX4";
string TempCars2 = "^7LX6 ^7RB4 ^7FXO ^7XRT ^7RAC ^7FZ5";
string TempCars3 = "^7UFR ^7XFR ^7FXR ^7XRR ^7FZR";
string TempCars4 = "^7MRT ^7FBM ^7FOX ^7FO8 ^7BF1 ^2*^7*";
InSim.Send_BTN_CreateButton(TempCars1, Flags.ButtonStyles.ISB_C1, 4, 45, 0, 49, 9, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton(TempCars2, Flags.ButtonStyles.ISB_C1, 4, 45, 0, 68, 10, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton(TempCars3, Flags.ButtonStyles.ISB_C1, 4, 40, 0, 90, 11, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton(TempCars4, Flags.ButtonStyles.ISB_C1, 4, 40, 0, 110, 12, C.UniqueID, 2, false);

That fixed my problem but now if you have the car it will get highlighted right? Well thats basiclly what everyother cruise server has so this is what i have :

string TempCars1 = "^7*^2* ^7UF1 ^7XFG ^7XRG ^7LX4";
string TempCars2 = "^7LX6 ^7RB4 ^7FXO ^7XRT ^7RAC ^7FZ5";
string TempCars3 = "^7UFR ^7XFR ^7FXR ^7XRR ^7FZR";
string TempCars4 = "^7MRT ^7FBM ^7FOX ^7FO8 ^7BF1 ^2*^7*";
InSim.Send_BTN_CreateButton(TempCars1, Flags.ButtonStyles.ISB_C1, 4, 45, 0, 49, 9, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton(TempCars2, Flags.ButtonStyles.ISB_C1, 4, 45, 0, 68, 10, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton(TempCars3, Flags.ButtonStyles.ISB_C1, 4, 40, 0, 90, 11, C.UniqueID, 2, false);
InSim.Send_BTN_CreateButton(TempCars4, Flags.ButtonStyles.ISB_C1, 4, 40, 0, 110, 12, C.UniqueID, 2, false);
// TempCars 1
if (C.Cars.Contains("UF1"))
{
TempCars1 = TempCars1.Replace("^7UF1", "^2UF1");
}
if (C.Cars.Contains("XFG"))
{
TempCars1 = TempCars1.Replace("^7XFG", "^2XFG");
}
if (C.Cars.Contains("XRG"))
{
TempCars1 = TempCars1.Replace("^7XRG", "^2XRG");
}
if (C.Cars.Contains("LX4"))
{
TempCars1 = TempCars1.Replace("^7LX4", "^2LX4");
}
// TempCars2
if (C.Cars.Contains("LX6"))
{
TempCars2 = TempCars2.Replace("^7LX6", "^2LX6");
}
if (C.Cars.Contains("RB4"))
{
TempCars2 = TempCars2.Replace("^7RB4", "^2RB4");
}
if (C.Cars.Contains("FXO"))
{
TempCars2 = TempCars2.Replace("^7FXO", "^2FXO");
}
if (C.Cars.Contains("XRT"))
{
TempCars2 = TempCars2.Replace("^7XRT", "^2XRT");
}
if (C.Cars.Contains("RAC"))
{
TempCars2 = TempCars2.Replace("^7RAC", "^2RAC");
}
if (C.Cars.Contains("FZ5"))
{
TempCars2 = TempCars2.Replace("^7FZ5", "^2FZ5");
}
// TempCars3
if (C.Cars.Contains("UFR"))
{
TempCars3 = TempCars3.Replace("^7UFR", "^2UFR");
}
if (C.Cars.Contains("XFR"))
{
TempCars3 = TempCars3.Replace("^7XFR", "^2XFR");
}
if (C.Cars.Contains("FXR"))
{
TempCars3 = TempCars3.Replace("^7FXR", "^2FXR");
}
if (C.Cars.Contains("XRR"))
{
TempCars3 = TempCars3.Replace("^7XRR", "^2XRR");
}
if (C.Cars.Contains("FZR"))
{
TempCars3 = TempCars3.Replace("^7FZR", "^2FZR");
}
// TempCars 4
if (C.Cars.Contains("MRT"))
{
TempCars4 = TempCars4.Replace("^7MRT", "^2MRT");
}
if (C.Cars.Contains("FBM"))
{
TempCars4 = TempCars4.Replace("^7FBM", "^2FBM");
}
if (C.Cars.Contains("FOX"))
{
TempCars4 = TempCars4.Replace("^7FOX", "^2FOX");
}
if (C.Cars.Contains("FO8"))
{
TempCars4 = TempCars4.Replace("^7FO8", "^2FO8");
}
if (C.Cars.Contains("BF1"))
{
TempCars4 = TempCars4.Replace("^7BF1", "^2BF1");
}

But the cars are not lighting up! I tryed again by removing the ** ** at the front and the end but its still not working...

I really need help with this, this has been bugging me for ages! :P

Thanks!

Yoran
yoran765
S2 licensed
That helped ALOT! I've finally figured it out but i think the best for me is to switch over to Insim.net and understand Dizplay source Thanks alot!
yoran765
S2 licensed
Quote from DarkKostas :Obviously UCID does not exist! Take a look at how packet works. You can always check Insim.txt at your lfs/docs folder.


struct CarContact // 16 bytes : one car in a contact - two of these in the IS_CON (below)
{
byte PLID;
byte Info; // like Info byte in CompCar (CCI_BLUE / CCI_YELLOW / CCI_LAG)
byte Sp2; // spare
char Steer; // front wheel steer in degrees (right positive)

byte ThrBrk; // high 4 bits : throttle / low 4 bits : brake (0 to 15)
byte CluHan; // high 4 bits : clutch / low 4 bits : handbrake (0 to 15)
byte GearSp; // high 4 bits : gear (15=R) / low 4 bits : spare
byte Speed; // m/s

byte Direction; // car's motion if Speed > 0 : 0 = world y direction, 128 = 180 deg
byte Heading; // direction of forward axis : 0 = world y direction, 128 = 180 deg
char AccelF; // m/s^2 longitudinal acceleration (forward positive)
char AccelR; // m/s^2 lateral acceleration (right positive)

short X; // position (1 metre = 16)
short Y; // position (1 metre = 16)
};

struct IS_CON // CONtact - between two cars (A and B are sorted by PLID)
{
byte Size; // 40
byte Type; // ISP_CON
byte ReqI; // 0
byte Zero;

word SpClose; // high 4 bits : reserved / low 12 bits : closing speed (10 = 1 m/s)
word Time; // looping time stamp (hundredths - time since reset - like TINY_GTH)

CarContact A;
CarContact B;
};


Thanks for replying so fast and i already tyed PLID but still. Errors
yoran765
S2 licensed
Seeing what i've done wrong i've started to look upon things. What did come upon me is that i have no sence of coding what so ever. I've added the IS_CON as a event and made a private void for it. Gotten everything to work but then came upon a problem again. Ill show you what i have so far.

private void CON_Contact(Packets.IS_CON CON)
{
try
{
clsConnection Conn = Connections[GetConnIdx(CON.UCID)].PlayerName;
clsConnection Conn2 = Connections[GetConnIdx(Connections[CON.UCID].PlayerNameHit)];
}
catch { }
}

Error:

Error 1 'LFS_External.Packets.IS_CON' does not contain a definition for 'UCID' and no extension method 'UCID' accepting a first argument of type 'LFS_External.Packets.IS_CON' could be found (are you missing a using directive or an assembly reference?) C 1875 65 OC Insim

Any ideas? Thanks!

Yoran
Car Detection - Object Detection - LFS_EXTERNAL
yoran765
S2 licensed
Hello,

I'm working on an C# LSgO Based Cruise insim but was thinking...
How do you actually detect car collisions? (Car to Car) Or Object Detection?
And if their is a way to do this could i have an example?

Thanks,

Yoran
yoran765
S2 licensed
Just fixed the problem. I was debugging the project in C# 2008. Then i decided to upgrade my version to 2010 and everything worked :P Anyways thanks for all the help i recieved
yoran765
S2 licensed
Warning 7 Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'C:\Users\Yoran\Desktop\Dizplay Cruise v0.2\Dizplay Cruise\InSimDotNet.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Dizplay Cruise


Anyhelp?
yoran765
S2 licensed
I have no idea what you just said :/ I have everything added...
InSimDOTNet Errors?
yoran765
S2 licensed
Hi,

I have downloaded a example for Insim.NET Then got these errors :

Warning 1 The referenced component 'InSimDotNet' could not be found.

Warning 2 The referenced component 'Microsoft.CSharp' could not be found.

Error 5 The type or namespace name 'InSimDotNet' could not be found (are you missing a using directive or an assembly reference?)

Alot of wierd errors any help? Thanks
BTT.TEXT Error. (Dougie Cruise Base)
yoran765
S2 licensed
Hi,

I was making a "Withdraw" button so if you click on it it will display That you have to put in a number lower then 10000 to Withdraw.

This is what the Case looks like :


<?php 
case 166// Withdraw
                        
{
                            
int Withdraw int.Parse(BTT.Text);
                            if (
BTT.Text.Contains("-"))
                            {
                                
InSim.Send_MTC_MessageToConnection("^6»^7 Witdraw Error. Please don't use minus values!"BTC.UCID0);
                            }
                            if (
Withdraw 10001)
                            {
                                
InSim.Send_MTC_MessageToConnection("^6»^7 Maximum Withdraw of ^2$10000^7!"BTC.UCID0);
                            }
                            else
                            {
                                if (
Connections[GetConnIdx(BTC.UCID)].TotalBankCash Withdraw)
                                {

                                    
Connections[GetConnIdx(BTC.UCID)].TotalBankCash -= Withdraw;
                                    
Connections[GetConnIdx(BTC.UCID)].Cash += Withdraw;
                                    
InSim.Send_MTC_MessageToConnection("^6»^7 You have succesfully withdrawn ^2$" Withdraw " ^7from the bank."BTC.UCID0);
                                    
InSim.Send_BTN_CreateButton("^7Your bank balance is ^2$" Connections[GetConnIdx(BTC.UCID)].TotalBankCashFlags.ButtonStyles.ISB_LEFT4406554163BTC.UCID2false);
                                }
                                else
                                {
                                    
InSim.Send_MTC_MessageToConnection("^6»^7 You don't have enough cash to complete the transaction."BTC.UCID0);
                                }
                            }
                        }
                        break;
?>

Problem is i get an error code at

<?php 
int Withdraw 
int.Parse(BTT.Text);
                            if (
BTT.Text.Contains("-"))
?>

Witch is :

<?php 
Error 1 The name 
'BTT' does not exist in the current context
?>


I am not sure how to fix it but this is needed

Any help? Thanks!
yoran765
S2 licensed
Quote from hyntty :Just seeing a couple of lines of code that really do not have that much to do with each other one can only guess... I take it that you are using some ready-made base? Perhaps you should tell us what it is, then people who know how that particular program code works can help you more

The "Index and length must refer to a location within the string" error means that you are trying to parse a substring out of a longer string but the substring's start and/or end indexes are out of bounds. An example would be to for example try and get the first four letters of the word "egg" - that's not going to work for obvious reasons.

I would start looking for string parsing action in GetUserTotalBankCash as that is the line that causes the error and check that it parses strings correctly.

I think i get we're you are going Well im using the Cruise base by dougie-lampkin. But i do think i know we're you are going and ill solve it my self

Thanks for the help i really appreciate it
!deaddmember Command Help
yoran765
S2 licensed
Hi,

I am wanting to make a !deaddmember command and i currently have this. But it is not working :s Any help?


<?php 
case "!deaddmember":
                        if (
StrMsg.Length 1)
                        {
                            if (
Connections[GetConnIdx(MSO.UCID)].IsAdmin == 1)
                            {
                                
StreamReader ApR = new StreamReader(UserInfo "\\groups\\member.txt");
                                
string TempAPR ApR.ReadToEnd();
                                
ApR.Close();
                                
StreamWriter Ap = new StreamWriter(UserInfo "\\groups\\member.txt");
                                
Ap.Write(TempAPR "Member = None");
                                
Ap.Flush();
                                
Ap.Close();
                                
InSim.Send_MST_Message("/msg ^2-^7 " Msg.Remove(011) + " has been removed from ^2member");
                                foreach (
clsConnection C in Connections)
                                {
                                    if (
C.Username == Msg.Remove(011))
                                    {
                                        
C.IsMember 0;
                                    }
                                }
                            }
                            else
                            {
                                
InSim.Send_MTC_MessageToConnection("^1You are not allowed to use this command!"MSO.UCID0);
                            }
                        }
                        break;
?>

yoran765
S2 licensed
Ok not solved please give me some help! :s I just found out when i added :


<?php 
NewConn
.TotalBankCash FileInfo.GetUserTotalBankCash(NCN.UName);
?>

It gives the error any help?
yoran765
S2 licensed
Solved!
Wierd Error :S Help?
yoran765
S2 licensed
Hi,

I have added a new Bank Cash system but when i started to script i got alot of errors. Finally i have found the solution to what was cousing the errors. I dident add something in clsConnection.cs witch was this:

public long Cash
{
get { return _cash; }
set { _cash = value; }
}

After i entered this i got no errors. But when compiling i get this error when launching the InSim:

NCN - Index and length must refer to a location within the string. Parameter name : length

Anyhelp? Thanks
yoran765
S2 licensed
Quote from dawesdust_12 :Hi Yoran:

After quickly looking online, 300 is out of range for a byte. in C#, a byte can contain the values from 0 - 255. Is there another method that's overloaded that accepts a different type such as int (By the looks of the error, this isn't the case.) Furthermore, if this is the LFS "ClickId" (I'm unsure as I haven't used LFS_External -- but it's a reasonable guess), LFS limits this value between 0 - 239.

Also, LFS External is pretty old and outdated (and abandoned as well AFAIK). It might be worthwhile (if you have the programming knowledge and ability) to port it from LFS External to a different Insim base.

Hope this all helps

Thanks for the quick reply! Well i don't really have any programming knowledge but i guess i have to use less then 255 then Anyways thanks!
LsGO InSim UniqueID Help
yoran765
S2 licensed
(MOVE IF IN WRONG SECTION)

Hi,

I have recently wanted to make a Cruise Insim with a LsGO base. Then i encounterd a problem. For example :
InSim.Send_BTN_CreateButton("^7Welcome to ^5Kinder^7Garten", Flags.ButtonStyles.ISB_LIGHT, 7, 98, 51, 51, 132, Conn.UniqueID, 2, false);

As you can see the id is 132. In the LsGO InSim when i type this :
InSim.Send_BTN_CreateButton("^7Welcome to ^5Kinder^7Garten", Flags.ButtonStyles.ISB_LIGHT, 7, 98, 51, 51, 300, Conn.UniqueID, 2, false);

300 Or above it gives me a error :
The best overloaded method match for 'LFS_External.InSim.InSimInterface.Send_BTN_CreateButton(string, LFS_External.InSim.Flags.ButtonStyles, byte, byte, byte, byte, byte, byte, byte, bool)' has some invalid arguments

Argument 7: cannot convert from 'int' to 'byte'

and what im trying to figure out is how to get the ID higher then 300, i couldent find a way to do this so that's why i am asking help on the forums. Thanks!
Yoran
Last edited by yoran765, .
yoran765
S2 licensed
Gah! Was to busy fixing my code with your code so couldent say thanks. Anyways thanks beav for the code Helped me alot
yoran765
S2 licensed
Not gana make a new topic but what about adding Random jobs like now i only have it set to one place? Any help Beav?
yoran765
S2 licensed
I now get a error code :
Quote :Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement

CancelJob Command Help!
yoran765
S2 licensed
Hello guys i was making a cruise insim for fun and editing stuff in it. And i was thinking how can i make a CancelJob command? Im using C# And the code i got now is
[Command("canceljob", "canceljob")]
public void canceljob(string Msg, string[] StrMsg, Packets.IS_MSO MSO)
{
clsConnection Conn = Connections[GetConnIdx(MSO.UCID)];
if (StrMsg.Length > 0)
{
if (Conn.JobToHouse2 == 1)
{
(Conn.JobToHouse2 == 0);
InSim.Send_MTC_MessageToConnection("^6--^7 Job Canceled!", MSO.UCID, 0);
}
}
}

if this is correct or wrong can you correct me? Thanks and i know this is wrong but i need help ;(
yoran765
S2 licensed
Quote from Bass-Driver :did u fill in the correct IP adress and serveradminpass??

Yes but still doesent work
FGED GREDG RDFGDR GSFDG