|
Dedicated Server Discuss technical issues related to hosting your own servers. |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
KCoop script
In case anyone's interested, here's the script running on Crack's Co-op server: http://bukva-yo.ru/kcoop-0.5.1.zip
It's not technically a script, but rather a compiled Go program. This has the advantage that it's very fast and completely standalone: you only need a single executable and nothing else. You just start your Altitude server, start kcoop.exe (in any order) and that's it. Included in the zip are 32 bit binaries for Windows, Linux and Mac, sample XML config file and source files. Source files ("src" folder) are not needed for normal operation, they're only included in case you want to see what makes it tic or customize something beyond what the config file allows. To compile a new binary, you'll need the Go compiler from golang.org. You're free to do whatever you want with this software, but you do it at your own risk. You're absolutely required to credit me, 19 cm, as the original author, unless you don't want to, in which case don't bother. Last edited by 19 cm; 01-29-2013 at 06:38 PM. |
#2
|
|||
|
|||
Very interesting. Thanks for sharing!
|
#3
|
|||
|
|||
Thanks for sharing ! So I put this on my dedicated server tonight, which runs on Windows, and it worked perfectly. Also was very easy to run, idk anything about coding but this I can do ;p.
I had 2 questions and I was wondering if you could help me: - The commands like !rules and !admin worked, but how do I change the output of those commands? I downloaded the Go program, but I couldnt figure it out. For example putting in new rules or admins. - Hwo do I get the / commands in? Now I can only do !bal and not /bal. Cheers, Geiro |
#4
|
|||
|
|||
Thanks for trying it Geiro, I'm glad to hear it works on Windows.
- if you have installed the Go compiler from golang.org, re-compiling the script should be as easy as typing "go build" in DOS console in the folder containing kcoop.go and lconfig.go (that's what works for me in Linux anyway). So if you want to change !rules, edit kcoop.go with a text editor and recompile. Same for the !admin output. Note that the script doesn't actually have an idea who the admins are, it's just the message to the players that you can edit. Use Altitude's launcher_config to add/del admins. - for /bal etc to work, make sure the file custom_json_commands.txt is in Altitude/servers. You may have to restart the server. I may make this stuff configurable with a config file so you don't have to mess with Go compilers... one day |
#5
|
|||
|
|||
So the 2nd question is solved, putting that command text in the server file worked, thanks for that!
About the first question, I edited the kcoop.go file with notepad; put some new rules in etc. After that I turned it into a GO-file again, I relaunced my server (and the script) but nothing changed.. What did I do wrong :P? EDIT: First question also solved, I read your post again and I forgot the Go Build command EDIT2: The admin command is missing, if you type it in the server it gives the same as the !about funtion. This is what the About function says, I cant find the admin function though.. func showAbout(pl *player_t) { serverWhisper(pl, "You're playing on G's Co-op server, have fun!") serverWhisper(pl, "Using KCoop script by 19 cm") serverWhisper(pl, "Server location: Helmond, the Netherlands")// serverWhisper(pl, "Administrators: Geiro, Bob17, Butter, 19 cm") } Last edited by Geiro; 07-23-2012 at 05:08 PM. |
#6
|
|||
|
|||
I wanted an "about" command where I could put whatever information about the server I want people to know: location, software, hardware, connection, admin(s)... And it didn't find !admin particularly useful, so I just made it an alias for /about, just for "compatibility" with Co-op Sandbox.
If you insist on having a dedicated !admin command though, you can add a new function for it: func showAdmin(pl *player_t) { serverWhisper(pl, "Administrator: Geiro the Mighty") } and change if message == "!admin" && pnum >= 0 { showAbout(&players[pnum]) to if message == "!admin" && pnum >= 0 { showAdmin(&players[pnum]) |
#7
|
|||
|
|||
Thanks again, this worked! I don't want to bother you, but I have 2 more questions :P:
- There are certain maps (like Anthrax, Apocalypse and Shade) that play with the right team and you fixed the automatic assigning (all to the right team instead of to the left) on the Kosmos server, how do I do this? Also we have certain 'race' maps that require both teams to be played on, can I make an exception in the automatic assigning for those maps? (might host a race server later, but I only have 2 maps of them atm. If anyone has more race maps, 1dm of ffa, please pm me ) - I'm not sure if it has to do with my server or if it is a bug, but the script only seems to work for a few hours. I also noticed this on your Kosmos server, so it cant be the dedicated server? If this idd is a bug, can't we make the script restart every hour or something like that? I don't know if that's possible, but just an idea Last edited by Geiro; 07-24-2012 at 12:41 AM. |
#8
|
|||
|
|||
I doubt it's a matter of where the script simply "stops working" after a couple of hours. Sounds like the script encounters an unhandled exception and decides to crash. I'm unfamiliar with Javascript (or GO, for that matter), but try to find the console log that the script writes to, if at all.
|
#9
|
|||
|
|||
1. Right-team maps: find the line
if /*mapname == "1de_coop_kead" ||*/ mapname == "1de_coop_anthrax" { You can add ass many right-team maps as you like, like this: if mapname == "1de_coop_anthrax" || mapname == "1de_coop_map2" || mapname == "1de_coop_map3" { 2. Race maps: find the line fmt.Println("Reassigning player to team", playerTeam) BEFORE it, add if mapname == "1de_coop_racemap1" || mapname == "1de_coop_racemap2" { break } This will turn off auto-assignment, but you lose your warranty as to the correct announcement of match results... 3. Does the script crash with "unexpected end of JSON input"? This should fix it: Find the two places where it says err := json.Unmarshal(b, &f) if err != nil { log.Fatal(err) } and change them to err := json.Unmarshal(b, &f) if err != nil { fmt.Println("Whoops! Couldn't unmarshal this: ", b) return } |
#10
|
|||
|
|||
Thanks, I'll try this later today. As for the script 'crash', it doesn't give any error or message, it literally just stops working. For example I put it up last night at 8 pm, and when I got home at 12 the script was still running, but it didn't do anything anymore. The last line was a chat log of 10 pm orso.
|
#11
|
|||
|
|||
Does your log_old.txt have a last-modified time of "10 pm orso"?
Then it looks like the script fails to notice when the server rotates logs (rename log.txt -> log_old.txt, start new log.txt) and keeps trying to read the log that's no longer being written to. I found a neat solution for this on Linux but apparently it doesn't work on Windows. I'll try to come up with something. Last edited by 19 cm; 07-24-2012 at 11:31 AM. |
#12
|
|||
|
|||
log_old is last modified 23/7 16.47 and the log is last modified 24/7 11.01
|
#13
|
|||
|
|||
New version uploaded: http://bukva-yo.ru/kcoop-0.2.zip
What's new: configuration via xml file, colored console output, admin list from launcher config, Windows log-rotate freeze fixed. Last edited by 19 cm; 07-26-2012 at 01:00 AM. |
#14
|
|||
|
|||
New version uploaded: http://bukva-yo.ru/kcoop-0.3.zip
What's new: some bug fixes, Windows log-rotate freeze fixed (again), better support for race (winning team is announced even if both bases are destroyed). |
#15
|
|||
|
|||
New version: http://bukva-yo.ru/kcoop-0.4.zip
What's new: "player still considered alive after team change" bug fix, "win counted even if base not destroyed on 1de_coop_truecoop" fix. |
#16
|
|||
|
|||
I can't be bothered to figure out if it's possible at the moment, but if this Go stuff can be used with Mac maybe I'll try and compile it on my mac later.
|
#17
|
|||
|
|||
There's a good chance it will "just work" on Intel Mac. Just copy kcoop_linux.go to kcoop_darwin.go.
|
#18
|
|||
|
|||
Nice script, I've been looking through it on the server.
Would it be possible to add a java function so you can talk with people on the server from the console? |
#19
|
|||
|
|||
Chatting from the console shouldn't be too hard if you don't insist on it being a "java function"
|
#20
|
|||
|
|||
Well, your code looks a LOT like java :P Which is why I was wondering you could just add one / thought it was Java or Javascript or something :P
As far as i know right now it isn't possible to chat from console. I have 1 instance of the Altitude server running which runs 4 servers. And 3 instances of Kcoop.exe, it would be awesome if the command window of Kcoop.exe would feature a commandline. That way it's way easier to announce a 15 minute downtime due to a reboot from the server side instead of having to log on to the servers 1 at a time. You're the man if you can implement it =D Still, nice code :P |
#21
|
|||
|
|||
Here's a new version: http://bukva-yo.ru/kcoop-0.5beta.zip
Highlights: entering server commands from the console, Intel Mac binary (untested) You can type any text into the window, press Enter, and it will be executed as a server command. Examples: Quote:
You can use ">" as a shortcut for serverMessage. For example, Quote:
Last edited by 19 cm; 11-14-2012 at 09:17 AM. |
#22
|
|||
|
|||
Thanks a lot. I'll go test it when the servers are empty. And report back.
|
#23
|
|||
|
|||
Another update: http://bukva-yo.ru/kcoop-0.5beta2.zip
A thorough revamp of the user command system. Makes it possible for admins to disable specific commands via config file. The text of /cmds is also customizable via config. !kickme command added Fix occasional spurious "testPlaneScale set to 100" messages. The script won't touch the test* vars unless specified by map config. Automatic team assignment only works on coop maps now, that is, maps whose name looks like ???_coop_* |
#24
|
|||
|
|||
It works perfectly. Thanks a lot. Very useful feature!
|
#25
|
|||
|
|||
Quote:
|
#26
|
|||
|
|||
So that is the purpose of !kickme you say, to give people a few giggles?
|
#27
|
|||
|
|||
Of course, what would it else be :P?
|
#28
|
|||
|
|||
It has always been a mystery to me
|
#29
|
|||
|
|||
Re-uploaded version 0.5beta2 as version 0.5: http://bukva-yo.ru/kcoop-0.5.zip
It's exactly the same code and binaries, just the name changed to reflect the fact that it's been out for a while and no bugs have been found. |
#30
|
|||
|
|||
A small update: http://bukva-yo.ru/kcoop-0.5.1.zip. Fixes a security issue.
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need Help with PHP Script | jardanc@yahoo.com | Dedicated Server | 24 | 10-12-2010 07:09 PM |
Gargamel - Smurf Detection Script | tec27 | General Altitude Discussion | 12 | 07-25-2009 03:30 AM |