View Full Version : How did i make a Speedlimit?
Heiko1
17th January 2008, 18:42
Hey guys i need your Help.
i have a Problem with my InSim, the problem is i dont know wich code i must use and wich Eventhandler i must Activade.
Please help me.
:tilt:!SEND CODE ONLY BY PM!:tilt:
Or add me in MSN: Marco-0510@hotmail.de
Greetings Marco
Heiko1
17th January 2008, 18:52
!BUT AT THE FIRST WRITE HERE A POST!
Thats i know where was send me the Code.
Greetz Marco
the_angry_angel
17th January 2008, 19:07
Enable the MCI packets and you'll get the speed of each racer. Compare this value to your defined speed limit and if they exceed this limit preform an action.
How you do this depends on whether or not you're using a library, what language you're using, etc.
Read the documentation where relevant.
Heiko1
17th January 2008, 19:10
SRY i forgot it...
Language: C# / C-Sharp
Libary: LFS_External
Im using:
MC Virtual C# 2008 Express Edition
SRY again thats i dont wrote it
Greetz Marco
dougie-lampkin
17th January 2008, 19:13
I have code for that, but it depends what context you want it in. Do you want a person's speed at a particular area? Do you want to be be able to grab someone's speed at any point?
Heiko1
17th January 2008, 19:24
I want a code 4 Speedtrap (not so eargend)
and a Code 4 a Speedlimit Button likes this:
Thanks to [NPC] 4 the Server
dougie-lampkin
17th January 2008, 19:29
Ah that's fairly easy. I don't have code, but I can tell you how to do it:
1. Have code that reads the speed out of all the MCI.Info[] packets
2. Get the UCID from the MCI.Info[] (Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[0].PLID)].UniqueID)
3. Send a button to the UCID containing the Speed info.
That's the basics of what you'd need to do.
Hope that helps.
Heiko1
17th January 2008, 19:34
Yea thanks but how do i make that all?
Also in wich Eventhandler i must add it?
Heiko1
17th January 2008, 19:43
where i must add it?
Or just i must made a new private voice ?
dougie-lampkin
17th January 2008, 19:46
I think it could all be done in the MCI method. And don't forget to uncomment MCI in the default region:
public Form1()
{
InitializeComponent();
InitializeInSimEvents(); // Event handlers (Uncoment a line in here to enable the event
}
#region Default Methods
// Uncomment a line in this method to enable its event.
private void InitializeInSimEvents()
{
//LFS_External.InSim.Events.AXC_Received += new LFS_External.InSim.Events.AXC_EventHandler(AXC);
//LFS_External.InSim.Events.AXI_Received += new LFS_External.InSim.Events.AXI_EventHandler(AXI);
//LFS_External.InSim.Events.AXO_Received += new LFS_External.InSim.Events.AXO_EventHandler(AXO);
LFS_External.InSim.Events.BTC_Received += new LFS_External.InSim.Events.BTC_EventHandler(BTC);
//LFS_External.InSim.Events.BTT_Received += new LFS_External.InSim.Events.BTT_EventHandler(BTT);
//LFS_External.InSim.Events.BFN_Received += new LFS_External.InSim.Events.BFN_EventHandler(BFN);
//LFS_External.InSim.Events.CCH_Received += new LFS_External.InSim.Events.CCH_EventHandler(CCH);
//LFS_External.InSim.Events.CLR_Received += new LFS_External.InSim.Events.CLR_EventHandler(CLR);
LFS_External.InSim.Events.CNL_Received += new LFS_External.InSim.Events.CNL_EventHandler(CNL);
//LFS_External.InSim.Events.CPP_Received += new LFS_External.InSim.Events.CPP_EventHandler(CPP);
LFS_External.InSim.Events.CPR_Received += new LFS_External.InSim.Events.CPR_EventHandler(CPR);
//LFS_External.InSim.Events.CRS_Received += new LFS_External.InSim.Events.CRS_EventHandler(CRS);
//LFS_External.InSim.Events.FIN_Received += new LFS_External.InSim.Events.FIN_EventHandler(FIN);
//LFS_External.InSim.Events.FLG_Received += new LFS_External.InSim.Events.FLG_EventHandler(FLG);
//LFS_External.InSim.Events.III_Received += new LFS_External.InSim.Events.III_EventHandler(III);
//LFS_External.InSim.Events.ISM_Received += new LFS_External.InSim.Events.ISM_EventHandler(ISM);
//LFS_External.InSim.Events.LAP_Received += new LFS_External.InSim.Events.LAP_EventHandler(LAP);
LFS_External.InSim.Events.MCI_Received += new LFS_External.InSim.Events.MCI_EventHandler(MCI);
//LFS_External.InSim.Events.MPE_Received += new LFS_External.InSim.Events.MPE_EventHandler(MPE);
LFS_External.InSim.Events.MSO_Received += new LFS_External.InSim.Events.MSO_EventHandler(MSO);
LFS_External.InSim.Events.NCN_Received += new LFS_External.InSim.Events.NCN_EventHandler(NCN);
//LFS_External.InSim.Events.NLP_Received += new LFS_External.InSim.Events.NLP_EventHandler(NLP);
LFS_External.InSim.Events.NPL_Received += new LFS_External.InSim.Events.NPL_EventHandler(NPL);
Heiko1
17th January 2008, 19:52
yea :) but where i must paste it? in wich private void
when i paste it in a empty thing it show's errors and when i make it into the NCN it only shows 2 errors......
i make picture:)
dougie-lampkin
17th January 2008, 20:00
if it doesnt exist, make private void MCI(Packets.ISP_MCI MCI)
Heiko1
17th January 2008, 20:00
Here are the Picture
ops dont can read that...
dougie-lampkin
17th January 2008, 20:02
Here are the Picture
ops dont can read that...
erm...the line of code you have there is only used to figure out the UCID required for buttons from the PLID used in the MCi packets...
Heiko1
17th January 2008, 20:04
Hope you can read it :thumb:
Heiko1
17th January 2008, 20:09
can u just make me the whole code? PLEASE:margesimp
PLEASE must go
dougie-lampkin
17th January 2008, 20:10
First of all, put it in the MCI method.
Second, the line MCI.Info[] (Connections... does not go on its own, and it doesn't have MCI.Info[] at the start of it. That line takes a PLID and scans the connections list, and find's that PLID's UCID, which is what you need for buttons.
Third, the [] in MCI.Info is the connection ID (I think) of that driver's connection. It goes up to 8, and then a new MCI.Info is sent.
Fourth, you need to get the speed of a driver using MCI.Info[ (ID here) ].Speed.
Try that and report back...
EDIT: No, I can't make the whole code, as I don't have it written already, and I'm working on other projects...
Heiko1
18th January 2008, 13:22
Error 1 Syntax error, ']' expected C:\Dokumente und Einstellungen\Marco\Desktop\LFS_External_Client\LF S_External_Client\Form1.cs 724 87 LFS_External_Client
what i make wrong?
i'll send again picture
Heiko1
18th January 2008, 13:26
error fixed :):)
is the code starts with: PLID ?
also PLID(Connections........ ?
Heiko1
18th January 2008, 13:41
new error on button.... :(
Error 1 'LFS_External_Client.STC_INSIM.MCI(LFS_External.In Sim.Packets.IS_MCI)' is a 'method', which is not valid in the given context
Please help
Greetz Marco
Heiko1
18th January 2008, 14:51
I hope anybody can help me.
Greetz Marco
dougie-lampkin
18th January 2008, 19:25
new error on button.... :(
Error 1 'LFS_External_Client.STC_INSIM.MCI(LFS_External.In Sim.Packets.IS_MCI)' is a 'method', which is not valid in the given context
Please help
Greetz Marco
I'm not sure, but I think that is when you use any MCI packet information in another method, for instance:
void NCN(Packets.ISP_NCN NCN)
{
Insim.Send_Message_MSG(MCI.Info[0].Speed)
}
or whatever...
If you need to use MCI info in another method, store it in a variable.
Heiko1
18th January 2008, 19:57
thx i will try it out :)
shaun463
22nd January 2008, 18:07
[STC] Rocks! :)
sun
22nd January 2008, 19:09
i wonder why these people dont help me like this in my threads.:scratchch
dougie-lampkin
22nd January 2008, 19:12
i wonder why these people dont help me like this in my threads.:scratchch
Because he knows what he's talking about, and is willing to learn "some" C# by himself...
sun
22nd January 2008, 19:13
some am I
dougie-lampkin
22nd January 2008, 19:24
some am I
Oh really? You said you've read all the tutorials that have been suggested, yet you don't know what a method is, or how to define it? Right...
Anyway, don't post here, keep this thread on-topic...
St4Lk3R
22nd January 2008, 19:33
i wonder why these people dont help me like this in my threads.:scratchch
As you may or may not know, I am a pretty quiet member of the programmers crowd - and I have a pretty thick skin regarding the niveau of posts on this forum, because I know that I once started at the same level. However, your frequent posting and asking for code even annoys me.
But to start with the useful part of the post: I think that you managed to pretty much get the tempers of most programmers up against you with those constantly coming threads. In the first few threads, someone always was so kind to donate some code to you, but sooner or later they pretty much all figured out you were more or less only leeching. You did not show a line of code that you did yourself, but constantly asked for complete program parts instead of hints to point you into the right direction.
To cite a common analogy:
You will have to build the house (it can also be a bamboo hut) before you can put the roof on top.
You will have to know how to program (at least basic techniques) before starting something as complex as an insim daemon.
I know you ordered a book about programming in C#. That is great! But I think it is the best for BOTH sides - the programming crowd here in the forums and you, if you stop asking questions about your insim tool until you know those basic programming techniques. Build the house first - I think you will then for sure find some nice carpenters who will help you with the roof.
Best regards in the hope that you understood me,
Stalker.
PS: Oh, by the way: You may have noticed that my post was much better to read than most of yours because I have used proper english and punctuation. It may be worth to consider this for the future, too.
And also: How to ask questions the smart way! (http://catb.org/%7Eesr/faqs/smart-questions.html)
sun
22nd January 2008, 19:57
... he hasnt done that code all for me i've done loads of code but people still dont belive me and they hate me now so i'am going to say bye.
dougie-lampkin
22nd January 2008, 20:00
... he hasnt done that code all for me i've done loads of code but people still dont belive me and they hate me now so i'am going to say bye.
Erm...you sent me the code of your project recently. I'm not going to say exactly what's in it, as that's just mean. But, I'd estimate that a good 80% of it is taken from other people, and the rest is copy and paste of that work, with the messages changed. If you want to go specific, I can show people the code...
St4Lk3R
22nd January 2008, 20:02
... he hasnt done that code all for me i've done loads of code but people still dont belive me and they hate me now so i'am going to say bye. you obviously have neither read my whole post nor understood a thing of it. a pity.
*winks*
now btt anyone, nothing to see here
Venix
26th January 2008, 22:21
To cite a common analogy:
You will have to build the house (it can also be a bamboo hut) before you can put the roof on top.
You will have to know how to program (at least basic techniques) before starting something as complex as an insim daemon.
PS: Oh, by the way: You may have noticed that my post was much better to read than most of yours because I have used proper english and punctuation. It may be worth to consider this for the future, too.
Hi all,
you probably won't know who I am, but I just wanted to say I really love the way you've put it in your post. I'm a computer science student myself, but I have never seen an anology like the one you used, just brilliant...And I kind of think I know what you are talking about: script-kiddies... love the way you handled it, and you're absolutely right: No way that someone will ever be able to use the insim libraries without any programming knowledge at all...
Again, big props for your handling of this situation :)
JW
p.s. just looked into this thread to get a basic idea of the insim libs :)
p.p.s. I hope my interpunction is correct ;)
dougie-lampkin
26th January 2008, 22:47
If your looking for Insim libs, try LFS_External, it's the best I've found :)
Manhunt231
5th February 2008, 14:02
i wouner why not one of the admins or PC nerds can make a video tortural:thumb:
dougie-lampkin
5th February 2008, 14:43
lol a video tutorial of what? Typing copious amounts of code?
JasonJ
6th February 2008, 02:51
I've done that sometimes....
Hold down Ctrl-Z for about ten minutes after about 6 hours of coding and it looks completely mental. :D Like time-lapsed hyper coding.
Sorry [/Off Topic]
Demondpeter
8th February 2008, 08:13
hi, any one help me with coding a insim i have tryed soo hard and i can not dont it so eny one make me one for free that will be soo good if you will
Demondpeter
8th February 2008, 08:59
any help me, i need a insim for my cruise server plz get back to me if u can help me or even better make one for me:D
the_angry_angel
8th February 2008, 13:19
I'd suggest that you potentially take a look at the FAQ (http://www.lfsforum.net/showthread.php?t=106).
jonny211984
29th April 2008, 00:53
You Are Right The Buttons And Things In His Insim Come From My Insim Extreme Cruising Hes Just Out To Get Every Ones Ideas He Has Latley Stole A Layout Hes Not Liked Much Peace :p
dougie-lampkin
29th April 2008, 05:33
:munching_
ReVoX
29th April 2008, 19:03
I have this, I use MCI packets .Speed and if (MCI..... < 120) //this is in km/h
But i dont use with buttons, I use this with strings in Clients.cs
Robbo01
30th April 2008, 15:47
And also: How to ask questions the smart way! (http://catb.org/%7Eesr/faqs/smart-questions.html)
rofl. didnt know such things existed!
Heiko1
28th October 2008, 19:26
BUMP!
Ive learned now alot of coding in C# i made my FIRST realy windows app :) and now im trying to make a Display like G15mod^^ so thanks to the forum here and to everybody who ever helped me :) and special thanks tho T-Ronx for libary and to Dougie-Lampkin for the very good tipps :)
Robbo01
28th October 2008, 19:33
So why Bump it if you have got what u wanted?
Heiko1
28th October 2008, 19:34
just show that i learned here alot? and say thanks to every ppl who helped me :)
Robbo01
28th October 2008, 19:37
So it took you 9 Months and 10 Days (Precisely at 19:57) to say Thanks and to learn that :really::thumb:
Go you :D
Heiko1
28th October 2008, 19:38
me gone boring ^^ then i just wanted to bump a thread (my first bump ever) ^^
Stefani24
28th October 2008, 19:54
Your proud of bumping and spamming.
Im proud of you
imthebestracerthereis
28th October 2008, 21:11
Awesome. Close this thread now.
+1
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.