brushworks Posted February 14, 2014 Posted February 14, 2014 Hello there again, I know I ask many questions but I'd like to know if it's possible to print news messages with sv_say like ClanMoD does (I'm using JA+ and Linux). If anyone doesn't know what I mean it's something like an announcement that appears in Chat after sometime, and there you type something like we are recruiting and the site. It acts like sv_say. Thanks! Do not fear their feeble attack, my faithful. Nothing will stop the return of the SITH!
Raz0r Posted February 14, 2014 Posted February 14, 2014 You could run the JA server in a named screen session, set up an hourly cronjob and pipe to stdin of that screen (i.e. invoke screen with the -X switch) Apart from that, I'm not sure what can be done with JA+ With JA++, you could quite easily set up a Lua plugin to broadcast a message every x seconds, among many other things. EDIT: I suppose you could also rely on an external RCON method, i.e. running a php script or java app to send an rcon packet on a timer. I think JAWA currently does something like that. @@SiLink?
brushworks Posted February 16, 2014 Author Posted February 16, 2014 At the moment I'm using Ja+, would it be possible to use both at the same time? Linux server ofc Also, the PHP script would be a suitable method, how should I make that? What are the possibilities of Ja++? Cause I've only seen 6/7 scripts Do not fear their feeble attack, my faithful. Nothing will stop the return of the SITH!
brushworks Posted February 16, 2014 Author Posted February 16, 2014 At the moment I'm using Ja+, would it be possible to use both at the same time? Linux server ofc Also, the PHP script would be a suitable method, how should I make that? What are the possibilities of Ja++? Cause I've only seen 6/7 scripts Do not fear their feeble attack, my faithful. Nothing will stop the return of the SITH!
Raz0r Posted February 16, 2014 Posted February 16, 2014 Just quickly wrote this up, should work. I'm executing it on the command-line as such:$ php5 rcon.php<?php // change these however you like $ip = 'localhost'; $port = 29070; $pass = 'mypass'; $cmd = 'svsay Hello there!'; $mins = 30; $packet = str_repeat( chr( 255 ), 4 ) . "rcon $pass $cmd\n"; print( "Sending '$cmd' to $ip:$port every $mins minutes\n" ); if ( $socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ) ) { while ( 1 ) { socket_sendto( $socket, $packet, strlen( $packet ), 0, $ip, $port ); sleep( $mins * 60 ); } } else { print( "can't create socket\n" ); } ?>
brushworks Posted February 16, 2014 Author Posted February 16, 2014 Fatal error: Call to undefined function socket_create() in ...msg.php on line 13 Do not fear their feeble attack, my faithful. Nothing will stop the return of the SITH!
Raz0r Posted February 16, 2014 Posted February 16, 2014 Seems your host is either running a really old version of PHP, was not built with sockets support, or has been configured to disable sockets. It works fine here on a clean install of php5 (PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:24:35))
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now