The online racing simulator
Can you post the whole critical section of the code? It's hard to get anything from the screenshot.
Are you sure these coordinates are correct? And the InSim app you use be using it's own coords system different from the one LFS uses?
Why are you dividing with that weird numer? Dividing by 65536 converts to meters, not sure what 196608 is for...
Quote from MadCatX :65536

I stand corrected. I was never sure which was correctly a meter, but I know the other is used throughout most peoples applications.

Like MadCatX, I also smell more fail code than is being presented....
X Y Pos x 196608 divided by 65536 thats the meaning of 196608

I hate maths when im developing a insim -.-

E: @psysim: It wasn't fail code its only dividing the correct numbers to get a XY Pos
What's wrong with maths? It makes your programs look all complex and cool (ok, probably not)

196608 / 65536 is three, so that app uses just 3 metres precision.

Can you post the whole " if(coords check) { do stuff } " part? I bet you have something wrong with condition.
probably i have wrong thing on my post probably.

bcuz coding XY Precisions maps are the thing I don't like it

if ((MCI.Info[i].X / 196608) <= -203) && ((MCI.Info[i].Y / 196608) <= -63)

but i assume its dividing the codes inside of it (too bad im not using LFS External anymore im using spark )

E: it was using 3 meter instance
yeah, I knew / 196608 was ok, it was the other bit i was looking at....

It looked like (at the time) he had inverted his '<' and '>' resulting in everywhere but that location. I was half asleep when I was reading it.
many thanks to all, I made it work, it really is easy, photos:
http://ad-images.com/images/working1kek.jpg
http://ad-images.com/images/working2.jpg
My problem was simply that did not respect the right order ( (((MCI.Info[i].X / 196608) >= MINOR VALUE) && ((MCI.Info[i].X / 196608) <= HIGHER VALUE) && ((MCI.Info[i].Y / 196608) >= MINOR VALUE) && ((MCI.Info[i].Y / 196608) <= HIGHER VALUE) LOL
Just the only thing I need is to figure out how I can connect the workplace to work properly.
And that ^^ was what I was getting at

Quote from Psysim :
<= -118 and >= -119

I may be wrong, im half asleep... but they are the wrong way around? Oh, and '/ 196608' that you underlined it correct, it belongs there. You are deviding into meters I believe.

Good job... and good luck!

And as in work place you mean track?
What do you mean? I do not understand English very well
Quote from manza47 :
Just the only thing I need is to figure out how I can connect the workplace to work properly.

I was asking about this ^^
in - values

> lower & < higher eg. >= -45 && <= -43

in more than values
> lower & higher eg. >= 43 && <= 45

thats MCI XY doing ^^
Quote from Psysim :I was asking about this ^^

exact, i haven't a idea how to accomplish the following: in a place gives the order to delivery to another specific place and win cash $$ xD. (For example, sending a package from home "A " to the house "B")
Quote from manza47 :exact, i haven't a idea how to accomplish the following: in a place gives the order to delivery to another specific place and win cash $$ xD. (For example, sending a package from home "A " to the house "B")

ok, you wish to set the X and Y co-ords of the job destination?

If that is correct I would assume the 'place' could be maybe a shop? In the MCI class, under the bit that should say 'Switch' and 'TrackName', you should find a destination? It could be on one of the other tracks 'case SOXX:'

Without actually seeing your code, that is as far as I think anyone could help.
Quote from manza47 :exact, i haven't a idea how to accomplish the following: in a place gives the order to delivery to another specific place and win cash $$ xD. (For example, sending a package from home "A " to the house "B")

There is a plenty of ways how to do this, I'd personally prefer this approach.

1) Create a class CPlayersJob with 4 properties - PLID, reward, xPos, yPos. PLID and reward are self-explanatory, xPos and yPos will hold the coordinates of the destination - where the player has to arrive to complete the job.
2) Create a List<CPlayersJob> and when a player gets a job, add a new CPlayersJob object with correct properties to the list.
3) When an MCI packet arrives, iterate through the list of jobs and check if any player has reached his target destination. If he did, give him the reward and remove the job from the list.

This approach can be improved in several ways, i.e. you could use a Dictionary<PLID, CPlayersJob> instead of List to simplify things and speed your program up a bit...
My knowledge of C# is limited though, so there might be few issues I didn't think of.
Thanks for the info, I'll see what I can do, I hope I was not complicated.
Is there something in particular you don't understand or are you just unfamiliar with Object Oriented Programming? I can provide you with some sample code if you'd like, perhaps it could explain better what I had in mind...
I'm trying but it's more complicated than I thought I'm wrong all the code :gnasher:
It would be excellent to give me an example of the code so I can I edit in terms of names and coordinates to prove it works.
The code I can provide will certainly need some adjustments, but I hope you'll get the idea behind "Giving player a job and checking if he has completed it"

