Mxserver Tutorial

Post anything about MX Simulator here. Please. I'm begging you.
User avatar
MxWayGamer
Crushed Dissenter
Posts: 326
Joined: Mon Oct 13, 2014 3:46 pm
Team: MTFactory

Re: Mxserver Tutorial

Postby MxWayGamer » Sat May 14, 2016 5:34 pm

Someone have a script for read the "results.txt" file like "mxsimulator.com/uploadresults.php"

And I try to understand how the times unit is use but i don't find :S
Image

User avatar
MxWayGamer
Crushed Dissenter
Posts: 326
Joined: Mon Oct 13, 2014 3:46 pm
Team: MTFactory

Re: Mxserver Tutorial

Postby MxWayGamer » Sat May 14, 2016 6:08 pm

Edit : I find this script : http://mxsimulator.com/scripts/lapchart.py
How can i use in my website ?
Image

User avatar
LKR47
Posts: 806
Joined: Fri Jan 18, 2013 4:26 am
Team: LCQ Studios
Location: Chicago, Illinois
Contact:

Re: Mxserver Tutorial

Postby LKR47 » Sat May 14, 2016 7:39 pm

MxWayGamer wrote:Edit : I find this script : http://mxsimulator.com/scripts/lapchart.py
How can i use in my website ?

Youll need some kind of python processor for your web server. I believe Django is a popular tool for that? I could be wrong though as I never use python for web based projects.
Image

caden__s144
Posts: 20
Joined: Sat May 14, 2016 8:48 pm
Team: Ride365.com

Re: Mxserver Tutorial

Postby caden__s144 » Thu Jun 23, 2016 5:37 am

can you change the server ip from yours to a custom name??

User avatar
MX4EVER
Posts: 251
Joined: Thu Sep 13, 2012 5:49 pm
Team: MXS-Concept.com
Location: France
Contact:

Re: Mxserver Tutorial

Postby MX4EVER » Thu Jun 23, 2016 8:01 am

caden__s144 wrote:can you change the server ip from yours to a custom name??

That's DNS side, you have to buy a domain name and add a pointer to your IP.

i.e. you buy MYDOMAIN.com and you can redirect mx.mydomain.com to your IP 10.10.10.10 then your router has to NAT the requests to the mxsim server port (19800 ie.).

User avatar
Wahlamt
Posts: 6565
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Postby Wahlamt » Thu Jun 23, 2016 8:34 am

MX4EVER wrote:
caden__s144 wrote:can you change the server ip from yours to a custom name??

That's DNS side, you have to buy a domain name and add a pointer to your IP.

i.e. you buy MYDOMAIN.com and you can redirect mx.mydomain.com to your IP 10.10.10.10 then your router has to NAT the requests to the mxsim server port (19800 ie.).

This is exactly what I have done. I have purchased "storkenmxs.com" and let the sub-domain "server.storkenmxs.com" redirect the user to my IP at home, then it forwards the traffic on the port 19800 to my PC. If I have my mx sim server running, people get connected to it.

User avatar
Wahlamt
Posts: 6565
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Postby Wahlamt » Fri Aug 05, 2016 9:18 pm

While reading this Nate, it really came in useful. This time I tried my luck with sending packages to the server. I modified the code you provided a bit, so you can with this enter any command you want, as the terminal will prompt you for the command. Also I added the #/usr/bin/python in the beginning, not really sure if that is needed, but since I didn't want to put it in the root dir, I assumed it might be good to have.

Code: Select all

#/usr/bin/python

import socket

UDP_IP = "127.0.0.1"
UDP_PORT = 19800
MESSAGE = "x123"

command = raw_input('Enter the command you wish to execute: ')

MESSAGE += command

print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #internet # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

The modification here is that it cuts out after the "xPASSWORD" part and prompts the user for a command. The "server," part of the command is not needed as you'd type it in a server, if anyone wonders. When it prompts you, let's say you want to set the track 5, then type "settrack 5" without the quotation marks. If you'd like to broadcast a message, then type "broadcast This is a cool broadcast message for you!". This is my first time trying to do something useful with python so there might be better ways to do this than I was able to do, also maybe someone has made it before. Yet I though I could share it :)

User avatar
MX4EVER
Posts: 251
Joined: Thu Sep 13, 2012 5:49 pm
Team: MXS-Concept.com
Location: France
Contact:

Re: Mxserver Tutorial

Postby MX4EVER » Mon Aug 08, 2016 7:26 am

Wahlamt wrote:Yet I though I could share it :)

And thank you for sharing dude :)

User avatar
Wahlamt
Posts: 6565
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Postby Wahlamt » Fri Aug 12, 2016 10:07 am

So I made this too, in hopes that it would be able to be a simple solution for people at home, but unfortunately not. It is yet another way to send commands to a server, via a web interface, looking like this
Image

