Teeworlds Rcon Hack
sv_name Tutorial server (the name of your server ;D)sv_map ctf5 (the inicial map)sv_scorelimit 100 (the limit of the score)sv_gametype ctf (the gametype ;D)sv_register 1 (if set to 0 the server will be lan only and will not appear in the server list)sv_rcon_password T rcon ( the console password not the password needed to enter the server!)sv_motd Welcome to my Server! Good Luck and Have Fun! Rules! any kind of bots and hacks ar not allowed! using them will result in ban!! (the message of the day)sv_max_clients 16 (how many players can be max is 16)sv_spectator_slots 5 (how many spectators can be at a time )sv_powerups 1 (if you set it to 0 there will be no katana)sv_maprotation ctf5, ctf6, ctf7 (what maps go after the inicial map)sv_rounds_per_map 1 (how many times will the players will play on the same map before maprotation)sv_port * 8303 (the port the server listens on)sv_max_clients_per_ip 20 (if you have more than one pc how many players can join per internet IP)
Teeworlds Rcon Hack
@spinning: Lots of pros have a really high mousesens and they like spinning their mouse around cause it helps them to aim fast everywhere but they don't hack. To increase your mousesens type into your localconsole (f1): inp_mousesens 100 is default value, 505 is the maximum you can put at the menuscrollbar, you could try 1337 ^^.
Save and load are not what you expect. Try them on an official DDNet server and you will see. Instead, if you want to train, write sv_test_cmds 1 into your config and restart the server. Then you can use rcon and super.
The situation with modifications in teeworlds world is rather stressed.There is no mod support in the code, so teeworlds design does not providesimple API to create mods. Most of mods has to significantly change the code,and hence every single mod is a standalone full-blown fork. This makes itdifficult to combine mods and often the same features are implemented separatelyby different people in different ways for different mods. The mod describedbelow is not an exception. Fortunately, there was a quite successful attempt tocombine several mods into one made by Tom. The result features standardgametypes as well as instagib deathmatch (idm), team deathmatch (itdm), capturethe flag (ictf), freeze (ifreeze), freeze capture the flag (ifrzctf) andflagball (ifb). Since this mod had most of my favourite gametypes, I decided totake it as a start and develop it further to implement what I wanted.
The idea for the mod arised when I tried to make the server more configurable.I wanted to make a random maprotation, but couldn't even make a map to appear inrotation twice. While this particular task could easily be solved with a smallpatch, I thought that it would be a nice idea to have a full-scaled programminglanguage for configuration files. I didn't want to reinvent the bicycle tryingto extend the available teeworlds parser or make my own language even if itwould be backward-compatible with existing server configurations. Instead, I'vechosen Perl, mainly because I wanted to study its internals and figure out howto embed it in programs. Of course, there were a lot of other choices. I'veheard that Lua will be used for the same or similar task in the upcomingteeworlds 0.6. Indeed, it seems to be the most suitable language despite that Idon't like some of its features: it's small, fast, and easy to embed. Amongother choices were Python, Tcl and Scheme. Technically, it doesn't really matterwhich language to use for this task as long as it is dynamic, has some form ofeval function and can call C functions (and if I wouldn't want to haveREPL, only the latter requirement would matter). In any case it is abad idea to often call functions from embedded language because of all thepenalties foreign function calls imply, so the speed of the embedded languagedoesn't really matter. Other requirements, such as memory usage and fewdependencies, exclude several major languages, but still plenty of scriptinglanguages are left. The choice between them is more likely a matter of desire.As long as you have a sane API, to implement support for another language isquite easy. Bad thing is that Teeworlds doesn't have one, so I had to simulateit with some hacks.
In addition to providing programming language for configuration files, I decidedto implement a REPL (read-evaluate-print loop) for rcon. It makes some form ofterminal emulation in rcon and gives the administrator complete control over theserver (well, the level of control the server API provides). Note that it iseasy to extend this control to get access to things unrelated to teeworlds, forexample to get a shell on the machine running teeworlds with the rights of theuser running teeworlds. It is easy enough to be done manually, right in the rconcommand line, so be sure to pick strong root password if you choose to activate it.Of course, there still exists the possibily of root password to be compromised.To minimize possible damage, you may choose between two security measures.
The best way to protect your system is to run the server in chroot jailunder unprivileged user. Make a directory, for example /srv/teeworlds/, and putthere files you want to be available to the server. In particular, make a mapsdirectory inside /srv/teeworlds and put maps there. Then write a call toinit function in the end of your configuration file:
When init function is executed, the server chroots to directorypassed as the first parameter, /srv/teeworlds in this example, and changes itsgroup identity and user identity to those specified by thesecond (1000) and the third (1001) parameters correspondingly. init also copiessystem files neccessary for teeworlds to work properly. These are/etc/resolv.conf, and libraries /lib/libnss_dns.so.2,/lib/libnss_files.so.2, /lib/libresolv.so.2. Teeworlds uses these files toestablish connection to master servers. Since chroot callcan be made only by superuser, the server has to be run as root.
Often it is desirable to have several types of users administering the server.For example, there could be administrators with full access to the servercommands, and referees who should be able to kick any user by rcon, but shouldnot be able to shutdown the server. With REPL this desire becomes even stronger,because anyone who has access to the REPL, has access to the shell on the serverhost system and can do a lot of nasty things. In this mod a group concept isintroduced to provide control for who can execute which functions.
Whenever a user enters a password in order to authenticate in rcon, the serversearches for a group with the corresponding password field and assignes its groupid to the user. The user can execute only those functions whose group ids matchtheir group id. Two group ids match if their binary and is not zero:
For a command to be votable, it has to have a vgid entry in the %commandshash. Naturally, only users whose gid match vgid have permissions to run thevote. However, vgid is not checked when a predefined vote is called, that is avote added by addvote to the list of votes the client can call withoutauthorizing in rcon.
more is a simple text viewer that allows the player to read a big bunchof text in the limited space of rcon. Being fed a pack of strings, more splitsthem so that they look nice and prints a screenful of text at once until all aredone. To proceed to the next screen, user has to send any command except thosepredefined:
Unfortunately, teeworlds rcon was not supposed to be used as a terminal, so itlacks some features. Terminals use mono-spaced font and there is a way to findout the width and the height of the terminal at runtime. None of these is truefor teeworlds, so to control the output two variables, $more_rows and $more_cols, were defined. The former is the number of lines more prints perscreen. It seems that rcon height is fixed in the code to be 25. $more_colsis a maximum number of characters to print per line. Its value is hand-pickedso that the common line of English text looks fine. Obviously it will fail fora line like "WWWWW..." because "W" characters are rather wide, but for commontext it should do. Feel free to complain.
An interactive function is a function that may ask the user for additional inputwhile being executed. Since teeworlds is a single-threaded program, it isimpossible to implement it in a straightforward way, because the server will hangwhile the player is talking to the function. Although the multi-threadedapproach still can be implemented, I decided to do it in a simpler way. Tocreate an interactive function, define the function that interpretes the useranswer and unshift it into the @$interactive[$RCON_CID] array. You may usecall_interactive for this purpose. You are free to modify$interactive[$RCON_CID] during execution. Don't forget to shift the arrayback when the function returns (with call_interactive you may call $quit->()closure variable). Here is a simple example:
The @INC array that holds paths used by Perl to find module files is modifiedto include /.teeworlds and src/config directories. If you want to run theserver from the place other than teeworlds repository directory, either copysrc/config/Teeworlds to /.teeworlds or modify @INC appropriately.
Teeworlds::Common contains a set of the most common features: rcon commandsrequired to effectively control the server and a few useful functions. It isexpected to be included in every not-very-unusual configuration script, so itfills the main namespace with its symbols. Other modules may depend on it.