First is the CPlayersJob class which defines a job. It defines job as a X/Y coords player has to reach and a reward he gets.

class CPlayersJob
{
public int xCoord, yCoord; //Coordinates of the target destination which player has to reach to complete the job
public int plid; //PLID of the player this job is assigned to
public int reward; //How much money the player gets after completing the job
public bool isFinished = false; //Set to "true" when the job is finished

CPlayersJob(int in_xCoord, int in_yCoord, int in_plid, int in_reward)
{
xCoord = in_xCoord;
yCoord = in_yCoord;
plid = in_plid;
reward = in_reward;
}

/** Checks if the player is at the target destination.
Returns "true" if he is, otherwise returns "false".
Input parameters are coordinates of the player's car.
It also marks the job as finished when the target dest. is reached.
*/
bool IsDestinationReached(int in_xCoord, in_yCoord)
{
if((in_xCoord == xCoord) && (in_yCoord == yCoord))
{
isFinished = true;
return true;
}
return false;
}
}

This is a method you'll probably want to call to give player a job. I'd have to have access to the full source of your application to be more specific about it, but I guess you'll figure out how to use it.

/** Call this method to give player a job. This method will add a new CPlayersJob object
to the activeJobs list. "targetX/YCoords" are coordinates of the destination the player
has to reach to complete the job, plid is player's PLID.
*/
void givePlayerAJob()
{
activeJobs.Add(new CPlayersJob(targetXCoord, targetYCoord, plid, reward));
}

And finally the code you'll want to add to your applications main loop (you know what I mean by "main loop", right?).


/*Boatload of other variables and stuff
...
*/

List<CPlayersJob> activeJobs = new List<CPlayersJob>(); //A list of all active jobs