Now onto the problems
When I made this, I had in mind that it should work really simple, you install a web server (XAMPP for example) and put the folder in place. Unfortunately it worked... sort of... Upon installing XAMPP (LAMPP on Linux) on my Ubuntu 16.04 machine, I apparently got "sockets" installed with the PHP, allowing you to create "sockets" that can send UDP packages to localhost (send the commands to your local server). However on my windows machine when I installed XAMPP, I did not get the "sockets" extension included, so it did not work on my windows machine, took a while to figure out why.. So ultimately, it works fine with XAMPP on my Ubuntu 16.04LTS machine, but not on windows as of now.

If you decided to download it, just change the "x1234" part in the file called "phpudp.php", it's commented right above it in the code so it should be easy to understand.
Download
What's included?
  • The normal page shown above
  • A .php and a .py file if you rather would like to call php to execute a .py script instead of doing it just in normal php. If this is a bigger desire, just change in "scripts.js" to that php (runcommand.php) file and it'll call the .py script.
  • Command.py is the same as 2 posts ago, a script that you launch in the terminal, it asks you for a command, you enter it and the script sends the package. To note, this script is not valid in python 3.x
Also, I did NOT get the webpage (php) to work as I wanted in Apache2 on my linux machine.

User avatar
yzmxer608
Posts: 15229
Joined: Mon Dec 29, 2008 4:30 am
Team: Race Tech/SD
Location: Wisconsin, U.S.A

Re: Mxserver Tutorial

Postby yzmxer608 » Sat Aug 13, 2016 12:40 am

Wahlamt wrote:While reading this Nate, it really came in useful. This time I tried my luck with sending packages to the server. I modified the code you provided a bit, so you can with this enter any command you want, as the terminal will prompt you for the command. Also I added the #/usr/bin/python in the beginning, not really sure if that is needed, but since I didn't want to put it in the root dir, I assumed it might be good to have.

Code: Select all

#/usr/bin/python

import socket

UDP_IP = "127.0.0.1"
UDP_PORT = 19800
MESSAGE = "x123"

command = raw_input('Enter the command you wish to execute: ')

MESSAGE += command

print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #internet # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

The modification here is that it cuts out after the "xPASSWORD" part and prompts the user for a command. The "server," part of the command is not needed as you'd type it in a server, if anyone wonders. When it prompts you, let's say you want to set the track 5, then type "settrack 5" without the quotation marks. If you'd like to broadcast a message, then type "broadcast This is a cool broadcast message for you!". This is my first time trying to do something useful with python so there might be better ways to do this than I was able to do, also maybe someone has made it before. Yet I though I could share it :)

Thanks for posting, this works great :). I added one thing to it, if at the end of the script you put

Code: Select all

execfile("sendcommands.py")

Where sendcommands.py is whatever name you gave the script, it'll "keep" the prompt open (it really just opens it again) so you don't have to reopen it every time you want to send another command.

I'll add it to the first post :).

Also jlv something I noticed, if you send a command to broadcast, it shows in the server but doesn't show in the server cmd window. If you send it from in game it does show it in the cmd window, why is that?
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.

jlv
Site Admin
Posts: 12819
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Mxserver Tutorial

Postby jlv » Sat Aug 13, 2016 2:27 am

yzmxer608 wrote:Also jlv something I noticed, if you send a command to broadcast, it shows in the server but doesn't show in the server cmd window. If you send it from in game it does show it in the cmd window, why is that?

Not sure. My current source prints it on the console both ways, but I've added more logging since the last posted server version. There have been enough changes I should probably make a new server release.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
Wahlamt
Posts: 6565
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Postby Wahlamt » Sat Aug 13, 2016 7:01 am

jlv wrote:Not sure. My current source prints it on the console both ways, but I've added more logging since the last posted server version. There have been enough changes I should probably make a new server release.

Please make a --mutefile.txt or something so people can stay muted after the server is shut down and restarted ;)

jlv
Site Admin
Posts: 12819
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Mxserver Tutorial

Postby jlv » Sun Aug 14, 2016 2:02 am

Try using (mute) as the ban reason in the ban file. Like this if you wanted to permanently mute UID 23355:

0 23355 (mute)
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
MX4EVER
Posts: 251
Joined: Thu Sep 13, 2012 5:49 pm
Team: MXS-Concept.com
Location: France
Contact:

Re: Mxserver Tutorial

Postby MX4EVER » Tue Aug 23, 2016 9:55 am

jlv wrote:I should probably make a new server release.

:D :D :D :D :D :D

kittin
Posts: 1
Joined: Fri Aug 26, 2016 3:07 am

Re: Mxserver Tutorial

Postby kittin » Fri Aug 26, 2016 3:10 am

I was wondering how you get downloaded tracks from TM to work on a server. Every time I try it says the track cannot be found. Help?


Return to “General Discussion”

Who is online

Users browsing this forum: SKlein and 6 guests