The online racing simulator
C++ - Event Control v0.43 (application/tutorial)
Quote :Changelog:

v0.43
  • Now uses CInSim v0.7 (more efficient).
v0.42
  • Now uses CInSim v0.6 (more stable and efficient).
v0.41
  • Director commands for penalties.
  • Director commands for RCM messages.
  • Chat commands (!ecmd) now is a button screen instead of chat lines.
v0.4
  • directors.cfg merged into config.cfg for easier config.
  • Added new commands for race directors for some basic server configuration (!elaps, !equal, !etrack, !ecars, etc.)
  • !eon and !eoff for turning Event Control completely on or off (for admins only).
  • Uses new CInSim v0.4 library.

EVENT CONTROL v0.43

This is another application/tutorial I've written in basic C/C++ using my "CInsim" library. You can find the C++ CInsim library and my previous basic applications here: http://www.lfsforum.net/showthread.php?t=47717

All the source code is provided, of course, as well as a code::blocks project file

This application is an event manager (server oriented) developed for the Fun Racing League (http://www.funracingleague.com/). It was originally designed (as Qual Control) to enforce HARDCORE qualify sessions, in which the use of Shift+P and Shift+S is forbidden, so people can only do realistic pitstops by driving into the pitlane and stopping on the yellow spots.

The current version allows further control over race directing, and introduces the figure of the RACE DIRECTOR, which is a driver appointed as such who can execute all Event Control's commands except for the ones to quit the application, and turn it ON or OFF. These race directors don't need the admin password of the server and are just added by editing a simple text file. Race Directors can configure the server for a race (track, cars, laps, weather, restart, end, etc.), but can't kick or ban users, change slots, and use advanced host configuration commands.

It is an ideal tool if you manage a league and you want to have non-admin drivers handling things like race director chat messages, restarting/ending sessions, reversing top grid drivers for consecutive rounds of a race, sending drivers to spectators, etc.



QUICK START

You have to edit the config.cfg file with a text editor and fill the three required fields: IP, insim_port and admin_password. Then run the executable (The PThreads dll must be in the same directory).

Optionally, you can edit the config.cfg file to add up to 50 lfs license names who will have access to all race director's commands.

All players who join the server using the admin password have automatic access to all commands.

When the executable is launched the application will connect to the server and a welcome message should appear. There can be drivers in the server when the application starts, but be warned that the first thing it does is send everybody to spectators.

Start running!


USAGE AND FEATURES

Basic user commands:
  • !ehelp or !erules : Shows the intro screen.
  • !ecommands or !ecmd : Shows the available commands in the chat, depending on the level of the user.
Race Director commands:
  • !em [message] : Sends a preformatted (auto-color, auto upper case) Race Director message through the host chat.
  • !eopen or !eop : Opens the track for free driving. People can use shift+p and shift+s and rejoin again whenever they want.
  • !eclose or !ecl : Closes the track. Everybody is sent to spectators and nobody can join the track (they are automatically sent to spectators again if they try).
  • !ehardq or !ehq : Restarts a hardcore qualify session. In this no rejoin after shift+p or shift+s is allowed. Succesive restarts of /qualify are on hardcore mode until !eopen or !esoftq is used.
  • !esoftq or !esq : Restarts a soft qualify session. In this spectating and telepitting are allowed at all times.
  • !erace or !erc : Restarts the race.
  • !eend : Ends race and goes to lobby screen.
  • !erev [opt] : In lobby screen, reverses the grid order of the top [opt] number of drivers. If no number is used, by default it's 8.
  • !ecars, !etrack, !eweather, !ewind, !equal, !elaps, !ehours, !emustpit, !ecanreset (all like original LFS host commands).
  • !espec, !ecars, !etrack, !eweather, !ewind, !equal, !elaps, !ehours, !emustpit, !ecanreset, !efcv, !emidrace, !eclear, !ep_dt, !ep_sg, !ep_30, !ep_45, !ep_clear, !ercm, !ercm_ply, !ercm_all, !ercc_ply, !ercc_all (all these commands work exactly like the originals).
Admin commands:
  • !eon : Turns Event Control ON. This is efectively like restarting it.
  • !eoff : Turns Event Control OFF. Event control stays completely hidden and silent until an admin uses !eexit to quit it, or !eon to turn it on again.
  • !eexit or !eex : Closes Event Control (must be launched again externally).
Messages are sent to drivers to notice about several conditions and rules are shown at beginning, trying to make what's happening as easy to understand as possible.
Attached files
Event Control v0.43 20130105-1335.zip - 343 KB - 378 views
Not to bump the thread, but I have updated this application from Qual Control v0.2 to Event Control v0.31.

Now it does more things aside from managing hardcore qualifying sessions. Read the updated first post for detailed info and download link.
As always, hugely awesome sir.
The previous examples were not very useful, this one is small but works well and we are indeed using successfully it at the FRL. I guess I'll keep sharing everything I do related to InSim because I don't like having to write code and contributing to the community is always good.

I hope someone tries this for some league. Feedback would be welcome.
New update! Event Control v0.4

- More commands available for race directors (so they can tackle several situations concerning basic race configuration).
- Event Control can be turned on or off using admin commands.
- Configuration files merged into just one.
- It uses the safer CInSim library v0.4
New update!

Quote :Changelog:

v0.42
  • Now uses CInSim v0.6 (more stable and efficient).


C++ - Event Control v0.42 (application/tutorial)
(6 posts, started )
FGED GREDG RDFGDR GSFDG