mainLoop()
{
/*Lots of other stuff your application does
...
...
*/

//Check if any player completed his job
foreach(Info i in MCI.Info) //Iterate through all players
{
int plrId = i.PLID; //Get player's PLID
int x = i.X / 196608;
int y = i.Y / 192608;

foreach(job in activeJobs) //Iterate through all currently active jobs
{
if(job.plid == plrId) //Check if a job is assigned to a player we're processing
{
if(job.IsDestinationReached(x, y)) //Check if a player is at the target destination
{
//He is, reward him.
givePlayerAReward(job.reward); //I don't know how your application handles money, so you'll want to change this
}
}
}

//Remove all finished jobs
activeJobs.RemoveAll(JobIsFinished);
}

/** Predicate that checks if a job is finished or not.
You need to have this to make use of "RemoveAll" method provided by List.
*/
private static bool JobIsFinished(CPlayersJob job)
{
if(job.isFinished)
{
return true;
}
return false;
}

I'm nowhere near a C# compiler so I cannot test anything of this. I might be wrong about few things, but I'm sure that other folks on the forum with more C# knowledge will help you out if something doesn't work...

(really, can anyone actually check out this code? I don't want to confuse manza with some s**t I didn't bother to test)
Woow, it is more difficult than I thought, I changed some parameters of the coordinates, award, and others, but it still fails in some lines. I can not reach completion.
Can you post the parts of code that fail to compile and the error messages you get? It should not be that hard to get it working...
ok i just found my old LFS External cruise I made

here's how jobs work out


<?php 
                            int House5Dist 
= ((int)Math.Sqrt(Math.Pow(Conn.CompCar.- (-12 196608), 2) + Math.Pow(Conn.CompCar.- (-113 196608), 2)) / 65536);
                            if (
House5Dist && (Conn.CompCar.Speed 147) <= 3)
                            {
                                if (
Conn.InHouse5 == 0)
                                {
                                    
#region ' Jobs Completed '
                                    
if (Conn.JobFromShop == 1)
                                    {
                                        if (
Conn.JobToHouse1 == 1// Gonsalez
                                        
{
                                            
InSim.Send_MTC_MessageToConnection("^6»^7 You have picked the wrong house to Deliver!"Conn.UniqueID0);

                                        }
                                        if (
Conn.JobToHouse2 == 1// Kayla's
                                        
{
                                            
InSim.Send_MTC_MessageToConnection("^6»^7 You have picked the wrong house to Deliver!"Conn.UniqueID0);
                                        }
                                        if (
Conn.JobToHouse3 == 1// Rodes's
                                        
{
                                            
InSim.Send_MTC_MessageToConnection("^6»^7 You have picked the wrong house to Deliver!"Conn.UniqueID0);
                                        }
                                        if (
Conn.JobToHouse4 == 1// Joana's
                                        
{
                                            
InSim.Send_MTC_MessageToConnection("^6»^7 You have picked the wrong house to Deliver!"Conn.UniqueID0);
                                        }
                                        if (
Conn.JobToHouse5 == 1// Mika's
                                        
{
                                            
MsgAll("^6»^7 " Conn.PlayerName " ^7Completed a ^2Job^7!");
                                            
int prize = new Random().Next(100300);
                                            
MsgAll("^6»^7 " Conn.PlayerName " ^7Earns ^2$" prize "^7!");
                                            
Conn.Cash += prize;
                                            
Conn.JobsDone += 1;
                                            
Conn.JobFromShop 0;
                                            
Conn.JobToHouse5 0;
                                        }
                                    }
                                    
#endregion

                                    #region ' Jobs '
                                    
if (Conn.IsOfficer == && Conn.IsCadet == && Conn.IsMafia == && Conn.IsTowTruck == 0)
                                    {
                                        if (
Conn.IsBeingChased == && Conn.UniqueID != RobberUCID)
                                        {
                                            if (
Conn.CurrentCar == "UFR" || Conn.CurrentCar == "XFR" || Conn.CurrentCar == "FXR" || Conn.CurrentCar == "XRR" || Conn.CurrentCar == "FZR" || Conn.CurrentCar == "MRT" || Conn.CurrentCar == "FBM" || Conn.CurrentCar == "FO8" || Conn.CurrentCar == "FOX" || Conn.CurrentCar == "BF1")
                                            {
                                                
InSim.Send_MTC_MessageToConnection("^6»^7 Jobs can be done only in Roadcars!"Conn.UniqueID0);
                                            }
                                            else if (
Conn.JobToHouse1 == || Conn.JobToHouse2 == || Conn.JobToHouse3 == || Conn.JobToHouse4 == || Conn.JobToHouse5 == || Conn.JobToSchool == 1)
                                            {
                                                
InSim.Send_MTC_MessageToConnection("^6»^7 You can only do 1 Job at a time!"Conn.UniqueID0);
                                            }
                                            else
                                            {
                                                
InSim.Send_MTC_MessageToConnection("^1»^2 !job ^7- Escort Mika's Children to KinderGarten!"Conn.UniqueID0);
                                            }
                                        }
                                        else
                                        {
                                            
InSim.Send_MTC_MessageToConnection("^6»^7 Can't Take a Job whilst Being Chased!"Conn.UniqueID0);
                                        }
                                    }
                                    else
                                    {
                                        
InSim.Send_MTC_MessageToConnection("^6»^7 Can't take a Job while in Active Duties!"Conn.UniqueID0);
                                    }
                                    
#endregion

                                    
Conn.InHouse5 1;
                                }
                            }
                            else if (
House5Dist 14 && Conn.InHouse5 == 1)
                            {
                                
Conn.InHouse5 0;
                            }
                            
?>

this code is used to be unreleased in LifeStyle Gamers Organization Cruise (known as LsC before the original owner closed it)

E: geez why Cruise server with jobs this is not fun anymore think other features not like this im obsessed with other cruise server with jobs feature
now i understand. correct me if I'm wrong

Editing the coordenates x/y of:

int House5Dist = ((int)Math.Sqrt(Math.Pow(Conn.CompCar.X - ([COLOR="Red"]-12[/COLOR] * 196608), 2) + Math.Pow(Conn.CompCar.Y - ([COLOR="red"]-113 [/COLOR]* 196608), 2)) / 65536);
if (House5Dist < 4 && (Conn.CompCar.Speed / 147) <= 3)

would have the starting point of the job, only have to define other destinations (defined with coordinates) with names Conn.JobToHouse1, Conn.JobToHouse2, etc?
Conn.JobToHouse1 or 2 u must make it in clsConnection

and the XY that you pointed must be located

like in the image showing the X Y on my display which we're the car positioned

btw, you should learn it by yourself C# coding is easy and the image showed is not the base your using its a converted spark insim as far as you know
Attached images
positioned in pizza.png
I tried with the code, but I have 52 identical errors:
[COLOR="Red"]The name 'Conn' does not exist in the current context[/COLOR]

and 2:
[COLOR="Red"]The name 'MsgAll' does not exist in the current context[/COLOR]

I do not understand because before the code, register the parameter and does not accept

FGED GREDG RDFGDR GSFDG