Mxserver Tutorial

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

Re: Mxserver Tutorial

Post by MxWayGamer »

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
MxWayGamer
Crushed Dissenter
Posts: 326
Joined: Mon Oct 13, 2014 3:46 pm
Team: MTFactory

Re: Mxserver Tutorial

Post by MxWayGamer »

Edit : I find this script : http://mxsimulator.com/scripts/lapchart.py
How can i use in my website ?
Image
LKR47
Posts: 893
Joined: Fri Jan 18, 2013 4:26 am
Team: LCQ Studios
Location: McHenry, Illinois
Contact:

Re: Mxserver Tutorial

Post by LKR47 »

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: 70
Joined: Sat May 14, 2016 8:48 pm
Team: Phil's

Re: Mxserver Tutorial

Post by caden__s144 »

can you change the server ip from yours to a custom name??
Image
MX4EVER
Posts: 261
Joined: Thu Sep 13, 2012 5:49 pm
Team: MXS-Concept.com
Location: Switzerland
Contact:

Re: Mxserver Tutorial

Post by MX4EVER »

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.).
Niko | Mouk Lab | Admin of MXS-Concept // MyMXB // MXBikes-Shop // among others. | YouTube
Image
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Post by Wahlamt »

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.
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Post by Wahlamt »

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 :)
MX4EVER
Posts: 261
Joined: Thu Sep 13, 2012 5:49 pm
Team: MXS-Concept.com
Location: Switzerland
Contact:

Re: Mxserver Tutorial

Post by MX4EVER »

Wahlamt wrote:Yet I though I could share it :)
And thank you for sharing dude :)
Niko | Mouk Lab | Admin of MXS-Concept // MyMXB // MXBikes-Shop // among others. | YouTube
Image
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Post by Wahlamt »

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.
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: Mxserver Tutorial

Post by yzmxer608 »

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: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Mxserver Tutorial

Post by jlv »

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.
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Mxserver Tutorial

Post by Wahlamt »

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: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Mxserver Tutorial

Post by jlv »

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.
MX4EVER
Posts: 261
Joined: Thu Sep 13, 2012 5:49 pm
Team: MXS-Concept.com
Location: Switzerland
Contact:

Re: Mxserver Tutorial

Post by MX4EVER »

jlv wrote:I should probably make a new server release.
:D :D :D :D :D :D
Niko | Mouk Lab | Admin of MXS-Concept // MyMXB // MXBikes-Shop // among others. | YouTube
Image
kittin
Posts: 1
Joined: Fri Aug 26, 2016 3:07 am

Re: Mxserver Tutorial

Post by kittin »

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?
Post Reply