PDA

View Full Version : problem with bank


peugeot206
27th June 2011, 20:37
hi,
my problem is that i am the only one that can see the bank but the other players can not see the bank. what can i do for the other players also see the bank ?

peugeot206
27th June 2011, 20:45
the code of bank is:


// City Bank
int BankDist = ((int)Math.Sqrt(Math.Pow(MCI.Info[i].X - (284 * 196608), 2) + Math.Pow(MCI.Info[i].Y - (-334 * 196608), 2)) / 65536);
if (BankDist <= 10)
{
if ((MCI.Info[i].Speed / 147) <= 3)

if (Conn.InBank == 0)
{
// <<Bank Display>>
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_DARK, 50, 100, 50, 50, 160, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_DARK, 50, 100, 50, 50, 161, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Welcome to City ^6Bank", Flags.ButtonStyles.ISB_LIGHT, 7, 98, 51, 51, 162, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Your bank balance is ^6€" + Conn.BankBalance, Flags.ButtonStyles.ISB_LEFT, 4, 40, 65, 54, 163, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Time until Bonus ^6" + Conn.Timer + "^6 Minute(s)", Flags.ButtonStyles.ISB_LEFT, 4, 40, 69, 54, 164, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^6Insert", "Enter amount to Insert", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 54, 54, 165, Conn.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^6Withdraw", "Enter amount to Withdraw", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 64, 64, 166, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7CLOSE", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 92, 95, 167, Conn.UniqueID, 2, false);
Conn.InBank = 1;
}
}

else if (BankDist > 14 && Conn.InBank == 1)
{
Conn.InBank = 0;
// <<Bank Display Removal>>
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 160, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 161, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 162, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 163, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 164, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 165, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 166, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 167, Conn.UniqueID);
}

Beaver08
28th June 2011, 14:17
dont use MCI.Info rather use the compcar packets as i find it works alot more effecient and it can be used anywhere within the source.

smcsc
28th June 2011, 14:57
the conn.compcar gives an error


// City Bank
int BankDist = ((int)Math.Sqrt(Math.Pow(Conn.CompCar.X - (296 * 196608), 2) + Math.Pow(Conn.CompCar.Y - (-331 * 196608), 2)) / 65536);
if (BankDist < 4 && (Conn.CompCar.Speed / 147) <= 3)
{

if (Conn.InBank == 0)
{
// <<Bank Display>>
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_DARK, 50, 100, 50, 50, 160, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_DARK, 50, 100, 50, 50, 161, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Welcome to City ^6Bank", Flags.ButtonStyles.ISB_LIGHT, 7, 98, 51, 51, 162, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Your bank balance is ^6€" + Conn.BankBalance, Flags.ButtonStyles.ISB_LEFT, 4, 40, 65, 54, 163, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Time until Bonus ^6" + Conn.Timer + "^6 Minute(s)", Flags.ButtonStyles.ISB_LEFT, 4, 40, 69, 54, 164, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^6Insert", "Enter amount to Insert", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 54, 54, 165, Conn.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^6Withdraw", "Enter amount to Withdraw", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 64, 64, 166, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7CLOSE", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 92, 95, 167, Conn.UniqueID, 2, false);
Conn.InBank = 1;
}
}

else if (BankDist > 14 && Conn.InBank == 1)
{
Conn.InBank = 0;
// <<Bank Display Removal>>
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 160, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 161, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 162, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 163, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 164, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 165, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 166, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 167, Conn.UniqueID);
}


what i do?
all conn. gives an error

DarkKostas
28th June 2011, 15:15
Which is the first loop in the MCI packet? You can use foreach instead of for(in case you use this).

smcsc
28th June 2011, 15:51
the error is:

http://img189.imageshack.us/img189/7745/screenshot001ny.jpg

DarkKostas i canīt use that program because i donīt know how i use him.

speedboy86
28th June 2011, 18:05
try to use C. and not Conn.

broken
28th June 2011, 18:16
hi,
my problem is that i[..]

but the conn.compcar[..]

If both of those accounts are yours, then, in my list, you classify as a spammer. You were close before with your many threads, and no knowledge in programming, but this will top it off if confirmed.

And just so I give you some help on the topic, before I stop seeing any point in doing it: Have you ever declared a variable with the name Conn?

(not trying to sound important, but this is slowly getting.. call it demotivating)

smcsc
28th June 2011, 18:51
bronken the peugeot206 is my brother. you have problems?

rubene300
28th June 2011, 19:07
bronken the peugeot206 is my brother. you have problems?

Relax dude.. Its her brother broken.

Broken, this topic its for help smcsc with her insim, if you dont like the topic or something go away and dont come back ok ?

He only need help ;)

smcsc
28th June 2011, 19:14
and now?

http://img143.imageshack.us/img143/6676/screenshot001nh.jpg

