At minimum, the code is:
#!/usr/bin/env php
<?php
$host = "127.0.0.1";
$port = 27910;
$rcon_password = "hackme";
$message = "Cheeeese";
$interval = 5; // 5 min
$sock = fsockopen("udp://$host:$port", $port, $errno, $errstr, 5);
while (true) {
echo "Sent\n";
fwrite($sock, sprintf("\xFF\xFF\xFF\xFFrcon %s say %s\0", $rcon_password, $message);
sleep(60 * $interval);
}
Just keep it running on a system.
In Python:
#!/usr/bin/env python
import socket
import time
host = "127.0.0.1"
port = 27910
rcon_password = "hackme"
message = "Cheeeese"
interval = 5 # 5 min
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((host, port))
while True:
print("Sent")
sock.send("\xFF\xFF\xFF\xFFrcon %s say %s\0" % (rcon_password, message));
time.sleep(60 * interval)
I'm not sure why I didn't just write it at the time.