Hey, First of all i never developed a plugin for either rF1 or rF2 so i don´t really know how hard will it be but i´ll give it a try anyway. Since this is my first contact with rF plugins i will appreciate all the help possible from experienced developers. My idea is very simple but will bring another touch of realism to our rF2 races. As you all know, rFactor lets drivers press ESCAPE during sessions and return to the track in a blink of an eye. This is something very unreal and allows everyone to "hotlap" with no fear of "killing" the vehicle. My intention is to create a plugin that prevents drivers from returning to the track, in a given session (besides Testing), after they press ESCAPE outside the pitlane. As i can see in the InternalsPlugin.hpp there is a way to know if the car is in the pitlane: bool mInPits;// between pit entrance and pit exit (not always accurate for remote vehicles) or unsigned char mPitState; // 0=none, 1=request, 2=entering, 3=stopped, 4=exiting There is also a way to know the type of the current session: long mSession; // current session (0=testday 1-4=practice 5-8=qual 9=warmup 10-13=race) So my questions are: - Is there a way to block(grey) the Race button? (maybe: bool mServerScored;// whether vehicle is allowed to participate in current session) - How can i detect the ESC button was pressed to exit to pits. Thanks in advance, Carlos Carvalho
Yep, that'd be the one. You want to make sure you implement InternalsPluginV07, so you get access to the rules stuff (return true from WantsMultiSessionRulesAccess()). Then, in AccessMultiSessionRules, you can set MultiSessionParticipantV01->mServerScored to false for the appropriate driver (note the definition comments show which are input/output, vs input only). I think this will disable the Race button for that driver. Any car that goes from not being in the pits (mInPits), to being in the pits, without at least having their mPitState change from 0 (None) to 2 (entering), has probably pressed Esc. You'd need to do some tests and think of ways this might get tricked though. But I'm pretty sure as soon as they cross the pit entry line mPitState will change to 2, which is about as good as you'll get unless there's some other way I haven't thought of.
I'd love the ability to not escape at all until back to the pits. If you can't get back to the pits, then you have to retire the car from the session
Thanks for your reply. Im starting to understand the example but there are a few things i still dont get. I will investigate a bit more and send you a message if i have any doubts Best regards
But without the server being able to enforce clients having the plugin installed, it's useless - I like the idea though
IMHO If you install the plugin in server side it should work... Lets check it!!! Enviado desde mi LG-D620 mediante Tapatalk
Yeah, the Multisession rules should take effect from the server side no worries at all. Whether my method would be totally reliable remotely I'm not sure, but maybe there's another way.
Ohh, cool then, didn't think that was possible - for server to disallow a specific client to press 'race'
Very interesting, so this plug-in can be very good to "lock" the Esc from users on some chosen Session !!
Well, when it's working it'll stop people jumping back in the car after the fact. The game itself having the option to stop people escaping accidentally (users can make it more difficult already by forcing to have a prompt first), and working out when people have done it properly, and when people have too much damage to reasonably continue despite making it back to the pits, would be better. Still, beggars, choosers, blah. I was probably being slightly generous when I said "recent". This was put in to enable the KnockoutQualifying plugin, which uses the same facility to stop some drivers jumping in the car.
If someone gets damage and pits, they have to sit and wait for it to be fixed. Better than stopping escape would be to force this repair time regardless of whether they pit in their pit spot or not. Get 300 secs damage...if you pit you have to wait, if you escape you don't! Hold on, now you have to wait even if you escape.
In practice/quali, you don't wait for repairs to complete even if you don't escape before entering the pits. In the race, if you press Escape, you're out anyway, so does it matter that your car gets fixed?
Can't speak for the OP, but having done a little playing with the rules code I'm not sure this is feasible - you can only 'disable' a car when the game asks for a multi session update, and that may not happen very often. For this to work you'd need to be able to stop scoring a car almost immediately after detecting it has pitted prematurely. *An alternative would be a client-side plugin that 'presses' ESC when it's detected that the driver has ESCed and then got back in the car, but obviously that's only useful for leagues and then you need to do some verifying with the server to make sure everyone's running it etc.