DarkKostas
29th June 2011, 07:38
Replace them with Conn.Speed instead of Conn.Compcar.Speed

MadCatX
29th June 2011, 08:26
The most logical thing to do is to read the definition of Conn in Conn.cs file and find out what members it actually contains.

smcsc
29th June 2011, 12:07
now the error is in X and Y

http://img200.imageshack.us/img200/1553/screenshot002cm.jpg

Beaver08
29th June 2011, 12:11
i dont understand why you have a conn.cs all you need to do is define the var


var Conn = Connections[GetConnIdx(PACKET HERE.UCID)];

with the packet here you can replace it with whatever packet you are coding under.

MadCatX
29th June 2011, 12:37
CompCar should not be defined as "byte", but as a data structure (or Object in case of C#), are you sure you're doing in the right way? It looks like Conn.CompCar only returns an index to a CompCar structure in the MCI packet.

DarkTimes
29th June 2011, 12:52
i dont understand why you have a conn.cs all you need to do is define the var

var Conn = Connections[GetConnIdx(PACKET HERE.UCID)];

with the packet here you can replace it with whatever packet you are coding under.
They both mean the same thing, only in one instance you're telling the compiler what type you want, in the other you're telling the compiler "go figure out the type for me". It's entriely down to preference whether you use it or not, the only situation it's required (and why it was added to the language) is for declaring an anonymous object. Sometimes using var makes the code clearer, sometimes it makes the code less clear, sometimes it's needed, sometimes you must declare the full type. There is no right or wrong here.

smcsc
30th June 2011, 01:20
And now what is the problem because the bank does not appear on the screen?

http://img683.imageshack.us/img683/5549/screenshot001om.jpg

MadCatX
30th June 2011, 12:48
Please don't post screenshots of your code, it's pain in the ass to wait for the images to load and read it from them. PHP tags and CTRL+C/V are your friends.

Is the statement that triggers displaying the bank interface ever true? Have you tried displaying the actual values of BankDist and Speed to see if it ever meets your conditions? Does it work if you display the buttons globally to every player? It's impossible to give you any really useful answer without having the whole source...

smcsc
1st July 2011, 15:42
the full code of my bank.


// City Bank
int BankDist = ((int)Math.Sqrt(Math.Pow(Conn.CompCar.X - (-208 * 196608), 2) + Math.Pow(Conn.CompCar.Y - (-70 * 196608), 2)) / 65536);
if (BankDist < 10 && (Conn.CompCar.Speed / 147) <= 3)
{

if (Conn.InBank == 0)
{
// <<Bank Display>>
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_DARK, 50, 100, 50, 50, 160, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("", Flags.ButtonStyles.ISB_DARK, 50, 100, 50, 50, 161, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Welcome to City ^6Bank", Flags.ButtonStyles.ISB_LIGHT, 7, 98, 51, 51, 162, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Your bank balance is ^6€" + Conn.BankBalance, Flags.ButtonStyles.ISB_LEFT, 4, 40, 65, 54, 163, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7Time until Bonus ^6" + Conn.Timer + "^6 Minute(s)", Flags.ButtonStyles.ISB_LEFT, 4, 40, 69, 54, 164, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^6Insert", "Enter amount to Insert", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 54, 54, 165, Conn.UniqueID, 40, false);
InSim.Send_BTN_CreateButton("^6Withdraw", "Enter amount to Withdraw", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 73, 64, 64, 166, Conn.UniqueID, 2, false);
InSim.Send_BTN_CreateButton("^7CLOSE", Flags.ButtonStyles.ISB_LIGHT | Flags.ButtonStyles.ISB_CLICK, 4, 10, 92, 95, 167, Conn.UniqueID, 2, false);
Conn.InBank = 1;
}
}

else if (BankDist > 14 && Conn.InBank == 1)
{
Conn.InBank = 0;
// <<Bank Display Removal>>
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 160, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 161, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 162, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 163, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 164, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 165, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 166, Conn.UniqueID);
InSim.Send_BFN_DeleteButton(Enums.BtnFunc.BFN_DEL_ BTN, 167, Conn.UniqueID);
}

smcsc
1st July 2011, 18:50
Now I would start my cruise insim and gave me this error what can I do?

http://img23.imageshack.us/img23/4331/erromv.jpg

i go translate to english the error:

"MSO - Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: Index"

DarkKostas
1st July 2011, 18:56
I guess this happend when you try to type a command. Make sure the command is ok or the code before commands. If it crashes for every command then the problem is at the code before any command :)

smcsc
1st July 2011, 19:02
I think the error is in code what can I do to fix it?

MadCatX
1st July 2011, 19:21
Run the app from MSVS in debugging mode, it'll show you where in the code you hit this error.

smcsc
1st July 2011, 21:49
Run the app from MSVS in debugging mode, it'll show you where in the code you hit this error.

thanks. :D